|
Chris PeBenito |
0fbfa5 |
#DESC Mysqld - Database server
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Author: Russell Coker <russell@coker.com.au>
|
|
Chris PeBenito |
0fbfa5 |
# X-Debian-Packages: mysql-server
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
#################################
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Rules for the mysqld_t domain.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# mysqld_exec_t is the type of the mysqld executable.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
5493c2 |
daemon_domain(mysqld, `, nscd_client_domain')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
77f6e2 |
allow mysqld_t mysqld_port_t:tcp_socket { name_bind name_connect };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow mysqld_t mysqld_var_run_t:sock_file create_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
etcdir_domain(mysqld)
|
|
Chris PeBenito |
0fbfa5 |
type mysqld_db_t, file_type, sysadmfile;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
log_domain(mysqld)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# for temporary tables
|
|
Chris PeBenito |
0fbfa5 |
tmp_domain(mysqld)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow mysqld_t usr_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow mysqld_t self:fifo_file { read write };
|
|
Chris PeBenito |
0fbfa5 |
allow mysqld_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow initrc_t mysqld_t:unix_stream_socket connectto;
|
|
Chris PeBenito |
0fbfa5 |
allow initrc_t mysqld_var_run_t:sock_file write;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow initrc_t mysqld_log_t:file { write append setattr ioctl };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow mysqld_t self:capability { dac_override setgid setuid net_bind_service };
|
|
Chris PeBenito |
5493c2 |
allow mysqld_t self:process { setsched getsched };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow mysqld_t proc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Allow access to the mysqld databases
|
|
Chris PeBenito |
0fbfa5 |
create_dir_file(mysqld_t, mysqld_db_t)
|
|
Chris PeBenito |
0fbfa5 |
allow mysqld_t var_lib_t:dir { getattr search };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
65a252 |
can_network(mysqld_t)
|
|
Chris PeBenito |
0fbfa5 |
can_ypbind(mysqld_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# read config files
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file(initrc_t, mysqld_etc_t)
|
|
Chris PeBenito |
0fbfa5 |
allow mysqld_t { etc_t etc_runtime_t }:{ file lnk_file } { read getattr };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow mysqld_t etc_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
read_sysctl(mysqld_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
can_unix_connect(sysadm_t, mysqld_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# for /root/.my.cnf - should not be needed
|
|
Chris PeBenito |
0fbfa5 |
allow mysqld_t sysadm_home_dir_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow mysqld_t sysadm_home_t:file { read getattr };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`logrotate.te', `
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file(logrotate_t, mysqld_etc_t)
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t mysqld_db_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t mysqld_var_run_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow logrotate_t mysqld_var_run_t:sock_file write;
|
|
Chris PeBenito |
0fbfa5 |
can_unix_connect(logrotate_t, mysqld_t)
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`daemontools.te', `
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans( svc_run_t, mysqld_exec_t, mysqld_t)
|
|
Chris PeBenito |
0fbfa5 |
allow svc_start_t mysqld_t:process signal;
|
|
Chris PeBenito |
0fbfa5 |
svc_ipc_domain(mysqld_t)
|
|
Chris PeBenito |
0fbfa5 |
')dnl end ifdef daemontools
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`distro_redhat', `
|
|
Chris PeBenito |
0fbfa5 |
allow initrc_t mysqld_db_t:dir create_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# because Fedora has the sock_file in the database directory
|
|
Chris PeBenito |
0fbfa5 |
file_type_auto_trans(mysqld_t, mysqld_db_t, mysqld_var_run_t, sock_file)
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`targeted_policy', `', `
|
|
Chris PeBenito |
0fbfa5 |
bool allow_user_mysql_connect false;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
if (allow_user_mysql_connect) {
|
|
Chris PeBenito |
0fbfa5 |
allow userdomain mysqld_var_run_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow userdomain mysqld_var_run_t:sock_file write;
|
|
Chris PeBenito |
0fbfa5 |
}
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
77f6e2 |
allow mysqld_t self:netlink_route_socket r_netlink_socket_perms;
|
|
Chris PeBenito |
cf6a7d |
ifdef(`crond.te', `
|
|
Chris PeBenito |
cf6a7d |
allow system_crond_t mysqld_etc_t:file { getattr read };
|
|
Chris PeBenito |
cf6a7d |
')
|