Chris PeBenito 4483ee
Chris PeBenito 4483ee
policy_module(apm,1.0)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
########################################
Chris PeBenito 4483ee
#
Chris PeBenito 4483ee
# Declarations
Chris PeBenito 4483ee
#
Chris PeBenito 4483ee
type apmd_t;
Chris PeBenito 4483ee
type apmd_exec_t;
Chris PeBenito 4483ee
init_daemon_domain(apmd_t,apmd_exec_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
type apm_t;
Chris PeBenito 4483ee
domain_type(apm_t)
Chris PeBenito 4483ee
role system_r types apm_t;
Chris PeBenito 4483ee
Chris PeBenito 4483ee
type apm_exec_t;
Chris PeBenito 4483ee
domain_entry_file(apm_t,apm_exec_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
type apmd_log_t;
Chris PeBenito 4483ee
logging_log_file(apmd_log_t)
Chris PeBenito 4483ee
Chris PeBenito 77f6e2
type apmd_tmp_t;
Chris PeBenito 77f6e2
files_tmp_file(apmd_tmp_t)
Chris PeBenito 77f6e2
Chris PeBenito 4483ee
type apmd_var_run_t;
Chris PeBenito 4483ee
files_pid_file(apmd_var_run_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
ifdef(`distro_redhat',`
Chris PeBenito 4483ee
	type apmd_lock_t;
Chris PeBenito 4483ee
	files_lock_file(apmd_lock_t)
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
Chris PeBenito 4483ee
ifdef(`distro_suse',`
Chris PeBenito 4483ee
	type apmd_var_lib_t;
Chris PeBenito 4483ee
	files_type(apmd_var_lib_t)
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
Chris PeBenito 4483ee
########################################
Chris PeBenito 4483ee
#
Chris PeBenito 4483ee
# apm client Local policy
Chris PeBenito 4483ee
#
Chris PeBenito 4483ee
Chris PeBenito 4483ee
allow apm_t self:capability { dac_override sys_admin };
Chris PeBenito 4483ee
Chris PeBenito 4483ee
kernel_read_system_state(apm_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
dev_rw_apm_bios(apm_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
fs_getattr_xattr_fs(apm_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
term_use_all_terms(apm_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
domain_use_wide_inherit_fd(apm_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
libs_use_ld_so(apm_t)
Chris PeBenito 4483ee
libs_use_shared_libs(apm_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
logging_send_syslog_msg(apm_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
########################################
Chris PeBenito 4483ee
#
Chris PeBenito 4483ee
# apm daemon Local policy
Chris PeBenito 4483ee
#
Chris PeBenito 4483ee
Chris PeBenito 4483ee
# mknod: controlling an orderly resume of PCMCIA requires creating device
Chris PeBenito 4483ee
# nodes 254,{0,1,2} for some reason.
Chris PeBenito 4483ee
allow apmd_t self:capability { sys_admin sys_nice sys_time kill mknod };
Chris PeBenito 4483ee
dontaudit apmd_t self:capability { setuid dac_override dac_read_search sys_tty_config };
Chris PeBenito 4483ee
allow apmd_t self:process { signal_perms getsession };
Chris PeBenito 4483ee
allow apmd_t self:fifo_file rw_file_perms;
Chris PeBenito 4483ee
allow apmd_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 4483ee
allow apmd_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 4483ee
Chris PeBenito 4483ee
allow apmd_t apmd_log_t:file create_file_perms;
Chris PeBenito 4483ee
logging_create_log(apmd_t,apmd_log_t)
Chris PeBenito 4483ee
Chris PeBenito 77f6e2
allow apmd_t apmd_tmp_t:dir create_dir_perms;
Chris PeBenito 77f6e2
allow apmd_t apmd_tmp_t:file create_file_perms;
Chris PeBenito 77f6e2
files_create_tmp_files(apmd_t, apmd_tmp_t, { file dir })
Chris PeBenito 77f6e2
Chris PeBenito 4483ee
allow apmd_t apmd_var_run_t:dir rw_dir_perms;
Chris PeBenito 4483ee
allow apmd_t apmd_var_run_t:file create_file_perms;
Chris PeBenito 4483ee
allow apmd_t apmd_var_run_t:sock_file create_file_perms;
Chris PeBenito 4483ee
files_create_pid(apmd_t, apmd_var_run_t, { file sock_file })
Chris PeBenito 4483ee
Chris PeBenito 4483ee
kernel_read_kernel_sysctl(apmd_t)
Chris PeBenito 4483ee
kernel_rw_all_sysctl(apmd_t)
Chris PeBenito 4483ee
kernel_read_system_state(apmd_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
dev_read_realtime_clock(apmd_t)
Chris PeBenito 4483ee
dev_read_urand(apmd_t)
Chris PeBenito 4483ee
dev_rw_apm_bios(apmd_t)
Chris PeBenito 4483ee
dev_rw_sysfs(apmd_t)
Chris PeBenito 4483ee
dev_dontaudit_getattr_all_chr_files(apmd_t) # Excessive?
Chris PeBenito 4483ee
dev_dontaudit_getattr_all_blk_files(apmd_t) # Excessive?
Chris PeBenito 4483ee
Chris PeBenito 4483ee
fs_dontaudit_list_tmpfs(apmd_t)
Chris PeBenito 4483ee
fs_getattr_all_fs(apmd_t)
Chris PeBenito 4483ee
fs_search_auto_mountpoints(apmd_t)
Chris PeBenito 4483ee
fs_dontaudit_getattr_all_files(apmd_t); # Excessive?
Chris PeBenito 4483ee
fs_dontaudit_getattr_all_symlinks(apmd_t); # Excessive?
Chris PeBenito 4483ee
fs_dontaudit_getattr_all_pipes(apmd_t); # Excessive?
Chris PeBenito 4483ee
fs_dontaudit_getattr_all_sockets(apmd_t); # Excessive?
Chris PeBenito 4483ee
Chris PeBenito 77f6e2
selinux_search_fs(apmd_t)
Chris PeBenito 77f6e2
Chris PeBenito 4483ee
term_dontaudit_use_console(apmd_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
corecmd_exec_bin(apmd_t)
Chris PeBenito 4483ee
corecmd_exec_sbin(apmd_t)
Chris PeBenito 4483ee
corecmd_exec_ls(apmd_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
domain_exec_all_entry_files(apmd_t)
Chris PeBenito 4483ee
domain_read_all_domains_state(apmd_t)
Chris PeBenito 4483ee
domain_use_wide_inherit_fd(apmd_t)
Chris PeBenito 4483ee
domain_dontaudit_getattr_all_sockets(apmd_t)
Chris PeBenito 4483ee
domain_dontaudit_getattr_all_key_sockets(apmd_t) # Excessive?
Chris PeBenito 4483ee
domain_dontaudit_list_all_domains_proc(apmd_t) # Excessive?
Chris PeBenito 4483ee
Chris PeBenito 4483ee
files_exec_etc_files(apmd_t)
Chris PeBenito 4483ee
files_read_etc_runtime_files(apmd_t)
Chris PeBenito 4483ee
files_dontaudit_getattr_all_files(apmd_t) # Excessive?
Chris PeBenito 4483ee
files_dontaudit_getattr_all_symlinks(apmd_t) # Excessive?
Chris PeBenito 4483ee
files_dontaudit_getattr_all_pipes(apmd_t) # Excessive?
Chris PeBenito 4483ee
files_dontaudit_getattr_all_sockets(apmd_t) # Excessive?
Chris PeBenito 4483ee
Chris PeBenito 4483ee
init_domtrans_script(apmd_t)
Chris PeBenito 4483ee
init_use_fd(apmd_t)
Chris PeBenito 4483ee
init_use_script_pty(apmd_t)
Chris PeBenito 4483ee
init_rw_script_pid(apmd_t)
Chris PeBenito 4483ee
init_write_initctl(apmd_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
libs_exec_ld_so(apmd_t)
Chris PeBenito 4483ee
libs_use_ld_so(apmd_t)
Chris PeBenito 4483ee
libs_exec_lib_files(apmd_t)
Chris PeBenito 4483ee
libs_use_shared_libs(apmd_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
logging_send_syslog_msg(apmd_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
miscfiles_read_localization(apmd_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
modutils_domtrans_insmod(apmd_t)
Chris PeBenito 4483ee
modutils_read_module_conf(apmd_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
seutil_dontaudit_search_config(apmd_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
userdom_dontaudit_use_unpriv_user_fd(apmd_t)
Chris PeBenito 4483ee
userdom_dontaudit_search_sysadm_home_dir(apmd_t)
Chris PeBenito 4483ee
userdom_dontaudit_search_all_users_home(apmd_t) # Excessive?
Chris PeBenito 4483ee
Chris PeBenito 4483ee
ifdef(`targeted_policy',`
Chris PeBenito 4483ee
	term_dontaudit_use_unallocated_tty(apmd_t)
Chris PeBenito 4483ee
	term_dontaudit_use_generic_pty(apmd_t)
Chris PeBenito 4483ee
	files_dontaudit_read_root_file(apmd_t)
Chris PeBenito 77f6e2
	unconfined_domain_template(apmd_t)
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
Chris PeBenito 4483ee
ifdef(`distro_redhat',`
Chris PeBenito 4483ee
	allow apmd_t apmd_lock_t:file create_file_perms;
Chris PeBenito 4483ee
	files_create_lock(apmd_t,apmd_lock_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
	can_exec(apmd_t, apmd_var_run_t)
Chris PeBenito 4483ee
Chris PeBenito 4483ee
	# ifconfig_exec_t needs to be run in its own domain for Red Hat
Chris PeBenito 4483ee
	optional_policy(`ifconfig.te',`
Chris PeBenito 4483ee
		sysnet_domtrans_ifconfig(apmd_t)
Chris PeBenito 4483ee
	')
Chris PeBenito 4483ee
Chris PeBenito 4483ee
	optional_policy(`iptables.te',`
Chris PeBenito 4483ee
		iptables_domtrans(apmd_t)
Chris PeBenito 4483ee
	')
Chris PeBenito 4483ee
Chris PeBenito 4483ee
	optional_policy(`netutils.te',`
Chris PeBenito 4483ee
		netutils_domtrans(apmd_t)
Chris PeBenito 4483ee
	')
Chris PeBenito 4483ee
Chris PeBenito 77f6e2
',`
Chris PeBenito 4483ee
Chris PeBenito 4483ee
	# for ifconfig which is run all the time
Chris PeBenito 77f6e2
	kernel_dontaudit_search_sysctl(apmd_t)
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
Chris PeBenito 4483ee
ifdef(`distro_suse',`
Chris PeBenito 4483ee
	allow apmd_t apmd_var_lib_t:file create_file_perms;
Chris PeBenito 4483ee
	allow apmd_t apmd_var_lib_t:dir create_dir_perms;
Chris PeBenito 4483ee
	files_create_var_lib(apmd_t,apmd_var_lib_t)
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
Chris PeBenito 4483ee
optional_policy(`clock.te',`
Chris PeBenito 4483ee
	clock_domtrans(apmd_t)
Chris PeBenito 4483ee
	clock_rw_adjtime(apmd_t)
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
Chris PeBenito 77f6e2
optional_policy(`logrotate.te',`
Chris PeBenito 77f6e2
	logrotate_use_fd(apmd_t)
Chris PeBenito 77f6e2
')
Chris PeBenito 77f6e2
Chris PeBenito 4483ee
optional_policy(`mta.te',`
Chris PeBenito 4483ee
	mta_send_mail(apmd_t)
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
Chris PeBenito 4483ee
optional_policy(`nscd.te',`
Chris PeBenito 4483ee
	nscd_use_socket(apmd_t)
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
Chris PeBenito 4483ee
optional_policy(`pcmcia.te',`
Chris PeBenito 4483ee
	pcmcia_domtrans_cardmgr(apmd_t)
Chris PeBenito 4483ee
	pcmcia_domtrans_cardctl(apmd_t)
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
Chris PeBenito 4483ee
optional_policy(`selinuxutil.te',`
Chris PeBenito 4483ee
	seutil_sigchld_newrole(apmd_t)
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
Chris PeBenito 4483ee
optional_policy(`udev.te',`
Chris PeBenito 4483ee
	udev_read_db(apmd_t)
Chris PeBenito 4483ee
	udev_read_state(apmd_t) #necessary?
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
Chris PeBenito 4483ee
ifdef(`TODO',`
Chris PeBenito 4483ee
allow apmd_t proc_t:file write;
Chris PeBenito 4483ee
allow apmd_t user_tty_type:chr_file { ioctl read getattr lock write append };
Chris PeBenito 4483ee
optional_policy(`cron.te',`
Chris PeBenito 4483ee
	domain_auto_trans(apmd_t, anacron_exec_t, system_crond_t)
Chris PeBenito 4483ee
	allow apmd_t crond_t:fifo_file { getattr read write ioctl };
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
Chris PeBenito 77f6e2
r_dir_file(apmd_t, hwdata_t)
Chris PeBenito 77f6e2
Chris PeBenito 4483ee
optional_policy(`rhgb.te',`
Chris PeBenito 4483ee
	rhgb_domain(apmd_t)
Chris PeBenito 4483ee
')
Chris PeBenito 4483ee
')