148 lines
3.6 KiB
Plaintext
148 lines
3.6 KiB
Plaintext
|
|
policy_module(mysql,1.0)
|
|
|
|
########################################
|
|
#
|
|
# Declarations
|
|
#
|
|
|
|
type mysqld_t;
|
|
type mysqld_exec_t;
|
|
init_daemon_domain(mysqld_t,mysqld_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_type(mysqld_etc_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 };
|
|
dontaudit mysqld_t self:capability sys_tty_config;
|
|
allow mysqld_t self:process { setsched getsched };
|
|
allow mysqld_t self:fifo_file { read write };
|
|
allow mysqld_t self:netlink_route_socket r_netlink_socket_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;
|
|
|
|
allow mysqld_t mysqld_db_t:dir create_dir_perms;
|
|
allow mysqld_t mysqld_db_t:file create_file_perms;
|
|
allow mysqld_t mysqld_db_t:lnk_file create_lnk_perms;
|
|
|
|
allow mysqld_t mysqld_etc_t:file { getattr read };
|
|
|
|
allow mysqld_t mysqld_log_t:file create_file_perms;
|
|
logging_create_log(mysqld_t,mysqld_log_t)
|
|
|
|
allow mysqld_t mysqld_tmp_t:dir create_dir_perms;
|
|
allow mysqld_t mysqld_tmp_t:file create_file_perms;
|
|
files_create_tmp_files(mysqld_t, mysqld_tmp_t, { file dir })
|
|
|
|
allow mysqld_t mysqld_var_run_t:sock_file create_file_perms;
|
|
allow mysqld_t mysqld_var_run_t:file create_file_perms;
|
|
files_create_pid(mysqld_t,mysqld_var_run_t)
|
|
|
|
kernel_list_proc(mysqld_t)
|
|
kernel_read_kernel_sysctl(mysqld_t)
|
|
kernel_read_proc_symlinks(mysqld_t)
|
|
kernel_read_system_state(mysqld_t)
|
|
|
|
corenet_tcp_sendrecv_all_if(mysqld_t)
|
|
corenet_udp_sendrecv_all_if(mysqld_t)
|
|
corenet_raw_sendrecv_all_if(mysqld_t)
|
|
corenet_tcp_sendrecv_all_nodes(mysqld_t)
|
|
corenet_udp_sendrecv_all_nodes(mysqld_t)
|
|
corenet_raw_sendrecv_all_nodes(mysqld_t)
|
|
corenet_tcp_sendrecv_all_ports(mysqld_t)
|
|
corenet_udp_sendrecv_all_ports(mysqld_t)
|
|
corenet_tcp_bind_all_nodes(mysqld_t)
|
|
corenet_udp_bind_all_nodes(mysqld_t)
|
|
corenet_tcp_bind_mysqld_port(mysqld_t)
|
|
corenet_tcp_connect_mysqld_port(mysqld_t)
|
|
|
|
dev_read_sysfs(mysqld_t)
|
|
|
|
fs_getattr_all_fs(mysqld_t)
|
|
fs_search_auto_mountpoints(mysqld_t)
|
|
|
|
term_dontaudit_use_console(mysqld_t)
|
|
|
|
domain_use_wide_inherit_fd(mysqld_t)
|
|
|
|
files_getattr_var_lib_dir(mysqld_t)
|
|
files_read_etc_runtime_files(mysqld_t)
|
|
files_read_usr_files(mysqld_t)
|
|
|
|
init_use_fd(mysqld_t)
|
|
init_use_script_pty(mysqld_t)
|
|
|
|
libs_use_ld_so(mysqld_t)
|
|
libs_use_shared_libs(mysqld_t)
|
|
|
|
logging_send_syslog_msg(mysqld_t)
|
|
|
|
miscfiles_read_localization(mysqld_t)
|
|
|
|
sysnet_read_config(mysqld_t)
|
|
|
|
userdom_dontaudit_use_unpriv_user_fd(mysqld_t)
|
|
# for /root/.my.cnf - should not be needed:
|
|
userdom_read_sysadm_home_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;
|
|
')
|
|
|
|
ifdef(`targeted_policy',`
|
|
term_dontaudit_use_unallocated_tty(mysqld_t)
|
|
term_dontaudit_use_generic_pty(mysqld_t)
|
|
files_dontaudit_read_root_file(mysqld_t)
|
|
')
|
|
|
|
optional_policy(`mount.te',`
|
|
mount_send_nfs_client_request(mysqld_t)
|
|
')
|
|
|
|
optional_policy(`nis.te',`
|
|
nis_use_ypbind(mysqld_t)
|
|
')
|
|
|
|
optional_policy(`nscd.te',`
|
|
nscd_use_socket(mysqld_t)
|
|
')
|
|
|
|
optional_policy(`selinuxutil.te',`
|
|
seutil_sigchld_newrole(mysqld_t)
|
|
')
|
|
|
|
optional_policy(`udev.te', `
|
|
udev_read_db(mysqld_t)
|
|
')
|
|
|
|
ifdef(`TODO',`
|
|
optional_policy(`rhgb.te',`
|
|
rhgb_domain(mysqld_t)
|
|
')
|
|
optional_policy(`daemontools.te',`
|
|
domain_auto_trans( svc_run_t, mysqld_exec_t, mysqld_t)
|
|
mysqld_signal(svc_start_t)
|
|
|
|
svc_ipc_domain(mysqld_t)
|
|
')
|
|
') dnl end TODO
|