Chris PeBenito 29af4c
policy_module(mysql, 1.12.0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Jeremy Solt 12a6a5
## <desc>
Jeremy Solt 12a6a5
## 

Jeremy Solt 12a6a5
## Allow mysqld to connect to all ports
Jeremy Solt 12a6a5
## 

Jeremy Solt 12a6a5
## </desc>
Jeremy Solt 12a6a5
gen_tunable(mysql_connect_any, false)
Jeremy Solt 12a6a5
Chris PeBenito 17de1b
type mysqld_t;
Chris PeBenito 17de1b
type mysqld_exec_t;
Chris PeBenito 0bfccd
init_daemon_domain(mysqld_t, mysqld_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 339235
type mysqld_safe_t;
Chris PeBenito 339235
type mysqld_safe_exec_t;
Chris PeBenito 339235
init_daemon_domain(mysqld_safe_t, mysqld_safe_exec_t)
Chris PeBenito 339235
Chris PeBenito 17de1b
type mysqld_var_run_t;
Chris PeBenito 17de1b
files_pid_file(mysqld_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type mysqld_db_t;
Chris PeBenito 17de1b
files_type(mysqld_db_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type mysqld_etc_t alias etc_mysqld_t;
Chris PeBenito 17de1b
files_config_file(mysqld_etc_t)
Chris PeBenito 17de1b
Chris PeBenito 01e9e7
type mysqld_initrc_exec_t;
Chris PeBenito 01e9e7
init_script_file(mysqld_initrc_exec_t)
Chris PeBenito 01e9e7
Chris PeBenito 17de1b
type mysqld_log_t;
Chris PeBenito 17de1b
logging_log_file(mysqld_log_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type mysqld_tmp_t;
Chris PeBenito 17de1b
files_tmp_file(mysqld_tmp_t)
Chris PeBenito 17de1b
Chris Richards 68cda5
type mysqlmanagerd_t;
Chris Richards 68cda5
type mysqlmanagerd_exec_t;
Chris Richards 68cda5
init_daemon_domain(mysqlmanagerd_t, mysqlmanagerd_exec_t)
Chris Richards 68cda5
Chris Richards 68cda5
type mysqlmanagerd_initrc_exec_t;
Chris Richards 68cda5
init_script_file(mysqlmanagerd_initrc_exec_t)
Chris Richards 68cda5
Chris Richards 68cda5
type mysqlmanagerd_var_run_t;
Chris Richards 68cda5
files_pid_file(mysqlmanagerd_var_run_t)
Chris Richards 68cda5
Chris Richards 68cda5
########################################
Chris Richards 68cda5
#
Chris PeBenito 17de1b
# Local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Jeremy Solt 12a6a5
allow mysqld_t self:capability { dac_override ipc_lock setgid setuid sys_resource net_bind_service };
Chris PeBenito 17de1b
dontaudit mysqld_t self:capability sys_tty_config;
Chris PeBenito 17de1b
allow mysqld_t self:process { setsched getsched setrlimit signal_perms rlimitinh };
Chris PeBenito 0b36a2
allow mysqld_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 01e9e7
allow mysqld_t self:shm create_shm_perms;
Chris PeBenito 17de1b
allow mysqld_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow mysqld_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow mysqld_t self:udp_socket create_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 0bfccd
manage_dirs_pattern(mysqld_t, mysqld_db_t, mysqld_db_t)
Chris PeBenito 0bfccd
manage_files_pattern(mysqld_t, mysqld_db_t, mysqld_db_t)
Chris PeBenito 0bfccd
manage_lnk_files_pattern(mysqld_t, mysqld_db_t, mysqld_db_t)
Chris PeBenito e21bd2
files_var_lib_filetrans(mysqld_t, mysqld_db_t, { dir file lnk_file })
Chris PeBenito 17de1b
Chris PeBenito 0b36a2
allow mysqld_t mysqld_etc_t:file read_file_perms;
Chris PeBenito 17de1b
allow mysqld_t mysqld_etc_t:lnk_file { getattr read };
Chris PeBenito 17de1b
allow mysqld_t mysqld_etc_t:dir list_dir_perms;
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow mysqld_t mysqld_log_t:file manage_file_perms;
Chris PeBenito 0bfccd
logging_log_filetrans(mysqld_t, mysqld_log_t, file)
Chris PeBenito 17de1b
Chris PeBenito 0bfccd
manage_dirs_pattern(mysqld_t, mysqld_tmp_t, mysqld_tmp_t)
Chris PeBenito 0bfccd
manage_files_pattern(mysqld_t, mysqld_tmp_t, mysqld_tmp_t)
Chris PeBenito 17de1b
files_tmp_filetrans(mysqld_t, mysqld_tmp_t, { file dir })
Chris PeBenito 17de1b
Chris PeBenito 9e8c3a
manage_files_pattern(mysqld_t, mysqld_var_run_t, mysqld_var_run_t)
Chris PeBenito 9e8c3a
manage_sock_files_pattern(mysqld_t, mysqld_var_run_t, mysqld_var_run_t)
Chris PeBenito 80f058
files_pid_filetrans(mysqld_t, mysqld_var_run_t, { file sock_file })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_system_state(mysqld_t)
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(mysqld_t)
Chris PeBenito 17de1b
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(mysqld_t)
Chris PeBenito 190066
corenet_all_recvfrom_netlabel(mysqld_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(mysqld_t)
Chris PeBenito 668b30
corenet_udp_sendrecv_generic_if(mysqld_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(mysqld_t)
Chris PeBenito c12621
corenet_udp_sendrecv_generic_node(mysqld_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(mysqld_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_ports(mysqld_t)
Chris PeBenito c12621
corenet_tcp_bind_generic_node(mysqld_t)
Chris PeBenito 17de1b
corenet_tcp_bind_mysqld_port(mysqld_t)
Chris PeBenito 17de1b
corenet_tcp_connect_mysqld_port(mysqld_t)
Chris PeBenito 17de1b
corenet_sendrecv_mysqld_client_packets(mysqld_t)
Chris PeBenito 17de1b
corenet_sendrecv_mysqld_server_packets(mysqld_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_sysfs(mysqld_t)
Chris Richards 68cda5
dev_read_urand(mysqld_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_all_fs(mysqld_t)
Chris PeBenito 17de1b
fs_search_auto_mountpoints(mysqld_t)
Chris PeBenito 01e9e7
fs_rw_hugetlbfs_files(mysqld_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(mysqld_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_getattr_var_lib_dirs(mysqld_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(mysqld_t)
Chris PeBenito 17de1b
files_read_etc_files(mysqld_t)
Chris PeBenito 17de1b
files_read_usr_files(mysqld_t)
Chris PeBenito 17de1b
files_search_var_lib(mysqld_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
auth_use_nsswitch(mysqld_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(mysqld_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(mysqld_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
sysnet_read_config(mysqld_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_dontaudit_use_unpriv_user_fds(mysqld_t)
Chris PeBenito 17de1b
# for /root/.my.cnf - should not be needed:
Chris PeBenito 296273
userdom_read_user_home_content_files(mysqld_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`distro_redhat',`
Chris PeBenito 17de1b
	# because Fedora has the sock_file in the database directory
Chris PeBenito 17de1b
	type_transition mysqld_t mysqld_db_t:sock_file mysqld_var_run_t;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Jeremy Solt 12a6a5
tunable_policy(`mysql_connect_any',`
Jeremy Solt 12a6a5
	corenet_tcp_connect_all_ports(mysqld_t)
Jeremy Solt 12a6a5
	corenet_sendrecv_all_client_packets(mysqld_t)
Jeremy Solt 12a6a5
')
Jeremy Solt 12a6a5
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	daemontools_service_domain(mysqld_t, mysqld_exec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	seutil_sigchld_newrole(mysqld_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	udev_read_db(mysqld_t)
Chris PeBenito 17de1b
')
Chris PeBenito 339235
Chris PeBenito 339235
#######################################
Chris PeBenito 339235
#
Chris PeBenito 339235
# Local mysqld_safe policy
Chris PeBenito 339235
#
Chris PeBenito 339235
Jeremy Solt 12a6a5
allow mysqld_safe_t self:capability { chown dac_override fowner kill };
Jeremy Solt 12a6a5
dontaudit mysqld_safe_t self:capability sys_ptrace;
Chris PeBenito 339235
allow mysqld_safe_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 339235
Jeremy Solt 12a6a5
read_lnk_files_pattern(mysqld_safe_t, mysqld_db_t, mysqld_db_t)
Jeremy Solt 12a6a5
Chris PeBenito 339235
domtrans_pattern(mysqld_safe_t, mysqld_exec_t, mysqld_t)
Chris PeBenito c0f5fa
Chris PeBenito 339235
allow mysqld_safe_t mysqld_log_t:file manage_file_perms;
Chris PeBenito 80f058
Jeremy Solt 12a6a5
manage_files_pattern(mysqld_safe_t, mysqld_var_run_t, mysqld_var_run_t)
Jeremy Solt 12a6a5
delete_sock_files_pattern(mysqld_safe_t, mysqld_var_run_t, mysqld_var_run_t)
Chris PeBenito 80f058
Chris PeBenito 80f058
kernel_read_system_state(mysqld_safe_t)
Jeremy Solt 12a6a5
kernel_read_kernel_sysctls(mysqld_safe_t)
Jeremy Solt 12a6a5
Jeremy Solt 12a6a5
corecmd_exec_bin(mysqld_safe_t)
Chris PeBenito 339235
Chris PeBenito 339235
dev_list_sysfs(mysqld_safe_t)
Chris PeBenito c0f5fa
Chris PeBenito 9e506e
domain_read_all_domains_state(mysqld_safe_t)
Chris PeBenito 9e506e
Chris PeBenito 339235
files_read_etc_files(mysqld_safe_t)
Chris PeBenito 339235
files_read_usr_files(mysqld_safe_t)
Chris PeBenito 9e506e
files_dontaudit_getattr_all_dirs(mysqld_safe_t)
Chris PeBenito 9e506e
Chris PeBenito 9e506e
logging_log_filetrans(mysqld_safe_t, mysqld_log_t, file)
Chris PeBenito 339235
Chris PeBenito 339235
hostname_exec(mysqld_safe_t)
Chris PeBenito c0f5fa
Chris PeBenito 80f058
miscfiles_read_localization(mysqld_safe_t)
Chris PeBenito c0f5fa
Chris PeBenito 80f058
mysql_manage_db_files(mysqld_safe_t)
Chris PeBenito 339235
mysql_read_config(mysqld_safe_t)
Chris PeBenito 339235
mysql_search_pid_files(mysqld_safe_t)
Chris PeBenito 339235
mysql_write_log(mysqld_safe_t)
Chris Richards 68cda5
Chris Richards 68cda5
########################################
Chris Richards 68cda5
#
Chris Richards 68cda5
# MySQL Manager Policy
Chris Richards 68cda5
#
Chris PeBenito 102146
Chris Richards 68cda5
allow mysqlmanagerd_t self:capability { dac_override kill };
Chris Richards 68cda5
allow mysqlmanagerd_t self:process signal;
Chris Richards 68cda5
allow mysqlmanagerd_t self:fifo_file rw_fifo_file_perms;
Chris Richards 68cda5
allow mysqlmanagerd_t self:tcp_socket create_stream_socket_perms;
Chris Richards 68cda5
allow mysqlmanagerd_t self:unix_stream_socket create_stream_socket_perms;
Chris Richards 68cda5
Chris Richards 68cda5
mysql_read_config(initrc_t)
Chris Richards 68cda5
mysql_read_config(mysqlmanagerd_t)
Chris Richards 68cda5
mysql_read_pid_files(mysqlmanagerd_t)
Chris Richards 68cda5
mysql_search_db(mysqlmanagerd_t)
Chris Richards 68cda5
mysql_signal(mysqlmanagerd_t)
Chris Richards 68cda5
mysql_stream_connect(mysqlmanagerd_t)
Chris Richards 68cda5
Chris PeBenito 102146
domtrans_pattern(mysqlmanagerd_t, mysqld_exec_t, mysqld_t)
Chris PeBenito 102146
Chris PeBenito 102146
manage_files_pattern(mysqlmanagerd_t, mysqld_var_run_t, mysqlmanagerd_var_run_t)
Chris PeBenito 102146
manage_sock_files_pattern(mysqlmanagerd_t, mysqld_var_run_t, mysqlmanagerd_var_run_t)
Chris PeBenito 102146
filetrans_pattern(mysqlmanagerd_t, mysqld_var_run_t, mysqlmanagerd_var_run_t, { file sock_file })
Chris PeBenito 102146
Chris Richards 68cda5
kernel_read_system_state(mysqlmanagerd_t)
Chris PeBenito 102146
Chris Richards 68cda5
corecmd_exec_shell(mysqlmanagerd_t)
Chris PeBenito 102146
Chris Richards 68cda5
corenet_all_recvfrom_unlabeled(mysqlmanagerd_t)
Chris Richards 68cda5
corenet_all_recvfrom_netlabel(mysqlmanagerd_t)
Chris Richards 68cda5
corenet_tcp_sendrecv_generic_if(mysqlmanagerd_t)
Chris Richards 68cda5
corenet_tcp_sendrecv_generic_node(mysqlmanagerd_t)
Chris Richards 68cda5
corenet_tcp_sendrecv_all_ports(mysqlmanagerd_t)
Chris Richards 68cda5
corenet_tcp_bind_generic_node(mysqlmanagerd_t)
Chris Richards 68cda5
corenet_tcp_bind_mysqlmanagerd_port(mysqlmanagerd_t)
Chris Richards 68cda5
corenet_tcp_connect_mysqlmanagerd_port(mysqlmanagerd_t)
Dominick Grift 630663
corenet_sendrecv_mysqlmanagerd_server_packets(mysqlmanagerd_t)
Dominick Grift 630663
corenet_sendrecv_mysqlmanagerd_client_packets(mysqlmanagerd_t)
Chris PeBenito 102146
Chris Richards 68cda5
dev_read_urand(mysqlmanagerd_t)
Chris PeBenito 102146
Chris Richards 68cda5
files_read_etc_files(mysqlmanagerd_t)
Chris Richards 68cda5
files_read_usr_files(mysqlmanagerd_t)
Chris Richards 68cda5
Chris Richards 68cda5
miscfiles_read_localization(mysqlmanagerd_t)
Chris Richards 68cda5
Chris PeBenito 102146
userdom_getattr_user_home_dirs(mysqlmanagerd_t)