2005-10-10 18:11:46 +00:00
|
|
|
|
2006-01-17 17:50:10 +00:00
|
|
|
policy_module(apm,1.1.2)
|
2005-10-10 18:11:46 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
type apmd_t;
|
|
|
|
type apmd_exec_t;
|
|
|
|
init_daemon_domain(apmd_t,apmd_exec_t)
|
|
|
|
|
|
|
|
type apm_t;
|
|
|
|
domain_type(apm_t)
|
|
|
|
role system_r types apm_t;
|
|
|
|
|
|
|
|
type apm_exec_t;
|
|
|
|
domain_entry_file(apm_t,apm_exec_t)
|
|
|
|
|
|
|
|
type apmd_log_t;
|
|
|
|
logging_log_file(apmd_log_t)
|
|
|
|
|
2005-10-13 20:59:36 +00:00
|
|
|
type apmd_tmp_t;
|
|
|
|
files_tmp_file(apmd_tmp_t)
|
|
|
|
|
2005-10-10 18:11:46 +00:00
|
|
|
type apmd_var_run_t;
|
|
|
|
files_pid_file(apmd_var_run_t)
|
|
|
|
|
|
|
|
ifdef(`distro_redhat',`
|
|
|
|
type apmd_lock_t;
|
|
|
|
files_lock_file(apmd_lock_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
ifdef(`distro_suse',`
|
|
|
|
type apmd_var_lib_t;
|
|
|
|
files_type(apmd_var_lib_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# apm client Local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow apm_t self:capability { dac_override sys_admin };
|
|
|
|
|
|
|
|
kernel_read_system_state(apm_t)
|
|
|
|
|
|
|
|
dev_rw_apm_bios(apm_t)
|
|
|
|
|
|
|
|
fs_getattr_xattr_fs(apm_t)
|
|
|
|
|
|
|
|
term_use_all_terms(apm_t)
|
|
|
|
|
|
|
|
domain_use_wide_inherit_fd(apm_t)
|
|
|
|
|
|
|
|
libs_use_ld_so(apm_t)
|
|
|
|
libs_use_shared_libs(apm_t)
|
|
|
|
|
|
|
|
logging_send_syslog_msg(apm_t)
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# apm daemon Local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
# mknod: controlling an orderly resume of PCMCIA requires creating device
|
|
|
|
# nodes 254,{0,1,2} for some reason.
|
|
|
|
allow apmd_t self:capability { sys_admin sys_nice sys_time kill mknod };
|
|
|
|
dontaudit apmd_t self:capability { setuid dac_override dac_read_search sys_tty_config };
|
|
|
|
allow apmd_t self:process { signal_perms getsession };
|
|
|
|
allow apmd_t self:fifo_file rw_file_perms;
|
|
|
|
allow apmd_t self:unix_dgram_socket create_socket_perms;
|
|
|
|
allow apmd_t self:unix_stream_socket create_stream_socket_perms;
|
|
|
|
|
|
|
|
allow apmd_t apmd_log_t:file create_file_perms;
|
2006-01-13 21:06:49 +00:00
|
|
|
logging_filetrans_log(apmd_t,apmd_log_t)
|
2005-10-10 18:11:46 +00:00
|
|
|
|
2005-10-13 20:59:36 +00:00
|
|
|
allow apmd_t apmd_tmp_t:dir create_dir_perms;
|
|
|
|
allow apmd_t apmd_tmp_t:file create_file_perms;
|
2006-01-13 21:06:49 +00:00
|
|
|
files_filetrans_tmp(apmd_t, apmd_tmp_t, { file dir })
|
2005-10-13 20:59:36 +00:00
|
|
|
|
2005-10-10 18:11:46 +00:00
|
|
|
allow apmd_t apmd_var_run_t:dir rw_dir_perms;
|
|
|
|
allow apmd_t apmd_var_run_t:file create_file_perms;
|
|
|
|
allow apmd_t apmd_var_run_t:sock_file create_file_perms;
|
2006-01-13 21:06:49 +00:00
|
|
|
files_filetrans_pid(apmd_t, apmd_var_run_t, { file sock_file })
|
2005-10-10 18:11:46 +00:00
|
|
|
|
|
|
|
kernel_read_kernel_sysctl(apmd_t)
|
|
|
|
kernel_rw_all_sysctl(apmd_t)
|
|
|
|
kernel_read_system_state(apmd_t)
|
|
|
|
|
|
|
|
dev_read_realtime_clock(apmd_t)
|
|
|
|
dev_read_urand(apmd_t)
|
|
|
|
dev_rw_apm_bios(apmd_t)
|
|
|
|
dev_rw_sysfs(apmd_t)
|
|
|
|
dev_dontaudit_getattr_all_chr_files(apmd_t) # Excessive?
|
|
|
|
dev_dontaudit_getattr_all_blk_files(apmd_t) # Excessive?
|
|
|
|
|
|
|
|
fs_dontaudit_list_tmpfs(apmd_t)
|
|
|
|
fs_getattr_all_fs(apmd_t)
|
|
|
|
fs_search_auto_mountpoints(apmd_t)
|
|
|
|
fs_dontaudit_getattr_all_files(apmd_t); # Excessive?
|
|
|
|
fs_dontaudit_getattr_all_symlinks(apmd_t); # Excessive?
|
|
|
|
fs_dontaudit_getattr_all_pipes(apmd_t); # Excessive?
|
|
|
|
fs_dontaudit_getattr_all_sockets(apmd_t); # Excessive?
|
|
|
|
|
2005-10-13 20:59:36 +00:00
|
|
|
selinux_search_fs(apmd_t)
|
|
|
|
|
2005-10-10 18:11:46 +00:00
|
|
|
term_dontaudit_use_console(apmd_t)
|
|
|
|
|
|
|
|
corecmd_exec_bin(apmd_t)
|
|
|
|
corecmd_exec_sbin(apmd_t)
|
|
|
|
corecmd_exec_ls(apmd_t)
|
|
|
|
|
|
|
|
domain_exec_all_entry_files(apmd_t)
|
|
|
|
domain_read_all_domains_state(apmd_t)
|
|
|
|
domain_use_wide_inherit_fd(apmd_t)
|
|
|
|
domain_dontaudit_getattr_all_sockets(apmd_t)
|
|
|
|
domain_dontaudit_getattr_all_key_sockets(apmd_t) # Excessive?
|
|
|
|
domain_dontaudit_list_all_domains_proc(apmd_t) # Excessive?
|
|
|
|
|
|
|
|
files_exec_etc_files(apmd_t)
|
|
|
|
files_read_etc_runtime_files(apmd_t)
|
|
|
|
files_dontaudit_getattr_all_files(apmd_t) # Excessive?
|
|
|
|
files_dontaudit_getattr_all_symlinks(apmd_t) # Excessive?
|
|
|
|
files_dontaudit_getattr_all_pipes(apmd_t) # Excessive?
|
|
|
|
files_dontaudit_getattr_all_sockets(apmd_t) # Excessive?
|
|
|
|
|
|
|
|
init_domtrans_script(apmd_t)
|
|
|
|
init_use_fd(apmd_t)
|
|
|
|
init_use_script_pty(apmd_t)
|
|
|
|
init_rw_script_pid(apmd_t)
|
|
|
|
init_write_initctl(apmd_t)
|
|
|
|
|
|
|
|
libs_exec_ld_so(apmd_t)
|
|
|
|
libs_use_ld_so(apmd_t)
|
|
|
|
libs_exec_lib_files(apmd_t)
|
|
|
|
libs_use_shared_libs(apmd_t)
|
|
|
|
|
|
|
|
logging_send_syslog_msg(apmd_t)
|
|
|
|
|
|
|
|
miscfiles_read_localization(apmd_t)
|
2005-11-25 16:43:03 +00:00
|
|
|
miscfiles_read_hwdata(apmd_t)
|
2005-10-10 18:11:46 +00:00
|
|
|
|
|
|
|
modutils_domtrans_insmod(apmd_t)
|
|
|
|
modutils_read_module_conf(apmd_t)
|
|
|
|
|
2005-10-21 19:36:49 +00:00
|
|
|
seutil_dontaudit_read_config(apmd_t)
|
2005-10-10 18:11:46 +00:00
|
|
|
|
|
|
|
userdom_dontaudit_use_unpriv_user_fd(apmd_t)
|
|
|
|
userdom_dontaudit_search_sysadm_home_dir(apmd_t)
|
|
|
|
userdom_dontaudit_search_all_users_home(apmd_t) # Excessive?
|
|
|
|
|
|
|
|
ifdef(`distro_redhat',`
|
|
|
|
allow apmd_t apmd_lock_t:file create_file_perms;
|
2006-01-13 21:06:49 +00:00
|
|
|
files_filetrans_lock(apmd_t,apmd_lock_t)
|
2005-10-10 18:11:46 +00:00
|
|
|
|
|
|
|
can_exec(apmd_t, apmd_var_run_t)
|
|
|
|
|
|
|
|
# ifconfig_exec_t needs to be run in its own domain for Red Hat
|
2005-11-23 20:24:27 +00:00
|
|
|
optional_policy(`sysnetwork',`
|
2005-10-10 18:11:46 +00:00
|
|
|
sysnet_domtrans_ifconfig(apmd_t)
|
|
|
|
')
|
|
|
|
|
2005-11-23 20:24:27 +00:00
|
|
|
optional_policy(`iptables',`
|
2005-10-10 18:11:46 +00:00
|
|
|
iptables_domtrans(apmd_t)
|
|
|
|
')
|
|
|
|
|
2005-11-23 20:24:27 +00:00
|
|
|
optional_policy(`netutils',`
|
2005-10-10 18:11:46 +00:00
|
|
|
netutils_domtrans(apmd_t)
|
|
|
|
')
|
|
|
|
|
2005-10-13 20:59:36 +00:00
|
|
|
',`
|
2005-10-10 18:11:46 +00:00
|
|
|
# for ifconfig which is run all the time
|
2005-10-13 20:59:36 +00:00
|
|
|
kernel_dontaudit_search_sysctl(apmd_t)
|
2005-10-10 18:11:46 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
ifdef(`distro_suse',`
|
|
|
|
allow apmd_t apmd_var_lib_t:file create_file_perms;
|
|
|
|
allow apmd_t apmd_var_lib_t:dir create_dir_perms;
|
2006-01-13 21:06:49 +00:00
|
|
|
files_filetrans_var_lib(apmd_t,apmd_var_lib_t)
|
2005-10-10 18:11:46 +00:00
|
|
|
')
|
|
|
|
|
2005-10-21 21:35:25 +00:00
|
|
|
ifdef(`targeted_policy',`
|
|
|
|
term_dontaudit_use_unallocated_tty(apmd_t)
|
|
|
|
term_dontaudit_use_generic_pty(apmd_t)
|
|
|
|
files_dontaudit_read_root_file(apmd_t)
|
|
|
|
unconfined_domain_template(apmd_t)
|
|
|
|
')
|
|
|
|
|
2005-12-09 20:08:10 +00:00
|
|
|
optional_policy(`automount',`
|
|
|
|
automount_domtrans(apmd_t)
|
|
|
|
')
|
|
|
|
|
2005-11-23 20:24:27 +00:00
|
|
|
optional_policy(`clock',`
|
2005-10-10 18:11:46 +00:00
|
|
|
clock_domtrans(apmd_t)
|
|
|
|
clock_rw_adjtime(apmd_t)
|
|
|
|
')
|
|
|
|
|
2005-11-23 20:24:27 +00:00
|
|
|
optional_policy(`cron',`
|
2006-01-17 17:50:10 +00:00
|
|
|
cron_system_entry(apmd_t, apmd_exec_t)
|
2005-10-21 19:36:49 +00:00
|
|
|
cron_domtrans_anacron_system_job(apmd_t)
|
|
|
|
')
|
|
|
|
|
2005-11-25 16:43:03 +00:00
|
|
|
optional_policy(`dbus',`
|
|
|
|
dbus_stub(apmd_t)
|
|
|
|
|
|
|
|
optional_policy(`networkmanager',`
|
|
|
|
networkmanager_dbus_chat(apmd_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2005-11-23 20:24:27 +00:00
|
|
|
optional_policy(`logrotate',`
|
2005-10-13 20:59:36 +00:00
|
|
|
logrotate_use_fd(apmd_t)
|
|
|
|
')
|
|
|
|
|
2005-11-23 20:24:27 +00:00
|
|
|
optional_policy(`mta',`
|
2005-10-10 18:11:46 +00:00
|
|
|
mta_send_mail(apmd_t)
|
|
|
|
')
|
|
|
|
|
2005-11-23 20:24:27 +00:00
|
|
|
optional_policy(`nscd',`
|
2005-10-10 18:11:46 +00:00
|
|
|
nscd_use_socket(apmd_t)
|
|
|
|
')
|
|
|
|
|
2005-11-23 20:24:27 +00:00
|
|
|
optional_policy(`pcmcia',`
|
2005-10-10 18:11:46 +00:00
|
|
|
pcmcia_domtrans_cardmgr(apmd_t)
|
|
|
|
pcmcia_domtrans_cardctl(apmd_t)
|
|
|
|
')
|
|
|
|
|
2005-11-23 20:24:27 +00:00
|
|
|
optional_policy(`selinuxutil',`
|
2005-10-10 18:11:46 +00:00
|
|
|
seutil_sigchld_newrole(apmd_t)
|
|
|
|
')
|
|
|
|
|
2005-11-23 20:24:27 +00:00
|
|
|
optional_policy(`udev',`
|
2005-10-10 18:11:46 +00:00
|
|
|
udev_read_db(apmd_t)
|
|
|
|
udev_read_state(apmd_t) #necessary?
|
|
|
|
')
|
|
|
|
|
|
|
|
ifdef(`TODO',`
|
|
|
|
allow apmd_t proc_t:file write;
|
|
|
|
allow apmd_t user_tty_type:chr_file { ioctl read getattr lock write append };
|
2005-11-23 20:24:27 +00:00
|
|
|
optional_policy(`cron',`
|
2005-10-10 18:11:46 +00:00
|
|
|
allow apmd_t crond_t:fifo_file { getattr read write ioctl };
|
|
|
|
')
|
|
|
|
')
|