159 lines
4.3 KiB
Plaintext
159 lines
4.3 KiB
Plaintext
|
|
policy_module(mysql, 1.10.4)
|
|
|
|
########################################
|
|
#
|
|
# Declarations
|
|
#
|
|
|
|
type mysqld_t;
|
|
type mysqld_exec_t;
|
|
init_daemon_domain(mysqld_t, mysqld_exec_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_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)
|
|
|
|
########################################
|
|
#
|
|
# Local policy
|
|
#
|
|
|
|
allow mysqld_t self:capability { dac_override setgid setuid 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_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_etc_t:file read_file_perms;
|
|
allow mysqld_t mysqld_etc_t:lnk_file { getattr read };
|
|
allow mysqld_t mysqld_etc_t:dir list_dir_perms;
|
|
|
|
allow mysqld_t mysqld_log_t:file manage_file_perms;
|
|
logging_log_filetrans(mysqld_t, mysqld_log_t, 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 })
|
|
|
|
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,{ file sock_file })
|
|
|
|
kernel_read_system_state(mysqld_t)
|
|
kernel_read_kernel_sysctls(mysqld_t)
|
|
|
|
corenet_all_recvfrom_unlabeled(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_connect_mysqld_port(mysqld_t)
|
|
corenet_sendrecv_mysqld_client_packets(mysqld_t)
|
|
corenet_sendrecv_mysqld_server_packets(mysqld_t)
|
|
|
|
dev_read_sysfs(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)
|
|
|
|
files_getattr_var_lib_dirs(mysqld_t)
|
|
files_read_etc_runtime_files(mysqld_t)
|
|
files_read_etc_files(mysqld_t)
|
|
files_read_usr_files(mysqld_t)
|
|
files_search_var_lib(mysqld_t)
|
|
|
|
auth_use_nsswitch(mysqld_t)
|
|
|
|
logging_send_syslog_msg(mysqld_t)
|
|
|
|
miscfiles_read_localization(mysqld_t)
|
|
|
|
sysnet_read_config(mysqld_t)
|
|
|
|
userdom_dontaudit_use_unpriv_user_fds(mysqld_t)
|
|
# for /root/.my.cnf - should not be needed:
|
|
userdom_read_user_home_content_files(mysqld_t)
|
|
|
|
ifdef(`distro_redhat',`
|
|
# because Fedora has the sock_file in the database directory
|
|
type_transition mysqld_t mysqld_db_t:sock_file mysqld_var_run_t;
|
|
')
|
|
|
|
optional_policy(`
|
|
daemontools_service_domain(mysqld_t, mysqld_exec_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
seutil_sigchld_newrole(mysqld_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
udev_read_db(mysqld_t)
|
|
')
|
|
|
|
#######################################
|
|
#
|
|
# Local mysqld_safe policy
|
|
#
|
|
|
|
allow mysqld_safe_t self:capability { dac_override fowner chown };
|
|
allow mysqld_safe_t self:fifo_file rw_fifo_file_perms;
|
|
|
|
domtrans_pattern(mysqld_safe_t, mysqld_exec_t, mysqld_t)
|
|
|
|
allow mysqld_safe_t mysqld_log_t:file manage_file_perms;
|
|
logging_log_filetrans(mysqld_safe_t, mysqld_log_t, file)
|
|
|
|
kernel_read_system_state(mysqld_safe_t)
|
|
|
|
dev_list_sysfs(mysqld_safe_t)
|
|
|
|
files_read_etc_files(mysqld_safe_t)
|
|
files_read_usr_files(mysqld_safe_t)
|
|
|
|
corecmd_exec_bin(mysqld_safe_t)
|
|
|
|
hostname_exec(mysqld_safe_t)
|
|
|
|
miscfiles_read_localization(mysqld_safe_t)
|
|
|
|
mysql_append_db_files(mysqld_safe_t)
|
|
mysql_read_config(mysqld_safe_t)
|
|
mysql_search_pid_files(mysqld_safe_t)
|
|
mysql_write_log(mysqld_safe_t)
|