Debian Codegraph @

selinux/kiwi.te

raw
1 # This file is part of kiwi
2 # Copyright (C) 2026 Neal Gompa
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Library General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this. If not, see <https://www.gnu.org/licenses/>.
16
17
18 policy_module(kiwi, 1.0.0)
19
20 ########################################
21 #
22 # Declarations
23 #
24
25 attribute_role kiwi_roles;
26 roleattribute system_r kiwi_roles;
27
28 type kiwi_t;
29 type kiwi_exec_t;
30 application_domain(kiwi_t, kiwi_exec_t)
31 role kiwi_roles types kiwi_t;
32
33 ########################################
34 #
35 # kiwi local policy
36 #
37
38 allow kiwi_t self:fifo_file manage_fifo_file_perms;
39 allow kiwi_t self:unix_stream_socket create_stream_socket_perms;
40
41 # #####################################
42 # Customization
43 #
44
45 # make an kiwi_t unconfined domain
46 unconfined_domain(kiwi_t)
47
48 # execute setfiles in the setfiles_mac domain
49 # when in the kiwi_t domain
50 seutil_domtrans_setfiles_mac(kiwi_t)
51 kiwi_nnp_nosuid_trans(setfiles_mac_t)
52
53 # Allow sysadm and unconfined to run kiwi
54 optional_policy(`
55 gen_require(`
56 type sysadm_t;
57 role sysadm_r;
58 ')
59
60 kiwi_run(sysadm_t, sysadm_r)
61 ')
62
63 optional_policy(`
64 gen_require(`
65 type unconfined_t;
66 role unconfined_r;
67 ')
68
69 kiwi_run(unconfined_t, unconfined_r)
70 ')
71
72 optional_policy(`
73 gen_require(`
74 type unconfined_service_t;
75 role system_r;
76 ')
77
78 kiwi_run(unconfined_service_t, system_r)
79 ')