policy_module(sanlock, 1.1.0) ######################################## # # Declarations # ## ##

## Allow sanlock to manage nfs files ##

##
gen_tunable(sanlock_use_nfs, false) ## ##

## Allow sanlock to manage cifs files ##

##
gen_tunable(sanlock_use_samba, false) ## ##

## Allow sanlock to read/write fuse files ##

##
gen_tunable(sanlock_use_fusefs, false) ## ##

## Allow sanlock to read/write user home directories. ##

##
gen_tunable(sanlock_enable_home_dirs, false) type sanlock_t; type sanlock_exec_t; init_daemon_domain(sanlock_t, sanlock_exec_t) type sanlk_resetd_t; type sanlk_resetd_exec_t; init_daemon_domain(sanlk_resetd_t, sanlk_resetd_exec_t) type sanlock_conf_t; files_config_file(sanlock_conf_t) type sanlock_var_run_t; files_pid_file(sanlock_var_run_t) type sanlock_log_t; logging_log_file(sanlock_log_t) type sanlock_initrc_exec_t; init_script_file(sanlock_initrc_exec_t) type sanlock_unit_file_t; systemd_unit_file(sanlock_unit_file_t) type sanlk_resetd_unit_file_t; systemd_unit_file(sanlk_resetd_unit_file_t) ifdef(`enable_mcs',` init_ranged_daemon_domain(sanlock_t, sanlock_exec_t, s0 - mcs_systemhigh) ') ifdef(`enable_mls',` init_ranged_daemon_domain(sanlock_t, sanlock_exec_t, s0 - mls_systemhigh) ') ######################################## # # sanlock local policy # allow sanlock_t self:capability { chown dac_read_search ipc_lock kill setgid setuid sys_nice sys_resource }; allow sanlock_t self:process { setrlimit setsched signull signal sigkill }; allow sanlock_t self:fifo_file rw_fifo_file_perms; allow sanlock_t self:unix_stream_socket { connectto create_stream_socket_perms }; manage_files_pattern(sanlock_t, sanlock_conf_t, sanlock_conf_t) manage_dirs_pattern(sanlock_t, sanlock_conf_t, sanlock_conf_t) manage_files_pattern(sanlock_t, sanlock_log_t, sanlock_log_t) logging_log_filetrans(sanlock_t, sanlock_log_t, file) manage_dirs_pattern(sanlock_t, sanlock_var_run_t, sanlock_var_run_t) manage_files_pattern(sanlock_t, sanlock_var_run_t, sanlock_var_run_t) manage_sock_files_pattern(sanlock_t, sanlock_var_run_t, sanlock_var_run_t) files_pid_filetrans(sanlock_t, sanlock_var_run_t, { file dir sock_file }) kernel_read_system_state(sanlock_t) kernel_read_kernel_sysctls(sanlock_t) domain_use_interactive_fds(sanlock_t) files_read_mnt_symlinks(sanlock_t) fs_getattr_cgroup(sanlock_t) fs_getattr_xattr_fs(sanlock_t) fs_rw_cephfs_files(sanlock_t) storage_raw_rw_fixed_disk(sanlock_t) dev_read_rand(sanlock_t) dev_read_urand(sanlock_t) dev_rw_sysfs(sanlock_t) auth_use_nsswitch(sanlock_t) init_read_utmp(sanlock_t) init_dontaudit_write_utmp(sanlock_t) logging_send_syslog_msg(sanlock_t) tunable_policy(`sanlock_use_fusefs',` fs_manage_fusefs_dirs(sanlock_t) fs_manage_fusefs_files(sanlock_t) fs_read_fusefs_symlinks(sanlock_t) fs_getattr_fusefs(sanlock_t) ') tunable_policy(`sanlock_use_nfs',` fs_manage_nfs_dirs(sanlock_t) fs_manage_nfs_files(sanlock_t) fs_manage_nfs_named_sockets(sanlock_t) fs_read_nfs_symlinks(sanlock_t) ') tunable_policy(`sanlock_use_samba',` fs_manage_cifs_dirs(sanlock_t) fs_manage_cifs_files(sanlock_t) fs_manage_cifs_named_sockets(sanlock_t) fs_read_cifs_symlinks(sanlock_t) ') tunable_policy(`sanlock_enable_home_dirs',` userdom_manage_user_home_content_dirs(sanlock_t) userdom_manage_user_home_content_files(sanlock_t) userdom_manage_user_home_content_symlinks(sanlock_t) ') optional_policy(` lvm_domtrans(sanlock_t) lvm_sigkill(sanlock_t) lvm_signal(sanlock_t) ') optional_policy(` rhcs_domtrans_fenced(sanlock_t) ') optional_policy(` wdmd_stream_connect(sanlock_t) ') optional_policy(` virt_kill_svirt(sanlock_t) virt_kill(sanlock_t) virt_signal(sanlock_t) virt_manage_lib_files(sanlock_t) virt_signal_svirt(sanlock_t) virt_read_pid_files(sanlock_t) ') ######################################## # # sanlk_resetd local policy # allow sanlk_resetd_t self:capability { dac_read_search }; allow sanlk_resetd_t self:fifo_file rw_fifo_file_perms; allow sanlk_resetd_t sanlock_t:unix_stream_socket connectto; manage_dirs_pattern(sanlk_resetd_t, sanlock_var_run_t, sanlock_var_run_t) manage_files_pattern(sanlk_resetd_t, sanlock_var_run_t, sanlock_var_run_t) manage_sock_files_pattern(sanlk_resetd_t, sanlock_var_run_t, sanlock_var_run_t) files_pid_filetrans(sanlk_resetd_t, sanlock_var_run_t, dir) kernel_dgram_send(sanlk_resetd_t) domain_use_interactive_fds(sanlk_resetd_t) logging_send_syslog_msg(sanlk_resetd_t) optional_policy(` wdmd_stream_connect(sanlk_resetd_t) ')