Debian Codegraph @

support-files/policy/selinux/mariadb-server.te

raw
1 # This SELinux type enforcement (.te) file has been copied under New BSD License
2 # from Percona XtraDB Cluster, along with some additions.
3
4 module mariadb-server 1.0;
5
6 require {
7 type user_tmp_t;
8 #type kerberos_master_port_t;
9 type mysqld_safe_t;
10 type tmp_t;
11 type tmpfs_t;
12 type hostname_exec_t;
13 type ifconfig_exec_t;
14 type sysctl_net_t;
15 type proc_net_t;
16 type port_t;
17 type mysqld_t;
18 type var_lib_t;
19 type rsync_exec_t;
20 type bin_t;
21 type shell_exec_t;
22 type anon_inodefs_t;
23 type fixed_disk_device_t;
24 type usermodehelper_t;
25 class lnk_file read;
26 class process { getattr signull };
27 class unix_stream_socket connectto;
28 class capability { ipc_lock sys_resource sys_nice };
29 class tcp_socket { name_bind name_connect };
30 class file { execute setattr read create getattr execute_no_trans write ioctl open append unlink };
31 class sock_file { create unlink getattr };
32 class blk_file { read write open };
33 class dir { write search getattr add_name read remove_name open };
34
35 # MariaDB additions
36 type kerberos_port_t;
37 type tram_port_t;
38 type mysqld_port_t;
39 class udp_socket name_bind;
40 class process setpgid;
41 class netlink_tcpdiag_socket { create nlmsg_read };
42 }
43
44
45 #============= mysqld_safe_t ==============
46 allow mysqld_safe_t mysqld_t:process signull;
47 allow mysqld_safe_t self:capability { sys_resource sys_nice };
48 allow mysqld_safe_t tmp_t:file { create read write open getattr unlink ioctl setattr };
49 allow mysqld_safe_t tmp_t:dir { write remove_name add_name };
50 allow mysqld_safe_t tmp_t:sock_file { getattr unlink };
51 allow mysqld_safe_t user_tmp_t:sock_file { getattr unlink };
52 allow mysqld_safe_t var_lib_t:dir { write add_name };
53 allow mysqld_safe_t var_lib_t:file { write ioctl setattr create open getattr append unlink };
54
55 #============= mysqld_t ==============
56 allow mysqld_t anon_inodefs_t:file write;
57 allow mysqld_t tmp_t:sock_file { create unlink };
58 allow mysqld_t tmpfs_t:dir { write search read remove_name open add_name };
59 allow mysqld_t tmpfs_t:file { write getattr read create unlink open };
60 allow mysqld_t fixed_disk_device_t:blk_file { read write open };
61 allow mysqld_t ifconfig_exec_t:file { read execute open execute_no_trans getattr };
62
63 #This rule allows connecting on 4444/4567/4568
64 #allow mysqld_t kerberos_master_port_t:tcp_socket { name_bind name_connect };
65
66 allow mysqld_t mysqld_safe_t:dir { getattr search };
67 allow mysqld_t mysqld_safe_t:file { read open };
68 allow mysqld_t self:unix_stream_socket connectto;
69 allow mysqld_t port_t:tcp_socket { name_bind name_connect };
70 allow mysqld_t proc_net_t:file { read getattr open };
71 allow mysqld_t sysctl_net_t:dir search;
72 allow mysqld_t var_lib_t:file { getattr open append };
73 allow mysqld_t var_lib_t:sock_file { create unlink getattr };
74 allow mysqld_t rsync_exec_t:file { read getattr open execute execute_no_trans };
75 allow mysqld_t self:process getattr;
76 allow mysqld_t hostname_exec_t:file { read getattr execute open execute_no_trans };
77 allow mysqld_t user_tmp_t:dir { write add_name };
78 allow mysqld_t user_tmp_t:file create;
79 allow mysqld_t bin_t:lnk_file read;
80 allow mysqld_t tmp_t:file { append create read write open getattr unlink setattr };
81 allow mysqld_t usermodehelper_t:file { read open };
82
83 # Allows too much leeway - the mariabackup/wsrep rules in fc should fix it, but
84 # keep for the moment.
85 allow mysqld_t shell_exec_t:file { execute_no_trans getattr read execute open };
86 allow mysqld_t bin_t:file { getattr read execute open execute_no_trans ioctl };
87
88 # MariaDB additions
89 allow mysqld_t self:process setpgid;
90 allow mysqld_t self:capability { ipc_lock };
91
92 # This rule allows port tcp/4444
93 allow mysqld_t kerberos_port_t:tcp_socket { name_bind name_connect };
94 # This rule allows port tcp/4567 (tram_port_t may not be available on
95 # older versions)
96 allow mysqld_t tram_port_t:tcp_socket name_bind;
97 # This rule allows port udp/4567 (see README)
98 allow mysqld_t mysqld_port_t:udp_socket name_bind;
99
100 # Rules related to mariabackup
101 allow mysqld_t self:netlink_tcpdiag_socket { create nlmsg_read };
102 allow mysqld_t sysctl_net_t:file { read getattr open };
103