Chris PeBenito ab58ad
#DESC Checkpolicy - SELinux policy compliler
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Authors:  Frank Mayer, mayerf@tresys.com
Chris PeBenito ab58ad
# X-Debian-Packages: checkpolicy
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
Chris PeBenito ab58ad
###########################
Chris PeBenito ab58ad
# 
Chris PeBenito ab58ad
# checkpolicy_t is the domain type for checkpolicy
Chris PeBenito ab58ad
# checkpolicy_exec_t if file type for the executable
Chris PeBenito ab58ad
Chris PeBenito ab58ad
type checkpolicy_t, domain;
Chris PeBenito ab58ad
role sysadm_r types checkpolicy_t;
Chris PeBenito ab58ad
role system_r types checkpolicy_t;
Chris PeBenito ab58ad
role secadm_r types checkpolicy_t;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
type checkpolicy_exec_t, file_type, exec_type, sysadmfile;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
##########################
Chris PeBenito ab58ad
# 
Chris PeBenito ab58ad
# Rules
Chris PeBenito ab58ad
Chris PeBenito ab58ad
domain_auto_trans(secadmin, checkpolicy_exec_t, checkpolicy_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# able to create and modify binary policy files
Chris PeBenito ab58ad
allow checkpolicy_t policy_config_t:dir rw_dir_perms;
Chris PeBenito ab58ad
allow checkpolicy_t policy_config_t:file create_file_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
###########################
Chris PeBenito ab58ad
# constrain what checkpolicy can use as source files
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# only allow read of policy source files
Chris PeBenito ab58ad
allow checkpolicy_t policy_src_t:dir r_dir_perms;
Chris PeBenito ab58ad
allow checkpolicy_t policy_src_t:{ file lnk_file } r_file_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# allow test policies to be created in src directories
Chris PeBenito ab58ad
file_type_auto_trans(checkpolicy_t, policy_src_t, policy_config_t, file)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# directory search permissions for path to source and binary policy files
Chris PeBenito ab58ad
allow checkpolicy_t root_t:dir search;
Chris PeBenito ab58ad
allow checkpolicy_t etc_t:dir search;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Read the devpts root directory.  
Chris PeBenito ab58ad
allow checkpolicy_t devpts_t:dir r_dir_perms;
Chris PeBenito ab58ad
ifdef(`sshd.te',
Chris PeBenito ab58ad
`allow checkpolicy_t sshd_devpts_t:dir r_dir_perms;')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Other access
Chris PeBenito ab58ad
allow checkpolicy_t { initrc_devpts_t admin_tty_type devtty_t }:chr_file { read write ioctl getattr };
Chris PeBenito ab58ad
uses_shlib(checkpolicy_t)
Chris PeBenito ab58ad
allow checkpolicy_t self:capability dac_override;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
##########################
Chris PeBenito ab58ad
# Allow users to execute checkpolicy without a domain transition
Chris PeBenito ab58ad
# so it can be used without privilege to write real binary policy file
Chris PeBenito ab58ad
can_exec(unpriv_userdomain, checkpolicy_exec_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow checkpolicy_t { userdomain privfd }:fd use;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow checkpolicy_t fs_t:filesystem getattr;
Chris PeBenito ab58ad
allow checkpolicy_t console_device_t:chr_file { read write };
Chris PeBenito ab58ad
allow checkpolicy_t init_t:fd use;
Chris PeBenito ab58ad
allow checkpolicy_t selinux_config_t:dir search;