Chris PeBenito 42be7c
Chris PeBenito 42be7c
policy_module(mysql,1.0)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
########################################
Chris PeBenito 42be7c
#
Chris PeBenito 42be7c
# Declarations
Chris PeBenito 42be7c
#
Chris PeBenito 42be7c
Chris PeBenito 42be7c
type mysqld_t;
Chris PeBenito 42be7c
type mysqld_exec_t;
Chris PeBenito 42be7c
init_daemon_domain(mysqld_t,mysqld_exec_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
type mysqld_var_run_t;
Chris PeBenito 42be7c
files_pid_file(mysqld_var_run_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
type mysqld_db_t;
Chris PeBenito 603f90
files_type(mysqld_db_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
type mysqld_etc_t alias etc_mysqld_t;
Chris PeBenito 42be7c
files_type(mysqld_etc_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
type mysqld_log_t;
Chris PeBenito 42be7c
logging_log_file(mysqld_log_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
type mysqld_tmp_t;
Chris PeBenito 42be7c
files_tmp_file(mysqld_tmp_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
########################################
Chris PeBenito 42be7c
#
Chris PeBenito 42be7c
# Local policy
Chris PeBenito 42be7c
#
Chris PeBenito 42be7c
Chris PeBenito 42be7c
allow mysqld_t self:capability { dac_override setgid setuid };
Chris PeBenito 42be7c
dontaudit mysqld_t self:capability sys_tty_config;
Chris PeBenito 42be7c
allow mysqld_t self:process getsched;
Chris PeBenito 42be7c
allow mysqld_t self:fifo_file { read write };
Chris PeBenito 42be7c
allow mysqld_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 42be7c
allow mysqld_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 42be7c
allow mysqld_t self:tcp_socket connected_socket_perms;
Chris PeBenito 42be7c
Chris PeBenito 42be7c
allow mysqld_t mysqld_db_t:dir create_dir_perms;
Chris PeBenito 42be7c
allow mysqld_t mysqld_db_t:file create_file_perms;
Chris PeBenito 42be7c
allow mysqld_t mysqld_db_t:lnk_file create_lnk_perms;
Chris PeBenito 42be7c
Chris PeBenito 42be7c
allow mysqld_t mysqld_etc_t:file { getattr read };
Chris PeBenito 42be7c
Chris PeBenito 42be7c
allow mysqld_t mysqld_log_t:file create_file_perms;
Chris PeBenito 42be7c
logging_create_log(mysqld_t,mysqld_log_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
allow mysqld_t mysqld_tmp_t:dir create_dir_perms;
Chris PeBenito 42be7c
allow mysqld_t mysqld_tmp_t:file create_file_perms;
Chris PeBenito 42be7c
files_create_tmp_files(mysqld_t, mysqld_tmp_t, { file dir })
Chris PeBenito 42be7c
Chris PeBenito 42be7c
allow mysqld_t mysqld_var_run_t:sock_file create_file_perms;
Chris PeBenito 42be7c
allow mysqld_t mysqld_var_run_t:file create_file_perms;
Chris PeBenito 42be7c
files_create_pid(mysqld_t,mysqld_var_run_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
kernel_list_proc(mysqld_t)
Chris PeBenito 42be7c
kernel_read_kernel_sysctl(mysqld_t)
Chris PeBenito 42be7c
kernel_read_proc_symlinks(mysqld_t)
Chris PeBenito 42be7c
kernel_read_system_state(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
corenet_tcp_sendrecv_all_if(mysqld_t)
Chris PeBenito 42be7c
corenet_raw_sendrecv_all_if(mysqld_t)
Chris PeBenito 42be7c
corenet_tcp_sendrecv_all_nodes(mysqld_t)
Chris PeBenito 42be7c
corenet_raw_sendrecv_all_nodes(mysqld_t)
Chris PeBenito 42be7c
corenet_tcp_sendrecv_all_ports(mysqld_t)
Chris PeBenito 42be7c
corenet_tcp_bind_all_nodes(mysqld_t)
Chris PeBenito 42be7c
corenet_tcp_bind_mysqld_port(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
dev_read_sysfs(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
fs_getattr_all_fs(mysqld_t)
Chris PeBenito 42be7c
fs_search_auto_mountpoints(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
term_dontaudit_use_console(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
domain_use_wide_inherit_fd(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
files_getattr_var_lib_dir(mysqld_t)
Chris PeBenito 42be7c
files_read_etc_runtime_files(mysqld_t)
Chris PeBenito 42be7c
files_read_usr_files(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
init_use_fd(mysqld_t)
Chris PeBenito 42be7c
init_use_script_pty(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
libs_use_ld_so(mysqld_t)
Chris PeBenito 42be7c
libs_use_shared_libs(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
logging_send_syslog_msg(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
miscfiles_read_localization(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
sysnet_read_config(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
userdom_dontaudit_use_unpriv_user_fd(mysqld_t)
Chris PeBenito 42be7c
# for /root/.my.cnf - should not be needed:
Chris PeBenito 42be7c
userdom_read_sysadm_home_files(mysqld_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
ifdef(`distro_redhat',`
Chris PeBenito 42be7c
	# because Fedora has the sock_file in the database directory
Chris PeBenito 42be7c
	type_transition mysqld_t mysqld_db_t:sock_file mysqld_var_run_t;
Chris PeBenito 42be7c
')
Chris PeBenito 42be7c
Chris PeBenito 42be7c
ifdef(`targeted_policy',`
Chris PeBenito 42be7c
	term_dontaudit_use_unallocated_tty(mysqld_t)
Chris PeBenito 42be7c
	term_dontaudit_use_generic_pty(mysqld_t)
Chris PeBenito 42be7c
	files_dontaudit_read_root_file(mysqld_t)
Chris PeBenito 42be7c
')
Chris PeBenito 42be7c
Chris PeBenito 42be7c
optional_policy(`nis.te',`
Chris PeBenito 42be7c
	nis_use_ypbind(mysqld_t)
Chris PeBenito 42be7c
')
Chris PeBenito 42be7c
Chris PeBenito 42be7c
optional_policy(`selinuxutil.te',`
Chris PeBenito 42be7c
	seutil_sigchld_newrole(mysqld_t)
Chris PeBenito 42be7c
')
Chris PeBenito 42be7c
Chris PeBenito 42be7c
optional_policy(`udev.te', `
Chris PeBenito 42be7c
	udev_read_db(mysqld_t)
Chris PeBenito 42be7c
')
Chris PeBenito 42be7c
Chris PeBenito c0d156
ifdef(`TODO',`
Chris PeBenito c0d156
optional_policy(`rhgb.te',`
Chris PeBenito c0d156
	rhgb_domain(mysqld_t)
Chris PeBenito c0d156
')
Chris PeBenito 42be7c
optional_policy(`daemontools.te',`
Chris PeBenito 42be7c
	domain_auto_trans( svc_run_t, mysqld_exec_t, mysqld_t)
Chris PeBenito 42be7c
	mysqld_signal(svc_start_t)
Chris PeBenito 42be7c
Chris PeBenito 42be7c
	svc_ipc_domain(mysqld_t)
Chris PeBenito 42be7c
')
Chris PeBenito 42be7c
') dnl end TODO