policy_module(resmgr, 1.3.0)

########################################
#
# Declarations
#

type resmgrd_t;
type resmgrd_exec_t;
init_daemon_domain(resmgrd_t, resmgrd_exec_t)

type resmgrd_initrc_exec_t;
init_script_file(resmgrd_initrc_exec_t)

type resmgrd_etc_t;
files_config_file(resmgrd_etc_t)

type resmgrd_var_run_t;
files_pid_file(resmgrd_var_run_t)

########################################
#
# Local policy
#

allow resmgrd_t self:capability { dac_read_search  sys_admin sys_rawio };
dontaudit resmgrd_t self:capability sys_tty_config;
allow resmgrd_t self:process signal_perms;

allow resmgrd_t resmgrd_etc_t:file read_file_perms;

allow resmgrd_t resmgrd_var_run_t:file manage_file_perms;
allow resmgrd_t resmgrd_var_run_t:sock_file manage_sock_file_perms;
files_pid_filetrans(resmgrd_t, resmgrd_var_run_t, { file sock_file })

kernel_list_proc(resmgrd_t)
kernel_read_proc_symlinks(resmgrd_t)
kernel_read_kernel_sysctls(resmgrd_t)

dev_read_sysfs(resmgrd_t)
dev_getattr_scanner_dev(resmgrd_t)

domain_use_interactive_fds(resmgrd_t)


fs_search_auto_mountpoints(resmgrd_t)

storage_dontaudit_read_fixed_disk(resmgrd_t)
storage_read_scsi_generic(resmgrd_t)
storage_raw_read_removable_device(resmgrd_t)
storage_raw_write_removable_device(resmgrd_t)
storage_write_scsi_generic(resmgrd_t)

logging_send_syslog_msg(resmgrd_t)

userdom_dontaudit_use_unpriv_user_fds(resmgrd_t)

optional_policy(`
	seutil_sigchld_newrole(resmgrd_t)
')

optional_policy(`
	udev_read_db(resmgrd_t)
')
