forked from devexp-db/mysql-selinux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmysql.te
297 lines (223 loc) · 8.52 KB
/
mysql.te
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
policy_module(mysql, 1.14.1)
########################################
#
# Declarations
#
## <desc>
## <p>
## Allow mysqld to connect to all ports
## </p>
## </desc>
gen_tunable(mysql_connect_any, false)
## <desc>
## <p>
## Allow mysqld to connect to http port
## </p>
## </desc>
gen_tunable(mysql_connect_http, false)
type mysqld_t;
type mysqld_exec_t;
init_daemon_domain(mysqld_t, mysqld_exec_t)
init_nnp_daemon_domain(mysqld_t)
type mysqld_safe_t;
type mysqld_safe_exec_t;
init_daemon_domain(mysqld_safe_t, mysqld_safe_exec_t)
type mysqld_var_run_t;
files_pid_file(mysqld_var_run_t)
type mysqld_db_t;
files_type(mysqld_db_t)
type mysqld_etc_t alias etc_mysqld_t;
files_config_file(mysqld_etc_t)
type mysqld_home_t;
userdom_user_home_content(mysqld_home_t)
type mysqld_unit_file_t;
systemd_unit_file(mysqld_unit_file_t)
type mysqld_initrc_exec_t;
init_script_file(mysqld_initrc_exec_t)
type mysqld_log_t;
logging_log_file(mysqld_log_t)
type mysqld_tmp_t;
files_tmp_file(mysqld_tmp_t)
type mysqlmanagerd_t;
type mysqlmanagerd_exec_t;
init_daemon_domain(mysqlmanagerd_t, mysqlmanagerd_exec_t)
type mysqlmanagerd_initrc_exec_t;
init_script_file(mysqlmanagerd_initrc_exec_t)
type mysqlmanagerd_var_run_t;
files_pid_file(mysqlmanagerd_var_run_t)
########################################
#
# Local policy
#
allow mysqld_t self:capability { dac_read_search ipc_lock sys_nice sys_resource net_bind_service };
dontaudit mysqld_t self:capability sys_tty_config;
allow mysqld_t self:process { setsched getsched setrlimit signal_perms rlimitinh };
allow mysqld_t self:fifo_file rw_fifo_file_perms;
allow mysqld_t self:shm create_shm_perms;
allow mysqld_t self:unix_stream_socket create_stream_socket_perms;
allow mysqld_t self:tcp_socket create_stream_socket_perms;
allow mysqld_t self:udp_socket create_socket_perms;
manage_dirs_pattern(mysqld_t, mysqld_db_t, mysqld_db_t)
manage_files_pattern(mysqld_t, mysqld_db_t, mysqld_db_t)
manage_sock_files_pattern(mysqld_t, mysqld_db_t, mysqld_db_t)
manage_lnk_files_pattern(mysqld_t, mysqld_db_t, mysqld_db_t)
files_var_lib_filetrans(mysqld_t, mysqld_db_t, { dir file lnk_file })
allow mysqld_t mysqld_db_t:file map;
allow mysqld_t mysqld_etc_t:file read_file_perms;
allow mysqld_t mysqld_etc_t:lnk_file read_lnk_file_perms;
allow mysqld_t mysqld_etc_t:dir list_dir_perms;
manage_dirs_pattern(mysqld_t, mysqld_log_t, mysqld_log_t)
manage_files_pattern(mysqld_t, mysqld_log_t, mysqld_log_t)
manage_lnk_files_pattern(mysqld_t, mysqld_log_t, mysqld_log_t)
manage_fifo_files_pattern(mysqld_t, mysqld_log_t, mysqld_log_t)
logging_log_filetrans(mysqld_t, mysqld_log_t, { dir file })
manage_dirs_pattern(mysqld_t, mysqld_tmp_t, mysqld_tmp_t)
manage_files_pattern(mysqld_t, mysqld_tmp_t, mysqld_tmp_t)
files_tmp_filetrans(mysqld_t, mysqld_tmp_t, { file dir })
allow mysqld_t mysqld_tmp_t:file map;
manage_dirs_pattern(mysqld_t, mysqld_var_run_t, mysqld_var_run_t)
manage_files_pattern(mysqld_t, mysqld_var_run_t, mysqld_var_run_t)
manage_sock_files_pattern(mysqld_t, mysqld_var_run_t, mysqld_var_run_t)
files_pid_filetrans(mysqld_t, mysqld_var_run_t, { dir file sock_file })
usermanage_read_crack_db(mysqld_t)
userdom_dontaudit_use_unpriv_user_fds(mysqld_t)
kernel_read_network_state(mysqld_t)
kernel_read_system_state(mysqld_t)
kernel_read_kernel_sysctls(mysqld_t)
corecmd_exec_bin(mysqld_t)
corecmd_exec_shell(mysqld_t)
corenet_all_recvfrom_netlabel(mysqld_t)
corenet_tcp_sendrecv_generic_if(mysqld_t)
corenet_udp_sendrecv_generic_if(mysqld_t)
corenet_tcp_sendrecv_generic_node(mysqld_t)
corenet_udp_sendrecv_generic_node(mysqld_t)
corenet_tcp_sendrecv_all_ports(mysqld_t)
corenet_udp_sendrecv_all_ports(mysqld_t)
corenet_tcp_bind_generic_node(mysqld_t)
corenet_tcp_bind_mysqld_port(mysqld_t)
corenet_tcp_bind_tram_port(mysqld_t)
corenet_tcp_connect_mysqld_port(mysqld_t)
corenet_tcp_connect_tram_port(mysqld_t)
corenet_sendrecv_mysqld_client_packets(mysqld_t)
corenet_sendrecv_mysqld_server_packets(mysqld_t)
can_exec(mysqld_t, mysqld_exec_t)
dev_read_sysfs(mysqld_t)
dev_read_urand(mysqld_t)
fs_getattr_all_fs(mysqld_t)
fs_search_auto_mountpoints(mysqld_t)
fs_rw_hugetlbfs_files(mysqld_t)
domain_use_interactive_fds(mysqld_t)
domain_read_all_domains_state(mysqld_t)
files_getattr_var_lib_dirs(mysqld_t)
files_read_etc_runtime_files(mysqld_t)
files_search_var_lib(mysqld_t)
files_search_pids(mysqld_t)
files_getattr_all_sockets(mysqld_t)
auth_use_pam(mysqld_t)
logging_send_syslog_msg(mysqld_t)
sysnet_read_config(mysqld_t)
sysnet_domtrans_ifconfig(mysqld_t)
ifdef(`distro_redhat',`
filetrans_pattern(mysqld_t, mysqld_db_t, mysqld_var_run_t, sock_file)
')
tunable_policy(`mysql_connect_any',`
corenet_tcp_connect_all_ports(mysqld_t)
corenet_sendrecv_all_client_packets(mysqld_t)
')
tunable_policy(`mysql_connect_http',`
corenet_tcp_connect_http_port(mysqld_t)
')
optional_policy(`
daemontools_service_domain(mysqld_t, mysqld_exec_t)
')
optional_policy(`
openshift_search_lib(mysqld_t)
')
optional_policy(`
rhcs_manage_cluster_pid_files(mysqld_t)
')
optional_policy(`
seutil_sigchld_newrole(mysqld_t)
')
optional_policy(`
udev_read_db(mysqld_t)
')
optional_policy(`
rsync_exec(mysqld_t)
')
#######################################
#
# Local mysqld_safe policy
#
# setuig/setgid may be used in mysqld_safe and mysqld_safe_helper
allow mysqld_safe_t self:capability { chown dac_read_search setgid setuid fowner kill sys_nice sys_resource };
dontaudit mysqld_safe_t self:capability sys_ptrace;
allow mysqld_safe_t self:process { setsched getsched setrlimit };
allow mysqld_safe_t self:fifo_file rw_fifo_file_perms;
allow mysqld_safe_t mysqld_t:process { rlimitinh noatsecure };
read_lnk_files_pattern(mysqld_safe_t, mysqld_db_t, mysqld_db_t)
delete_sock_files_pattern(mysqld_safe_t, mysqld_db_t, mysqld_db_t)
domtrans_pattern(mysqld_safe_t, mysqld_exec_t, mysqld_t)
list_dirs_pattern(mysqld_safe_t, mysqld_log_t, mysqld_log_t)
manage_files_pattern(mysqld_safe_t, mysqld_log_t, mysqld_log_t)
manage_lnk_files_pattern(mysqld_safe_t, mysqld_log_t, mysqld_log_t)
logging_log_filetrans(mysqld_safe_t, mysqld_log_t, file)
manage_files_pattern(mysqld_safe_t, mysqld_var_run_t, mysqld_var_run_t)
delete_sock_files_pattern(mysqld_safe_t, mysqld_var_run_t, mysqld_var_run_t)
kernel_read_system_state(mysqld_safe_t)
kernel_read_kernel_sysctls(mysqld_safe_t)
can_exec(mysqld_safe_t, mysqld_safe_exec_t)
corecmd_exec_bin(mysqld_safe_t)
corecmd_exec_shell(mysqld_safe_t)
dev_read_urand(mysqld_safe_t)
dev_list_sysfs(mysqld_safe_t)
domain_read_all_domains_state(mysqld_safe_t)
files_dontaudit_access_check_root(mysqld_safe_t)
files_dontaudit_search_all_mountpoints(mysqld_safe_t)
files_dontaudit_getattr_all_dirs(mysqld_safe_t)
files_write_root_dirs(mysqld_safe_t)
logging_log_filetrans(mysqld_safe_t, mysqld_log_t, file)
logging_send_syslog_msg(mysqld_safe_t)
auth_use_nsswitch(mysqld_safe_t)
domain_dontaudit_signull_all_domains(mysqld_safe_t)
mysql_manage_db_files(mysqld_safe_t)
mysql_read_config(mysqld_safe_t)
mysql_search_pid_files(mysqld_safe_t)
mysql_signull(mysqld_safe_t)
mysql_write_log(mysqld_safe_t)
optional_policy(`
hostname_exec(mysqld_safe_t)
hostname_exec(mysqld_t)
')
########################################
#
# MySQL Manager Policy
#
allow mysqlmanagerd_t self:capability { dac_read_search kill };
allow mysqlmanagerd_t self:process signal;
allow mysqlmanagerd_t self:fifo_file rw_fifo_file_perms;
allow mysqlmanagerd_t self:tcp_socket create_stream_socket_perms;
allow mysqlmanagerd_t self:unix_stream_socket create_stream_socket_perms;
mysql_read_config(initrc_t)
mysql_read_config(mysqlmanagerd_t)
mysql_read_pid_files(mysqlmanagerd_t)
mysql_search_db(mysqlmanagerd_t)
mysql_signal(mysqlmanagerd_t)
mysql_stream_connect(mysqlmanagerd_t)
domtrans_pattern(mysqlmanagerd_t, mysqld_exec_t, mysqld_t)
manage_files_pattern(mysqlmanagerd_t, mysqld_var_run_t, mysqlmanagerd_var_run_t)
manage_sock_files_pattern(mysqlmanagerd_t, mysqld_var_run_t, mysqlmanagerd_var_run_t)
filetrans_pattern(mysqlmanagerd_t, mysqld_var_run_t, mysqlmanagerd_var_run_t, { file sock_file })
kernel_read_system_state(mysqlmanagerd_t)
corecmd_exec_shell(mysqlmanagerd_t)
corenet_all_recvfrom_netlabel(mysqlmanagerd_t)
corenet_tcp_sendrecv_generic_if(mysqlmanagerd_t)
corenet_tcp_sendrecv_generic_node(mysqlmanagerd_t)
corenet_tcp_sendrecv_all_ports(mysqlmanagerd_t)
corenet_tcp_bind_generic_node(mysqlmanagerd_t)
corenet_tcp_bind_mysqlmanagerd_port(mysqlmanagerd_t)
corenet_tcp_connect_mysqlmanagerd_port(mysqlmanagerd_t)
corenet_sendrecv_mysqlmanagerd_server_packets(mysqlmanagerd_t)
corenet_sendrecv_mysqlmanagerd_client_packets(mysqlmanagerd_t)
dev_read_urand(mysqlmanagerd_t)
userdom_getattr_user_home_dirs(mysqlmanagerd_t)