summaryrefslogtreecommitdiffstats
path: root/redhat/selinux/bcfg2.te
blob: 65e0d2b9cb34bd2b5c6b90be51f06561a1a6b804 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
policy_module(bcfg2, 1.1.0)

########################################
#
# Declarations
#

gen_tunable(bcfg2_server_exec_scripts, false)
gen_tunable(bcfg2_server_can_network_connect_db, false)

type bcfg2_t;
type bcfg2_exec_t;
init_daemon_domain(bcfg2_t, bcfg2_exec_t)

type bcfg2_server_t;
type bcfg2_server_exec_t;
init_daemon_domain(bcfg2_server_t, bcfg2_server_exec_t)

type bcfg2_initrc_exec_t;
init_script_file(bcfg2_initrc_exec_t)

type bcfg2_server_initrc_exec_t;
init_script_file(bcfg2_server_initrc_exec_t)

type bcfg2_var_lib_t;
files_type(bcfg2_var_lib_t)

type bcfg2_server_script_t;
type bcfg2_server_script_exec_t;
application_domain(bcfg2_server_script_t, bcfg2_server_script_exec_t)
role system_r types bcfg2_server_script_t;

type bcfg2_yum_helper_exec_t;
application_domain(bcfg2_server_t, bcfg2_server_script_exec_t)

type bcfg2_var_run_t;
files_pid_file(bcfg2_var_run_t)

type bcfg2_lock_t;
files_lock_file(bcfg2_lock_t)

type bcfg2_conf_t;
files_config_file(bcfg2_conf_t)

type bcfg2_tmp_t;
files_tmp_file(bcfg2_tmp_t)

########################################
#
# bcfg2-server local policy
#

allow bcfg2_server_t self:fifo_file rw_fifo_file_perms;
allow bcfg2_server_t self:tcp_socket create_stream_socket_perms;
allow bcfg2_server_t self:unix_stream_socket { connectto create_stream_socket_perms };
allow bcfg2_server_t self:process { setrlimit setsched };
allow bcfg2_server_t self:capability { setgid setuid sys_nice };

manage_dirs_pattern(bcfg2_server_t, bcfg2_var_lib_t, bcfg2_var_lib_t)
manage_files_pattern(bcfg2_server_t, bcfg2_var_lib_t, bcfg2_var_lib_t)
files_var_lib_filetrans(bcfg2_server_t, bcfg2_var_lib_t, dir )
manage_files_pattern(bcfg2_server_t, bcfg2_server_script_t, bcfg2_server_script_t)

manage_files_pattern(bcfg2_server_t, bcfg2_var_run_t, bcfg2_var_run_t)
files_pid_filetrans(bcfg2_server_t, bcfg2_var_run_t, file )

files_search_etc(bcfg2_server_t)
read_files_pattern(bcfg2_server_t, bcfg2_conf_t, bcfg2_conf_t)
read_lnk_files_pattern(bcfg2_server_t, bcfg2_conf_t, bcfg2_conf_t)

manage_files_pattern(bcfg2_server_t, bcfg2_tmp_t, bcfg2_tmp_t)
files_tmp_filetrans(bcfg2_server_t, bcfg2_tmp_t, file)
can_exec(bcfg2_server_t, bcfg2_tmp_t)

kernel_read_system_state(bcfg2_server_t)

corecmd_exec_bin(bcfg2_server_t)
corecmd_exec_shell(bcfg2_server_t)

dev_read_urand(bcfg2_server_t)

fs_list_inotifyfs(bcfg2_server_t)

domain_use_interactive_fds(bcfg2_server_t)

files_read_usr_files(bcfg2_server_t)

logging_send_syslog_msg(bcfg2_server_t)

miscfiles_read_localization(bcfg2_server_t)
miscfiles_read_certs(bcfg2_server_t)

auth_use_nsswitch(bcfg2_server_t)

libs_exec_ldconfig(bcfg2_server_t)

# let bcfg2-server run bcfg2-yum-helper in the exact same context
can_exec(bcfg2_server_t, bcfg2_yum_helper_exec_t)

# port 6789 was somehow already claimed by cyphesis, whatever that is
corenet_tcp_bind_cyphesis_port(bcfg2_server_t)
corenet_tcp_connect_http_port(bcfg2_server_t)
corenet_tcp_sendrecv_http_port(bcfg2_server_t)

optional_policy(`
        postgresql_stream_connect(bcfg2_server_t)
        postgresql_unpriv_client(bcfg2_server_t)
        tunable_policy(`bcfg2_server_can_network_connect_db',`
                postgresql_tcp_connect(bcfg2_server_t)
        ')
')

optional_policy(`
        mysql_stream_connect(bcfg2_server_t)
        mysql_rw_db_sockets(bcfg2_server_t)
        tunable_policy(`bcfg2_server_can_network_connect_db',`
                mysql_tcp_connect(bcfg2_server_t)
        ')
')

optional_policy(`
        unconfined_domain(bcfg2_server_script_t)
')

tunable_policy(`bcfg2_server_exec_scripts', `
        domtrans_pattern(bcfg2_server_t, bcfg2_server_script_exec_t, bcfg2_server_script_t)
        can_exec(bcfg2_server_t, bcfg2_server_script_t)
')

########################################
#
# bcfg2 (client) local policy
#

allow bcfg2_t self:capability { fowner fsetid setuid setgid dac_override sys_nice sys_ptrace sys_tty_config };
allow bcfg2_t self:process { signal signull getsched setsched };
allow bcfg2_t self:fifo_file rw_fifo_file_perms;
allow bcfg2_t self:netlink_route_socket create_netlink_socket_perms;
allow bcfg2_t self:tcp_socket create_stream_socket_perms;
allow bcfg2_t self:udp_socket create_socket_perms;

files_search_etc(bcfg2_t)
read_files_pattern(bcfg2_t, bcfg2_conf_t, bcfg2_conf_t)
read_lnk_files_pattern(bcfg2_t, bcfg2_conf_t, bcfg2_conf_t)

allow bcfg2_t bcfg2_lock_t:file manage_file_perms;
files_lock_filetrans(bcfg2_t, bcfg2_lock_t, file)

kernel_dontaudit_search_sysctl(bcfg2_t)
kernel_dontaudit_search_kernel_sysctl(bcfg2_t)
kernel_read_system_state(bcfg2_t)
kernel_read_crypto_sysctls(bcfg2_t)

cron_system_entry(bcfg2_t, bcfg2_exec_t)

corecmd_exec_bin(bcfg2_t)
corecmd_exec_shell(bcfg2_t)

corenet_all_recvfrom_netlabel(bcfg2_t)
corenet_all_recvfrom_unlabeled(bcfg2_t)
corenet_tcp_sendrecv_generic_if(bcfg2_t)
corenet_tcp_sendrecv_generic_node(bcfg2_t)
corenet_tcp_bind_generic_node(bcfg2_t)
corenet_tcp_connect_cyphesis_port(bcfg2_t)
corenet_sendrecv_cyphesis_client_packets(bcfg2_t)

dev_read_rand(bcfg2_t)
dev_read_sysfs(bcfg2_t)
dev_read_urand(bcfg2_t)

domain_read_all_domains_state(bcfg2_t)
domain_interactive_fd(bcfg2_t)

files_manage_config_files(bcfg2_t)
files_manage_config_dirs(bcfg2_t)
files_manage_etc_dirs(bcfg2_t)
files_manage_etc_files(bcfg2_t)
files_read_usr_symlinks(bcfg2_t)
files_relabel_config_dirs(bcfg2_t)
files_relabel_config_files(bcfg2_t)

selinux_search_fs(bcfg2_t)
selinux_set_all_booleans(bcfg2_t)
selinux_set_generic_booleans(bcfg2_t)
selinux_validate_context(bcfg2_t)

term_dontaudit_getattr_unallocated_ttys(bcfg2_t)
term_dontaudit_getattr_all_ttys(bcfg2_t)

init_all_labeled_script_domtrans(bcfg2_t)
init_domtrans_script(bcfg2_t)
init_read_utmp(bcfg2_t)
init_signull_script(bcfg2_t)

logging_send_syslog_msg(bcfg2_t)

miscfiles_read_hwdata(bcfg2_t)
miscfiles_read_localization(bcfg2_t)

mount_domtrans(bcfg2_t)

auth_use_nsswitch(bcfg2_t)

seutil_domtrans_setfiles(bcfg2_t)
seutil_domtrans_semanage(bcfg2_t)

sysnet_dns_name_resolve(bcfg2_t)
sysnet_run_ifconfig(bcfg2_t, system_r)

optional_policy(`
        consoletype_domtrans(bcfg2_t)
')

optional_policy(`
        hostname_exec(bcfg2_t)
')

optional_policy(`
        files_rw_var_files(bcfg2_t)

        rpm_domtrans(bcfg2_t)
        rpm_domtrans_script(bcfg2_t)
        rpm_manage_db(bcfg2_t)
        rpm_manage_log(bcfg2_t)
')

optional_policy(`
        unconfined_domain(bcfg2_t)
')

optional_policy(`
        usermanage_domtrans_groupadd(bcfg2_t)
        usermanage_domtrans_useradd(bcfg2_t)
')