Chris PeBenito 17de1b
Chris PeBenito da9bbc
policy_module(selinuxutil,1.2.9)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
gen_require(`
Chris PeBenito 17de1b
	bool secure_mode;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
attribute can_write_binary_policy;
Chris PeBenito 17de1b
attribute can_relabelto_binary_policy;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# selinux_config_t is the type applied to
Chris PeBenito 17de1b
# /etc/selinux/config
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# cjp: this is out of order due to rules
Chris PeBenito 17de1b
# in the domain_type interface
Chris PeBenito 17de1b
# (fix dup decl)
Chris PeBenito 17de1b
type selinux_config_t;
Chris PeBenito 17de1b
files_type(selinux_config_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type checkpolicy_t, can_write_binary_policy;
Chris PeBenito 17de1b
domain_type(checkpolicy_t)
Chris PeBenito 17de1b
role system_r types checkpolicy_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type checkpolicy_exec_t;
Chris PeBenito 17de1b
domain_entry_file(checkpolicy_t,checkpolicy_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# default_context_t is the type applied to
Chris PeBenito 17de1b
# /etc/selinux/*/contexts/*
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type default_context_t;
Chris PeBenito 17de1b
files_type(default_context_t) 
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# file_context_t is the type applied to
Chris PeBenito 17de1b
# /etc/selinux/*/contexts/files
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type file_context_t;
Chris PeBenito 17de1b
files_type(file_context_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type load_policy_t;
Chris PeBenito 17de1b
domain_type(load_policy_t)
Chris PeBenito 17de1b
role system_r types load_policy_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type load_policy_exec_t;
Chris PeBenito 17de1b
domain_entry_file(load_policy_t,load_policy_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type newrole_t;
Chris PeBenito 17de1b
domain_role_change_exemption(newrole_t)
Chris PeBenito 17de1b
domain_obj_id_change_exemption(newrole_t)
Chris PeBenito 17de1b
domain_type(newrole_t)
Chris PeBenito 17de1b
domain_interactive_fd(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type newrole_exec_t;
Chris PeBenito 17de1b
domain_entry_file(newrole_t,newrole_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# policy_config_t is the type of /etc/security/selinux/*
Chris PeBenito 17de1b
# the security server policy configuration.
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type policy_config_t;
Chris PeBenito 17de1b
files_type(policy_config_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
neverallow ~can_relabelto_binary_policy policy_config_t:file relabelto;
Chris PeBenito 17de1b
#neverallow ~can_write_binary_policy policy_config_t:file { write append };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# policy_src_t is the type of the policy source
Chris PeBenito 17de1b
# files.
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type policy_src_t;
Chris PeBenito 17de1b
files_type(policy_src_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type restorecon_t, can_relabelto_binary_policy;
Chris PeBenito 17de1b
type restorecon_exec_t;
Chris PeBenito 17de1b
domain_obj_id_change_exemption(restorecon_t)
Chris PeBenito 17de1b
init_system_domain(restorecon_t,restorecon_exec_t)
Chris PeBenito 17de1b
role system_r types restorecon_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type restorecond_t;
Chris PeBenito 17de1b
type restorecond_exec_t;
Chris PeBenito 17de1b
init_daemon_domain(restorecond_t,restorecond_exec_t)
Chris PeBenito 17de1b
domain_obj_id_change_exemption(restorecond_t)
Chris PeBenito 17de1b
role system_r types restorecond_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type restorecond_var_run_t;
Chris PeBenito 17de1b
files_pid_file(restorecond_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# real declaration moved to mls until
Chris PeBenito 17de1b
# range transitions work in modules
Chris PeBenito 17de1b
gen_require(`
Chris PeBenito 17de1b
	type run_init_t;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
type run_init_exec_t;
Chris PeBenito 17de1b
domain_type(run_init_t)
Chris PeBenito 17de1b
domain_entry_file(run_init_t,run_init_exec_t)
Chris PeBenito 17de1b
domain_system_change_exemption(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type semanage_t;
Chris PeBenito 17de1b
domain_type(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type semanage_exec_t;
Chris PeBenito 17de1b
domain_entry_file(semanage_t, semanage_exec_t)
Chris PeBenito 17de1b
role system_r types semanage_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type semanage_store_t;
Chris PeBenito 17de1b
files_type(semanage_store_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type semanage_read_lock_t;
Chris PeBenito 17de1b
files_type(semanage_read_lock_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type semanage_tmp_t; 
Chris PeBenito 17de1b
files_tmp_file(semanage_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type semanage_trans_lock_t; 
Chris PeBenito 17de1b
files_type(semanage_trans_lock_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type setfiles_t, can_relabelto_binary_policy;
Chris PeBenito 17de1b
domain_obj_id_change_exemption(setfiles_t)
Chris PeBenito 17de1b
domain_type(setfiles_t)
Chris PeBenito 17de1b
role system_r types setfiles_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type setfiles_exec_t;
Chris PeBenito 17de1b
domain_entry_file(setfiles_t,setfiles_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`distro_redhat',`
Chris PeBenito 17de1b
	init_system_domain(setfiles_t,setfiles_exec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Checkpolicy local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow checkpolicy_t self:capability dac_override;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# able to create and modify binary policy files
Chris PeBenito 17de1b
allow checkpolicy_t policy_config_t:dir rw_dir_perms;
Chris PeBenito 17de1b
allow checkpolicy_t policy_config_t:file create_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# allow test policies to be created in src directories
Chris PeBenito 17de1b
allow checkpolicy_t policy_src_t:dir rw_dir_perms;
Chris PeBenito 17de1b
type_transition checkpolicy_t policy_src_t:file policy_config_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# only allow read of policy source files
Chris PeBenito 17de1b
allow checkpolicy_t policy_src_t:dir r_dir_perms;
Chris PeBenito 17de1b
allow checkpolicy_t policy_src_t:file r_file_perms;
Chris PeBenito 17de1b
allow checkpolicy_t policy_src_t:lnk_file r_file_perms;
Chris PeBenito 17de1b
allow checkpolicy_t selinux_config_t:dir search;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_xattr_fs(checkpolicy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_use_console(checkpolicy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(checkpolicy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_list_usr(checkpolicy_t)
Chris PeBenito 17de1b
# directory search permissions for path to source and binary policy files
Chris PeBenito 17de1b
files_search_etc(checkpolicy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_fds(checkpolicy_t)
Chris PeBenito 17de1b
init_use_script_ptys(checkpolicy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(checkpolicy_t)
Chris PeBenito 17de1b
libs_use_shared_libs(checkpolicy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_use_all_users_fds(checkpolicy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy',`
Chris PeBenito 17de1b
	term_use_generic_ptys(checkpolicy_t)
Chris PeBenito 17de1b
	term_use_unallocated_ttys(checkpolicy_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Load_policy local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow load_policy_t self:capability dac_override;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# only allow read of policy config files
Chris PeBenito 17de1b
allow load_policy_t policy_src_t:dir search;
Chris PeBenito 17de1b
allow load_policy_t policy_config_t:dir r_dir_perms;
Chris PeBenito 17de1b
allow load_policy_t policy_config_t:file r_file_perms;
Chris PeBenito 17de1b
allow load_policy_t policy_config_t:lnk_file r_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow load_policy_t selinux_config_t:dir r_dir_perms;
Chris PeBenito 17de1b
allow load_policy_t selinux_config_t:file r_file_perms;
Chris PeBenito 17de1b
allow load_policy_t selinux_config_t:lnk_file r_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(load_policy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# for mcs.conf
Chris PeBenito 17de1b
files_read_etc_files(load_policy_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(load_policy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_xattr_fs(load_policy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
mls_file_read_up(load_policy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
selinux_get_fs_mount(load_policy_t)
Chris PeBenito 17de1b
selinux_load_policy(load_policy_t)
Chris PeBenito 17de1b
selinux_set_boolean(load_policy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_use_console(load_policy_t)
Chris PeBenito 17de1b
term_list_ptys(load_policy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_script_fds(load_policy_t)
Chris PeBenito 17de1b
init_use_script_ptys(load_policy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(load_policy_t)
Chris PeBenito 17de1b
libs_use_shared_libs(load_policy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(load_policy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_use_all_users_fds(load_policy_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`hide_broken_symptoms',`
Chris PeBenito 17de1b
	# cjp: cover up stray file descriptors.
Chris PeBenito 17de1b
	dontaudit load_policy_t selinux_config_t:file write;
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		unconfined_dontaudit_read_pipes(load_policy_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy',`
Chris PeBenito 17de1b
	term_use_unallocated_ttys(load_policy_t)
Chris PeBenito 17de1b
	term_use_generic_ptys(load_policy_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Newrole local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow newrole_t self:capability { fowner setuid setgid dac_override };
Chris PeBenito 17de1b
allow newrole_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execheap execstack };
Chris PeBenito 17de1b
allow newrole_t self:process setexec;
Chris PeBenito 17de1b
allow newrole_t self:fd use;
Chris PeBenito 17de1b
allow newrole_t self:fifo_file rw_file_perms;
Chris PeBenito 17de1b
allow newrole_t self:sock_file r_file_perms;
Chris PeBenito 17de1b
allow newrole_t self:shm create_shm_perms;
Chris PeBenito 17de1b
allow newrole_t self:sem create_sem_perms;
Chris PeBenito 17de1b
allow newrole_t self:msgq create_msgq_perms;
Chris PeBenito 17de1b
allow newrole_t self:msg { send receive };
Chris PeBenito 17de1b
allow newrole_t self:unix_dgram_socket sendto;
Chris PeBenito 17de1b
allow newrole_t self:unix_stream_socket { create_stream_socket_perms connectto };
Chris PeBenito 17de1b
allow newrole_t self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow newrole_t { selinux_config_t default_context_t }:dir r_dir_perms;
Chris PeBenito 17de1b
allow newrole_t { selinux_config_t default_context_t }:file r_file_perms;
Chris PeBenito 17de1b
allow newrole_t { selinux_config_t default_context_t }:lnk_file r_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_system_state(newrole_t)
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_urand(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_xattr_fs(newrole_t)
Chris PeBenito 17de1b
fs_search_auto_mountpoints(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
mls_file_read_up(newrole_t)
Chris PeBenito 17de1b
mls_file_write_down(newrole_t)
Chris PeBenito 17de1b
mls_file_upgrade(newrole_t)
Chris PeBenito 17de1b
mls_file_downgrade(newrole_t)
Chris PeBenito 17de1b
mls_process_set_level(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
selinux_get_fs_mount(newrole_t)
Chris PeBenito 17de1b
selinux_validate_context(newrole_t)
Chris PeBenito 17de1b
selinux_compute_access_vector(newrole_t)
Chris PeBenito 17de1b
selinux_compute_create_context(newrole_t)
Chris PeBenito 17de1b
selinux_compute_relabel_context(newrole_t)
Chris PeBenito 17de1b
selinux_compute_user_contexts(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_use_all_user_ttys(newrole_t)
Chris PeBenito 17de1b
term_use_all_user_ptys(newrole_t)
Chris PeBenito 17de1b
term_relabel_all_user_ttys(newrole_t)
Chris PeBenito 17de1b
term_relabel_all_user_ptys(newrole_t)
Chris PeBenito 17de1b
term_getattr_unallocated_ttys(newrole_t)
Chris PeBenito 17de1b
term_dontaudit_use_unallocated_ttys(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
auth_domtrans_chk_passwd(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_list_bin(newrole_t)
Chris PeBenito 17de1b
corecmd_read_bin_symlinks(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(newrole_t)
Chris PeBenito 17de1b
# for when the user types "exec newrole" at the command line:
Chris PeBenito 17de1b
domain_sigchld_interactive_fds(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# Write to utmp.
Chris PeBenito 17de1b
init_rw_utmp(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(newrole_t)
Chris PeBenito 17de1b
files_read_var_files(newrole_t)
Chris PeBenito 17de1b
files_read_var_symlinks(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(newrole_t)
Chris PeBenito 17de1b
libs_use_shared_libs(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_use_unpriv_users_fds(newrole_t)
Chris PeBenito 17de1b
# for some PAM modules and for cwd
Chris PeBenito 17de1b
userdom_dontaudit_search_all_users_home_content(newrole_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`strict_policy',`
Chris PeBenito 17de1b
	# if secure mode is enabled, then newrole
Chris PeBenito 17de1b
	# can only transition to unprivileged users
Chris PeBenito 17de1b
	if(secure_mode) {
Chris PeBenito 17de1b
		userdom_spec_domtrans_unpriv_users(newrole_t)
Chris PeBenito 17de1b
	} else {
Chris PeBenito 17de1b
		userdom_spec_domtrans_all_users(newrole_t)
Chris PeBenito 17de1b
	}
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nis_use_ypbind(newrole_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nscd_socket_use(newrole_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Restorecon local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow restorecon_t self:capability { dac_override dac_read_search fowner };
Chris PeBenito 17de1b
allow restorecon_t self:fifo_file rw_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow restorecon_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:dir r_dir_perms;
Chris PeBenito 17de1b
allow restorecon_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:file r_file_perms;
Chris PeBenito 17de1b
allow restorecon_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:lnk_file r_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_use_fds(restorecon_t)
Chris PeBenito 17de1b
kernel_rw_pipes(restorecon_t)
Chris PeBenito 17de1b
kernel_read_system_state(restorecon_t)
Chris PeBenito 17de1b
kernel_rw_unix_dgram_sockets(restorecon_t)
Chris PeBenito 17de1b
kernel_relabelfrom_unlabeled_dirs(restorecon_t)
Chris PeBenito 17de1b
kernel_relabelfrom_unlabeled_files(restorecon_t)
Chris PeBenito 17de1b
kernel_relabelfrom_unlabeled_symlinks(restorecon_t)
Chris PeBenito 17de1b
kernel_relabelfrom_unlabeled_pipes(restorecon_t)
Chris PeBenito 17de1b
kernel_relabelfrom_unlabeled_sockets(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_relabel_all_dev_nodes(restorecon_t)
Chris PeBenito 17de1b
# cjp: why is this needed?
Chris PeBenito 17de1b
dev_rw_generic_files(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_xattr_fs(restorecon_t)
Chris PeBenito 17de1b
fs_search_auto_mountpoints(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
mls_file_read_up(restorecon_t)
Chris PeBenito 17de1b
mls_file_write_down(restorecon_t)
Chris PeBenito 17de1b
mls_file_upgrade(restorecon_t)
Chris PeBenito 17de1b
mls_file_downgrade(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
selinux_get_fs_mount(restorecon_t)
Chris PeBenito 17de1b
selinux_validate_context(restorecon_t)
Chris PeBenito 17de1b
selinux_compute_access_vector(restorecon_t)
Chris PeBenito 17de1b
selinux_compute_create_context(restorecon_t)
Chris PeBenito 17de1b
selinux_compute_relabel_context(restorecon_t)
Chris PeBenito 17de1b
selinux_compute_user_contexts(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_use_unallocated_ttys(restorecon_t)
Chris PeBenito 17de1b
term_use_all_user_ttys(restorecon_t)
Chris PeBenito 17de1b
term_use_all_user_ptys(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_fds(restorecon_t)
Chris PeBenito 17de1b
init_use_script_ptys(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(restorecon_t)
Chris PeBenito 17de1b
domain_dontaudit_search_all_domains_state(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_runtime_files(restorecon_t)
Chris PeBenito 17de1b
files_read_etc_files(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(restorecon_t)
Chris PeBenito 17de1b
libs_use_shared_libs(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_use_all_users_fds(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_relabel_all_files(restorecon_t)
Chris PeBenito 17de1b
fs_relabelfrom_noxattr_fs(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_list_all(restorecon_t)
Chris PeBenito 17de1b
# this is to satisfy the assertion:
Chris PeBenito 17de1b
auth_relabelto_shadow(restorecon_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`distro_redhat', `
Chris PeBenito 17de1b
	fs_rw_tmpfs_chr_files(restorecon_t)
Chris PeBenito 17de1b
	fs_rw_tmpfs_blk_files(restorecon_t)
Chris PeBenito 17de1b
	fs_relabel_tmpfs_blk_file(restorecon_t)
Chris PeBenito 17de1b
	fs_relabel_tmpfs_chr_file(restorecon_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`hide_broken_symptoms',`
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		udev_dontaudit_rw_dgram_sockets(restorecon_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	hotplug_use_fds(restorecon_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Restorecond local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow restorecond_t self:capability { dac_override dac_read_search fowner };
Chris PeBenito 17de1b
allow restorecond_t self:fifo_file rw_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow restorecond_t restorecond_var_run_t:file create_file_perms;
Chris PeBenito 17de1b
files_pid_filetrans(restorecond_t,restorecond_var_run_t, file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
auth_relabel_all_files_except_shadow(restorecond_t )
Chris PeBenito 17de1b
auth_read_all_files_except_shadow(restorecond_t)
Chris PeBenito 17de1b
fs_relabelfrom_noxattr_fs(restorecond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_use_fds(restorecond_t)
Chris PeBenito 17de1b
kernel_rw_pipes(restorecond_t)
Chris PeBenito 17de1b
kernel_read_system_state(restorecond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_xattr_fs(restorecond_t)
Chris PeBenito 17de1b
fs_list_inotifyfs(restorecond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
selinux_get_fs_mount(restorecond_t)
Chris PeBenito 17de1b
selinux_validate_context(restorecond_t)
Chris PeBenito 17de1b
selinux_compute_access_vector(restorecond_t)
Chris PeBenito 17de1b
selinux_compute_create_context(restorecond_t)
Chris PeBenito 17de1b
selinux_compute_relabel_context(restorecond_t)
Chris PeBenito 17de1b
selinux_compute_user_contexts(restorecond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_dontaudit_use_generic_ptys(restorecond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_fds(restorecond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(restorecond_t)
Chris PeBenito 17de1b
libs_use_shared_libs(restorecond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(restorecond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(restorecond_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Run_init local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
selinux_get_fs_mount(run_init_t)
Chris PeBenito 17de1b
selinux_validate_context(run_init_t)
Chris PeBenito 17de1b
selinux_compute_access_vector(run_init_t)
Chris PeBenito 17de1b
selinux_compute_create_context(run_init_t)
Chris PeBenito 17de1b
selinux_compute_relabel_context(run_init_t)
Chris PeBenito 17de1b
selinux_compute_user_contexts(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
mls_rangetrans_source(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`direct_sysadm_daemon',`',`
Chris PeBenito 17de1b
	ifdef(`distro_gentoo',`
Chris PeBenito 17de1b
		# Gentoo integrated run_init:
Chris PeBenito 17de1b
		init_script_file_entry_type(run_init_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy',`',`
Chris PeBenito 17de1b
	allow run_init_t self:process setexec;
Chris PeBenito 17de1b
	allow run_init_t self:capability setuid;
Chris PeBenito 17de1b
	allow run_init_t self:fifo_file rw_file_perms;
Chris PeBenito 17de1b
	allow run_init_t self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# often the administrator runs such programs from a directory that is owned
Chris PeBenito 17de1b
	# by a different user or has restrictive SE permissions, do not want to audit
Chris PeBenito 17de1b
	# the failed access to the current directory
Chris PeBenito 17de1b
	dontaudit run_init_t self:capability { dac_override dac_read_search };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	fs_getattr_xattr_fs(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	dev_dontaudit_list_all_dev_nodes(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	term_dontaudit_list_ptys(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	auth_domtrans_chk_passwd(run_init_t)
Chris PeBenito 17de1b
	auth_dontaudit_read_shadow(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	corecmd_exec_bin(run_init_t)
Chris PeBenito 17de1b
	corecmd_exec_shell(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	domain_use_interactive_fds(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	files_read_etc_files(run_init_t)
Chris PeBenito 17de1b
	files_dontaudit_search_all_dirs(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	init_domtrans_script(run_init_t)
Chris PeBenito 17de1b
	# for utmp
Chris PeBenito 17de1b
	init_rw_utmp(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	libs_use_ld_so(run_init_t)
Chris PeBenito 17de1b
	libs_use_shared_libs(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	seutil_read_config(run_init_t)
Chris PeBenito 17de1b
	seutil_read_default_contexts(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	miscfiles_read_localization(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	logging_send_syslog_msg(run_init_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		daemontools_domtrans_start(run_init_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		nscd_socket_use(run_init_t)
Chris PeBenito 17de1b
	')	
Chris PeBenito 17de1b
Chris PeBenito 17de1b
') dnl end ifdef targeted policy
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# semodule local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito da9bbc
allow semanage_t self:capability { dac_override audit_write };
Chris PeBenito 17de1b
allow semanage_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow semanage_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow semanage_t self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow semanage_t policy_config_t:file { read write };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow semanage_t semanage_tmp_t:dir create_dir_perms;
Chris PeBenito 17de1b
allow semanage_t semanage_tmp_t:file create_file_perms;
Chris PeBenito 17de1b
files_tmp_filetrans(semanage_t, semanage_tmp_t, { file dir })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_system_state(semanage_t)
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_exec_bin(semanage_t)
Chris PeBenito 17de1b
corecmd_exec_sbin(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_urand(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(semanage_t)
Chris PeBenito 17de1b
files_read_usr_files(semanage_t)
Chris PeBenito 17de1b
files_list_pids(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
mls_file_write_down(semanage_t)
Chris PeBenito 17de1b
mls_rangetrans_target(semanage_t)
Chris PeBenito 17de1b
mls_file_read_up(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
selinux_get_enforce_mode(semanage_t)
Chris PeBenito 17de1b
# for setsebool:
Chris PeBenito 17de1b
selinux_set_boolean(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_use_all_terms(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(semanage_t)
Chris PeBenito 17de1b
libs_use_shared_libs(semanage_t)
Chris PeBenito 17de1b
libs_use_lib_files(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
seutil_search_default_contexts(semanage_t)
Chris PeBenito 17de1b
seutil_manage_file_contexts(semanage_t)
Chris PeBenito 17de1b
seutil_manage_selinux_config(semanage_t)
Chris PeBenito 17de1b
seutil_domtrans_setfiles(semanage_t)
Chris PeBenito 17de1b
seutil_domtrans_loadpolicy(semanage_t)
Chris PeBenito 17de1b
seutil_read_config(semanage_t)
Chris PeBenito 17de1b
seutil_manage_bin_policy(semanage_t)
Chris PeBenito 17de1b
seutil_use_newrole_fds(semanage_t)
Chris PeBenito 17de1b
seutil_manage_module_store(semanage_t)
Chris PeBenito 17de1b
seutil_get_semanage_trans_lock(semanage_t)
Chris PeBenito 17de1b
seutil_get_semanage_read_lock(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_search_sysadm_home_dirs(semanage_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy',`
Chris PeBenito 17de1b
# Handle pp files created in homedir and /tmp
Chris PeBenito 17de1b
	files_read_generic_tmp_files(semanage_t)
Chris PeBenito 17de1b
	userdom_read_generic_user_home_content_files(semanage_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nscd_socket_use(semanage_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Setfiles local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow setfiles_t self:capability { dac_override dac_read_search fowner };
Chris PeBenito 17de1b
allow setfiles_t self:fifo_file rw_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow setfiles_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:dir r_dir_perms;
Chris PeBenito 17de1b
allow setfiles_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:file r_file_perms;
Chris PeBenito 17de1b
allow setfiles_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:lnk_file r_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_system_state(setfiles_t)
Chris PeBenito 17de1b
kernel_relabelfrom_unlabeled_dirs(setfiles_t)
Chris PeBenito 17de1b
kernel_relabelfrom_unlabeled_files(setfiles_t)
Chris PeBenito 17de1b
kernel_relabelfrom_unlabeled_symlinks(setfiles_t)
Chris PeBenito 17de1b
kernel_relabelfrom_unlabeled_pipes(setfiles_t)
Chris PeBenito 17de1b
kernel_relabelfrom_unlabeled_sockets(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_relabel_all_dev_nodes(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_xattr_fs(setfiles_t)
Chris PeBenito 17de1b
fs_list_all(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
mls_file_read_up(setfiles_t)
Chris PeBenito 17de1b
mls_file_write_down(setfiles_t)
Chris PeBenito 17de1b
mls_file_upgrade(setfiles_t)
Chris PeBenito 17de1b
mls_file_downgrade(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
selinux_get_fs_mount(setfiles_t)
Chris PeBenito 17de1b
selinux_validate_context(setfiles_t)
Chris PeBenito 17de1b
selinux_compute_access_vector(setfiles_t)
Chris PeBenito 17de1b
selinux_compute_create_context(setfiles_t)
Chris PeBenito 17de1b
selinux_compute_relabel_context(setfiles_t)
Chris PeBenito 17de1b
selinux_compute_user_contexts(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_use_all_user_ttys(setfiles_t)
Chris PeBenito 17de1b
term_use_all_user_ptys(setfiles_t)
Chris PeBenito 17de1b
term_use_unallocated_ttys(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# this is to satisfy the assertion:
Chris PeBenito 17de1b
auth_relabelto_shadow(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_fds(setfiles_t)
Chris PeBenito 17de1b
init_use_script_fds(setfiles_t)
Chris PeBenito 17de1b
init_use_script_ptys(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(setfiles_t)
Chris PeBenito 17de1b
libs_use_shared_libs(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_runtime_files(setfiles_t)
Chris PeBenito 17de1b
files_read_etc_files(setfiles_t)
Chris PeBenito 17de1b
files_list_all(setfiles_t)
Chris PeBenito 17de1b
files_relabel_all_files(setfiles_t)
Chris PeBenito 17de1b
fs_relabelfrom_noxattr_fs(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(setfiles_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_use_all_users_fds(setfiles_t)
Chris PeBenito 17de1b
# for config files in a home directory
Chris PeBenito 17de1b
userdom_read_all_users_home_content_files(setfiles_t)