Chris PeBenito e181fe
Chris PeBenito 2b3c99
policy_module(selinuxutil,1.2.0)
Chris PeBenito 960373
Chris PeBenito 12ae75
gen_require(`
Chris PeBenito 12ae75
	bool secure_mode;
Chris PeBenito 12ae75
')
Chris PeBenito 12ae75
Chris PeBenito ee5772
########################################
Chris PeBenito b4cd15
#
Chris PeBenito ee5772
# Declarations
Chris PeBenito b4cd15
#
Chris PeBenito ee5772
Chris PeBenito ee5772
attribute can_write_binary_policy;
Chris PeBenito ee5772
attribute can_relabelto_binary_policy;
Chris PeBenito ee5772
Chris PeBenito 9fd4b8
#
Chris PeBenito 9fd4b8
# selinux_config_t is the type applied to
Chris PeBenito 9fd4b8
# /etc/selinux/config
Chris PeBenito 9fd4b8
#
Chris PeBenito 9fd4b8
# cjp: this is out of order due to rules
Chris PeBenito 9fd4b8
# in the domain_type interface
Chris PeBenito 9fd4b8
# (fix dup decl)
Chris PeBenito 9fd4b8
type selinux_config_t;
Chris PeBenito 9fd4b8
files_type(selinux_config_t)
Chris PeBenito 9fd4b8
Chris PeBenito ee5772
type checkpolicy_t, can_write_binary_policy;
Chris PeBenito c9428d
domain_type(checkpolicy_t)
Chris PeBenito ee5772
role system_r types checkpolicy_t;
Chris PeBenito ee5772
Chris PeBenito ee5772
type checkpolicy_exec_t;
Chris PeBenito c9428d
domain_entry_file(checkpolicy_t,checkpolicy_exec_t)
Chris PeBenito ee5772
Chris PeBenito ee5772
#
Chris PeBenito ee5772
# default_context_t is the type applied to
Chris PeBenito ee5772
# /etc/selinux/*/contexts/*
Chris PeBenito ee5772
#
Chris PeBenito ee5772
type default_context_t;
Chris PeBenito 8fd367
files_type(default_context_t) 
Chris PeBenito ee5772
Chris PeBenito ee5772
#
Chris PeBenito ee5772
# file_context_t is the type applied to
Chris PeBenito ee5772
# /etc/selinux/*/contexts/files
Chris PeBenito ee5772
#
Chris PeBenito ee5772
type file_context_t;
Chris PeBenito 8fd367
files_type(file_context_t)
Chris PeBenito ee5772
Chris PeBenito ee5772
type load_policy_t;
Chris PeBenito c9428d
domain_type(load_policy_t)
Chris PeBenito ee5772
role system_r types load_policy_t;
Chris PeBenito ee5772
Chris PeBenito ee5772
type load_policy_exec_t;
Chris PeBenito c9428d
domain_entry_file(load_policy_t,load_policy_exec_t)
Chris PeBenito ee5772
Chris PeBenito f0574f
type newrole_t;
Chris PeBenito 1815ba
domain_role_change_exemption(newrole_t)
Chris PeBenito 1815ba
domain_obj_id_change_exemption(newrole_t)
Chris PeBenito c9428d
domain_type(newrole_t)
Chris PeBenito 15722e
domain_interactive_fd(newrole_t)
Chris PeBenito ee5772
Chris PeBenito ee5772
type newrole_exec_t;
Chris PeBenito c9428d
domain_entry_file(newrole_t,newrole_exec_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# policy_config_t is the type of /etc/security/selinux/*
Chris PeBenito b4cd15
# the security server policy configuration.
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type policy_config_t;
Chris PeBenito 8fd367
files_type(policy_config_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
neverallow ~can_relabelto_binary_policy policy_config_t:file relabelto;
Chris PeBenito 15fefa
#neverallow ~can_write_binary_policy policy_config_t:file { write append };
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# policy_src_t is the type of the policy source
Chris PeBenito b4cd15
# files.
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type policy_src_t;
Chris PeBenito 8fd367
files_type(policy_src_t)
Chris PeBenito b4cd15
Chris PeBenito f0574f
type restorecon_t, can_relabelto_binary_policy;
Chris PeBenito a1f94a
type restorecon_exec_t;
Chris PeBenito 1815ba
domain_obj_id_change_exemption(restorecon_t)
Chris PeBenito c9428d
init_system_domain(restorecon_t,restorecon_exec_t)
Chris PeBenito ee5772
role system_r types restorecon_t;
Chris PeBenito ee5772
Chris PeBenito 8623d5
type run_init_t;
Chris PeBenito 8623d5
type run_init_exec_t;
Chris PeBenito fe9b05
domain_type(run_init_t)
Chris PeBenito c9428d
domain_entry_file(run_init_t,run_init_exec_t)
Chris PeBenito 1815ba
domain_system_change_exemption(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito 02bcb8
type semanage_t;
Chris PeBenito 02bcb8
domain_type(semanage_t)
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
type semanage_exec_t;
Chris PeBenito 02bcb8
domain_entry_file(semanage_t, semanage_exec_t)
Chris PeBenito 02bcb8
role system_r types semanage_t;
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
type semanage_store_t;
Chris PeBenito 02bcb8
files_type(semanage_store_t)
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
type semanage_read_lock_t;
Chris PeBenito 02bcb8
files_type(semanage_read_lock_t)
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
type semanage_trans_lock_t; 
Chris PeBenito 02bcb8
files_type(semanage_trans_lock_t)
Chris PeBenito 02bcb8
Chris PeBenito a1f94a
type setfiles_t, can_relabelto_binary_policy;
Chris PeBenito 1815ba
domain_obj_id_change_exemption(setfiles_t)
Chris PeBenito c9428d
domain_type(setfiles_t)
Chris PeBenito ee5772
role system_r types setfiles_t;
Chris PeBenito ee5772
Chris PeBenito ee5772
type setfiles_exec_t;
Chris PeBenito c9428d
domain_entry_file(setfiles_t,setfiles_exec_t)
Chris PeBenito ee5772
Chris PeBenito 2705f9
ifdef(`distro_redhat',`
Chris PeBenito 2705f9
	init_system_domain(setfiles_t,setfiles_exec_t)
Chris PeBenito 2705f9
')
Chris PeBenito 2705f9
Chris PeBenito ee5772
########################################
Chris PeBenito b4cd15
#
Chris PeBenito ee5772
# Checkpolicy local policy
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
Chris PeBenito ee5772
allow checkpolicy_t self:capability dac_override;
Chris PeBenito b4cd15
Chris PeBenito ee5772
# able to create and modify binary policy files
Chris PeBenito cc41a9
allow checkpolicy_t policy_config_t:dir rw_dir_perms;
Chris PeBenito cc41a9
allow checkpolicy_t policy_config_t:file create_file_perms;
Chris PeBenito ee5772
Chris PeBenito a1f94a
# allow test policies to be created in src directories
Chris PeBenito cc41a9
allow checkpolicy_t policy_src_t:dir rw_dir_perms;
Chris PeBenito a1f94a
type_transition checkpolicy_t policy_src_t:file policy_config_t;
Chris PeBenito a1f94a
Chris PeBenito ee5772
# only allow read of policy source files
Chris PeBenito cc41a9
allow checkpolicy_t policy_src_t:dir r_dir_perms;
Chris PeBenito cc41a9
allow checkpolicy_t policy_src_t:file r_file_perms;
Chris PeBenito cc41a9
allow checkpolicy_t policy_src_t:lnk_file r_file_perms;
Chris PeBenito ee5772
allow checkpolicy_t selinux_config_t:dir search;
Chris PeBenito ee5772
Chris PeBenito 0fd9dc
fs_getattr_xattr_fs(checkpolicy_t)
Chris PeBenito ee5772
Chris PeBenito 0fd9dc
term_use_console(checkpolicy_t)
Chris PeBenito ee5772
Chris PeBenito 15722e
domain_use_interactive_fds(checkpolicy_t)
Chris PeBenito 26c87e
Chris PeBenito 681c9a
files_list_usr(checkpolicy_t)
Chris PeBenito daa0e0
# directory search permissions for path to source and binary policy files
Chris PeBenito c9428d
files_search_etc(checkpolicy_t)
Chris PeBenito daa0e0
Chris PeBenito 1c1ac6
init_use_fds(checkpolicy_t)
Chris PeBenito 1815ba
init_use_script_ptys(checkpolicy_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
libs_use_ld_so(checkpolicy_t)
Chris PeBenito c9428d
libs_use_shared_libs(checkpolicy_t)
Chris PeBenito ee5772
Chris PeBenito 15722e
userdom_use_all_users_fds(checkpolicy_t)
Chris PeBenito 26c87e
Chris PeBenito 33acca
ifdef(`targeted_policy',`
Chris PeBenito 1815ba
	term_use_generic_ptys(checkpolicy_t)
Chris PeBenito 1815ba
	term_use_unallocated_ttys(checkpolicy_t)
Chris PeBenito 33acca
')
Chris PeBenito 33acca
Chris PeBenito ee5772
########################################
Chris PeBenito ee5772
#
Chris PeBenito ee5772
# Load_policy local policy
Chris PeBenito ee5772
#
Chris PeBenito ee5772
Chris PeBenito ee5772
allow load_policy_t self:capability dac_override;
Chris PeBenito ee5772
Chris PeBenito ee5772
# only allow read of policy config files
Chris PeBenito ee5772
allow load_policy_t policy_src_t:dir search;
Chris PeBenito cc41a9
allow load_policy_t policy_config_t:dir r_dir_perms;
Chris PeBenito 2705f9
allow load_policy_t policy_config_t:file r_file_perms;
Chris PeBenito 2705f9
allow load_policy_t policy_config_t:lnk_file r_file_perms;
Chris PeBenito ee5772
Chris PeBenito cc41a9
allow load_policy_t selinux_config_t:dir r_dir_perms;
Chris PeBenito cc41a9
allow load_policy_t selinux_config_t:file r_file_perms;
Chris PeBenito cc41a9
allow load_policy_t selinux_config_t:lnk_file r_file_perms;
Chris PeBenito ee5772
Chris PeBenito 0f27d9
domain_use_interactive_fds(load_policy_t)
Chris PeBenito 0f27d9
Chris PeBenito 0f27d9
# for mcs.conf
Chris PeBenito 0f27d9
files_read_etc_files(load_policy_t)
Chris PeBenito 0f27d9
files_read_etc_runtime_files(load_policy_t)
Chris PeBenito 0f27d9
Chris PeBenito d35c62
fs_getattr_xattr_fs(load_policy_t)
Chris PeBenito d35c62
Chris PeBenito 0f27d9
mls_file_read_up(load_policy_t)
Chris PeBenito 0f27d9
Chris PeBenito 5e0da6
selinux_get_fs_mount(load_policy_t)
Chris PeBenito 5e0da6
selinux_load_policy(load_policy_t)
Chris PeBenito 5e0da6
selinux_set_boolean(load_policy_t)
Chris PeBenito ee5772
Chris PeBenito 0fd9dc
term_use_console(load_policy_t)
Chris PeBenito 0fd9dc
term_list_ptys(load_policy_t)
Chris PeBenito ee5772
Chris PeBenito 15722e
init_use_script_fds(load_policy_t)
Chris PeBenito 1815ba
init_use_script_ptys(load_policy_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
libs_use_ld_so(load_policy_t)
Chris PeBenito c9428d
libs_use_shared_libs(load_policy_t)
Chris PeBenito ee5772
Chris PeBenito ee5772
miscfiles_read_localization(load_policy_t)
Chris PeBenito ee5772
Chris PeBenito 15722e
userdom_use_all_users_fds(load_policy_t)
Chris PeBenito 26c87e
Chris PeBenito bf080a
ifdef(`hide_broken_symptoms',`
Chris PeBenito bf080a
	# cjp: cover up stray file descriptors.
Chris PeBenito bf080a
	dontaudit load_policy_t selinux_config_t:file write;
Chris PeBenito bf080a
	optional_policy(`unconfined',`
Chris PeBenito 1815ba
		unconfined_dontaudit_read_pipes(load_policy_t)
Chris PeBenito bf080a
	')
Chris PeBenito bf080a
')
Chris PeBenito bf080a
Chris PeBenito bf080a
ifdef(`targeted_policy',`
Chris PeBenito 1815ba
	term_use_unallocated_ttys(load_policy_t)
Chris PeBenito 1815ba
	term_use_generic_ptys(load_policy_t)
Chris PeBenito 9ca7e7
')
Chris PeBenito 9ca7e7
Chris PeBenito ee5772
########################################
Chris PeBenito ee5772
#
Chris PeBenito ee5772
# Newrole local policy
Chris PeBenito ee5772
#
Chris PeBenito ee5772
Chris PeBenito cff75c
allow newrole_t self:capability { fowner setuid setgid dac_override };
Chris PeBenito 9d3bdc
allow newrole_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execheap execstack };
Chris PeBenito ee5772
allow newrole_t self:process setexec;
Chris PeBenito ee5772
allow newrole_t self:fd use;
Chris PeBenito cc41a9
allow newrole_t self:fifo_file rw_file_perms;
Chris PeBenito 725926
allow newrole_t self:sock_file r_file_perms;
Chris PeBenito cc41a9
allow newrole_t self:shm create_shm_perms;
Chris PeBenito cc41a9
allow newrole_t self:sem create_sem_perms;
Chris PeBenito cc41a9
allow newrole_t self:msgq create_msgq_perms;
Chris PeBenito ee5772
allow newrole_t self:msg { send receive };
Chris PeBenito d8636f
allow newrole_t self:unix_dgram_socket sendto;
Chris PeBenito 2e0a88
allow newrole_t self:unix_stream_socket { create_stream_socket_perms connectto };
Chris PeBenito bf080a
allow newrole_t self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
Chris PeBenito bf080a
Chris PeBenito ee5772
Chris PeBenito cc41a9
allow newrole_t { selinux_config_t default_context_t }:dir r_dir_perms;
Chris PeBenito cc41a9
allow newrole_t { selinux_config_t default_context_t }:file r_file_perms;
Chris PeBenito cc41a9
allow newrole_t { selinux_config_t default_context_t }:lnk_file r_file_perms;
Chris PeBenito ee5772
Chris PeBenito ee5772
kernel_read_system_state(newrole_t)
Chris PeBenito 445522
kernel_read_kernel_sysctls(newrole_t)
Chris PeBenito d35c62
Chris PeBenito d35c62
dev_read_urand(newrole_t)
Chris PeBenito d35c62
Chris PeBenito d35c62
fs_getattr_xattr_fs(newrole_t)
Chris PeBenito ab940a
fs_search_auto_mountpoints(newrole_t)
Chris PeBenito d35c62
Chris PeBenito f0574f
mls_file_read_up(newrole_t)
Chris PeBenito f0574f
mls_file_write_down(newrole_t)
Chris PeBenito f0574f
mls_file_upgrade(newrole_t)
Chris PeBenito f0574f
mls_file_downgrade(newrole_t)
Chris PeBenito f0574f
mls_process_set_level(newrole_t)
Chris PeBenito f0574f
Chris PeBenito 5e0da6
selinux_get_fs_mount(newrole_t)
Chris PeBenito 5e0da6
selinux_validate_context(newrole_t)
Chris PeBenito 5e0da6
selinux_compute_access_vector(newrole_t)
Chris PeBenito 5e0da6
selinux_compute_create_context(newrole_t)
Chris PeBenito 5e0da6
selinux_compute_relabel_context(newrole_t)
Chris PeBenito 5e0da6
selinux_compute_user_contexts(newrole_t)
Chris PeBenito ee5772
Chris PeBenito 0fd9dc
term_use_all_user_ttys(newrole_t)
Chris PeBenito 0fd9dc
term_use_all_user_ptys(newrole_t)
Chris PeBenito 21871a
term_relabel_all_user_ttys(newrole_t)
Chris PeBenito 21871a
term_relabel_all_user_ptys(newrole_t)
Chris PeBenito b0d224
term_dontaudit_use_unallocated_ttys(newrole_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
auth_domtrans_chk_passwd(newrole_t)
Chris PeBenito 1e5c2a
Chris PeBenito 725926
corecmd_list_bin(newrole_t)
Chris PeBenito 1815ba
corecmd_read_bin_symlinks(newrole_t)
Chris PeBenito 725926
Chris PeBenito 15722e
domain_use_interactive_fds(newrole_t)
Chris PeBenito ebdc3b
# for when the user types "exec newrole" at the command line:
Chris PeBenito 15722e
domain_sigchld_interactive_fds(newrole_t)
Chris PeBenito 1e5c2a
Chris PeBenito daa0e0
# Write to utmp.
Chris PeBenito 68228b
init_rw_utmp(newrole_t)
Chris PeBenito daa0e0
Chris PeBenito 8fd367
files_read_etc_files(newrole_t)
Chris PeBenito ebdc3b
files_read_var_files(newrole_t)
Chris PeBenito 9e04f5
files_read_var_symlinks(newrole_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
libs_use_ld_so(newrole_t)
Chris PeBenito c9428d
libs_use_shared_libs(newrole_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
logging_send_syslog_msg(newrole_t)
Chris PeBenito a1f94a
Chris PeBenito ee5772
miscfiles_read_localization(newrole_t)
Chris PeBenito ee5772
Chris PeBenito 103fe2
userdom_use_unpriv_users_fds(newrole_t)
Chris PeBenito ae9e27
# for some PAM modules and for cwd
Chris PeBenito 103fe2
userdom_dontaudit_search_all_users_home_content(newrole_t)
Chris PeBenito a1f94a
Chris PeBenito 73ef29
ifdef(`targeted_policy',`
Chris PeBenito 73ef29
	# newrole does not make any sense in
Chris PeBenito 73ef29
	# the targeted policy.  This is to
Chris PeBenito 73ef29
	# make sediff easier.
Chris PeBenito 73ef29
	if(!secure_mode) {
Chris PeBenito 73ef29
		unconfined_domtrans(newrole_t)
Chris PeBenito 73ef29
	}
Chris PeBenito 73ef29
',`
Chris PeBenito 73ef29
	# if secure mode is enabled, then newrole
Chris PeBenito 73ef29
	# can only transition to unprivileged users
Chris PeBenito 73ef29
	if(secure_mode) {
Chris PeBenito 73ef29
		userdom_spec_domtrans_unpriv_users(newrole_t)
Chris PeBenito 73ef29
	} else {
Chris PeBenito 73ef29
		userdom_spec_domtrans_all_users(newrole_t)
Chris PeBenito 73ef29
	}
Chris PeBenito 73ef29
')
Chris PeBenito 21871a
Chris PeBenito 132880
optional_policy(`nis',`
Chris PeBenito ab940a
	nis_use_ypbind(newrole_t)
Chris PeBenito ee5772
')
Chris PeBenito ee5772
Chris PeBenito 132880
optional_policy(`nscd',`
Chris PeBenito 1815ba
	nscd_socket_use(newrole_t)
Chris PeBenito 493d6c
')
Chris PeBenito 493d6c
Chris PeBenito ee5772
########################################
Chris PeBenito ee5772
#
Chris PeBenito ee5772
# Restorecon local policy
Chris PeBenito ee5772
#
Chris PeBenito ee5772
Chris PeBenito ee5772
allow restorecon_t self:capability { dac_override dac_read_search fowner };
Chris PeBenito 93727e
allow restorecon_t self:fifo_file rw_file_perms;
Chris PeBenito ee5772
Chris PeBenito cc41a9
allow restorecon_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:dir r_dir_perms;
Chris PeBenito cc41a9
allow restorecon_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:file r_file_perms;
Chris PeBenito cc41a9
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 ee5772
Chris PeBenito 1c1ac6
kernel_use_fds(restorecon_t)
Chris PeBenito 445522
kernel_rw_pipes(restorecon_t)
Chris PeBenito ee5772
kernel_read_system_state(restorecon_t)
Chris PeBenito c66a3a
kernel_relabelfrom_unlabeled_dirs(restorecon_t)
Chris PeBenito c66a3a
kernel_relabelfrom_unlabeled_files(restorecon_t)
Chris PeBenito c66a3a
kernel_relabelfrom_unlabeled_symlinks(restorecon_t)
Chris PeBenito c66a3a
kernel_relabelfrom_unlabeled_pipes(restorecon_t)
Chris PeBenito c66a3a
kernel_relabelfrom_unlabeled_sockets(restorecon_t)
Chris PeBenito d35c62
Chris PeBenito c66a3a
dev_relabel_all_dev_nodes(restorecon_t)
Chris PeBenito ae9e27
# cjp: why is this needed?
Chris PeBenito 207c47
dev_rw_generic_files(restorecon_t)
Chris PeBenito ae9e27
Chris PeBenito d35c62
fs_getattr_xattr_fs(restorecon_t)
Chris PeBenito d8636f
fs_search_auto_mountpoints(restorecon_t)
Chris PeBenito d35c62
Chris PeBenito 77f6e2
mls_file_read_up(restorecon_t)
Chris PeBenito 77f6e2
mls_file_write_down(restorecon_t)
Chris PeBenito 77f6e2
mls_file_upgrade(restorecon_t)
Chris PeBenito 77f6e2
mls_file_downgrade(restorecon_t)
Chris PeBenito 77f6e2
Chris PeBenito 5e0da6
selinux_get_fs_mount(restorecon_t)
Chris PeBenito 5e0da6
selinux_validate_context(restorecon_t)
Chris PeBenito 5e0da6
selinux_compute_access_vector(restorecon_t)
Chris PeBenito 5e0da6
selinux_compute_create_context(restorecon_t)
Chris PeBenito 5e0da6
selinux_compute_relabel_context(restorecon_t)
Chris PeBenito 5e0da6
selinux_compute_user_contexts(restorecon_t)
Chris PeBenito ee5772
Chris PeBenito 1815ba
term_use_unallocated_ttys(restorecon_t)
Chris PeBenito cf6a7d
term_use_all_user_ttys(restorecon_t)
Chris PeBenito cf6a7d
term_use_all_user_ptys(restorecon_t)
Chris PeBenito 1e5c2a
Chris PeBenito 1c1ac6
init_use_fds(restorecon_t)
Chris PeBenito 1815ba
init_use_script_ptys(restorecon_t)
Chris PeBenito ee5772
Chris PeBenito 15722e
domain_use_interactive_fds(restorecon_t)
Chris PeBenito b0d224
domain_dontaudit_search_all_domains_state(restorecon_t)
Chris PeBenito 1e5c2a
Chris PeBenito c9428d
files_read_etc_runtime_files(restorecon_t)
Chris PeBenito 8fd367
files_read_etc_files(restorecon_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
libs_use_ld_so(restorecon_t)
Chris PeBenito c9428d
libs_use_shared_libs(restorecon_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
logging_send_syslog_msg(restorecon_t)
Chris PeBenito ee5772
Chris PeBenito 15722e
userdom_use_all_users_fds(restorecon_t)
Chris PeBenito 26c87e
Chris PeBenito efd8ed
files_relabel_all_files(restorecon_t)
Chris PeBenito 9e04f5
files_list_all(restorecon_t)
Chris PeBenito a1f94a
# this is to satisfy the assertion:
Chris PeBenito c9428d
auth_relabelto_shadow(restorecon_t)
Chris PeBenito ee5772
Chris PeBenito 254bbc
ifdef(`distro_redhat', `
Chris PeBenito 4d851f
	fs_rw_tmpfs_chr_files(restorecon_t)
Chris PeBenito 4d851f
	fs_rw_tmpfs_blk_files(restorecon_t)
Chris PeBenito 4d851f
	fs_relabel_tmpfs_blk_file(restorecon_t)
Chris PeBenito 4d851f
	fs_relabel_tmpfs_chr_file(restorecon_t)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito ae9e27
ifdef(`hide_broken_symptoms',`
Chris PeBenito 1815ba
	udev_dontaudit_rw_dgram_sockets(restorecon_t)
Chris PeBenito ae9e27
')
Chris PeBenito ae9e27
Chris PeBenito 132880
optional_policy(`hotplug',`
Chris PeBenito 1c1ac6
	hotplug_use_fds(restorecon_t)
Chris PeBenito 21871a
')
Chris PeBenito 21871a
Chris PeBenito ee5772
ifdef(`TODO',`
Chris PeBenito ee5772
# for upgrading glibc and other shared objects - without this the upgrade
Chris PeBenito ee5772
# scripts will put things in a state such that restorecon can not be run!
Chris PeBenito ee5772
allow restorecon_t lib_t:file { read execute };
Chris PeBenito cf6a7d
ifdef(`dpkg.te', `
Chris PeBenito cf6a7d
domain_auto_trans(dpkg_t, restorecon_exec_t, restorecon_t)
Chris PeBenito cf6a7d
')
Chris PeBenito ee5772
') dnl endif TODO
Chris PeBenito ee5772
Chris PeBenito 725926
allow restorecon_t kernel_t:unix_dgram_socket { read write };
Chris PeBenito 725926
Chris PeBenito 8623d5
#################################
Chris PeBenito 8623d5
#
Chris PeBenito 8623d5
# Run_init local policy
Chris PeBenito 8623d5
#
Chris PeBenito 8623d5
Chris PeBenito 5e0da6
selinux_get_fs_mount(run_init_t)
Chris PeBenito 5e0da6
selinux_validate_context(run_init_t)
Chris PeBenito 5e0da6
selinux_compute_access_vector(run_init_t)
Chris PeBenito 5e0da6
selinux_compute_create_context(run_init_t)
Chris PeBenito 5e0da6
selinux_compute_relabel_context(run_init_t)
Chris PeBenito 5e0da6
selinux_compute_user_contexts(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito 2283dc
ifdef(`direct_sysadm_daemon',`',`
Chris PeBenito 2283dc
	ifdef(`distro_gentoo',`
Chris PeBenito 2283dc
		# Gentoo integrated run_init:
Chris PeBenito 2283dc
		init_script_file_entry_type(run_init_t)
Chris PeBenito 2283dc
	')
Chris PeBenito 2283dc
')
Chris PeBenito 2283dc
Chris PeBenito 254bbc
ifdef(`targeted_policy',`',`
Chris PeBenito 0c73cd
	allow run_init_t self:process setexec;
Chris PeBenito 0c73cd
	allow run_init_t self:capability setuid;
Chris PeBenito cc41a9
	allow run_init_t self:fifo_file rw_file_perms;
Chris PeBenito 51a89c
	allow run_init_t self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
Chris PeBenito 8623d5
Chris PeBenito 0c73cd
	# often the administrator runs such programs from a directory that is owned
Chris PeBenito 0c73cd
	# by a different user or has restrictive SE permissions, do not want to audit
Chris PeBenito 0c73cd
	# the failed access to the current directory
Chris PeBenito 0c73cd
	dontaudit run_init_t self:capability { dac_override dac_read_search };
Chris PeBenito 8623d5
Chris PeBenito 0fd9dc
	fs_getattr_xattr_fs(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito c9428d
	dev_dontaudit_list_all_dev_nodes(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito 0fd9dc
	term_dontaudit_list_ptys(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito 679626
	auth_domtrans_chk_passwd(run_init_t)
Chris PeBenito c9428d
	auth_dontaudit_read_shadow(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito c9428d
	corecmd_exec_bin(run_init_t)
Chris PeBenito c9428d
	corecmd_exec_shell(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito 15722e
	domain_use_interactive_fds(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito 8fd367
	files_read_etc_files(run_init_t)
Chris PeBenito c9428d
	files_dontaudit_search_all_dirs(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito c9428d
	init_domtrans_script(run_init_t)
Chris PeBenito 0c73cd
	# for utmp
Chris PeBenito 68228b
	init_rw_utmp(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito c9428d
	libs_use_ld_so(run_init_t)
Chris PeBenito c9428d
	libs_use_shared_libs(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito 5e0da6
	seutil_read_config(run_init_t)
Chris PeBenito 5e0da6
	seutil_read_default_contexts(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito 0c73cd
	miscfiles_read_localization(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito c9428d
	logging_send_syslog_msg(run_init_t)
Chris PeBenito 44d5d9
Chris PeBenito 44d5d9
	optional_policy(`daemontools',`
Chris PeBenito 44d5d9
		daemontools_domtrans_start(run_init_t)
Chris PeBenito 44d5d9
	')
Chris PeBenito 8623d5
') dnl end ifdef targeted policy
Chris PeBenito 8623d5
Chris PeBenito ee5772
########################################
Chris PeBenito ee5772
#
Chris PeBenito 02bcb8
# semodule local policy
Chris PeBenito 02bcb8
#
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
allow semanage_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
allow semanage_t policy_config_t:file { read write };
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
kernel_read_system_state(semanage_t)
Chris PeBenito 02bcb8
kernel_read_kernel_sysctls(semanage_t)
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
corecmd_exec_bin(semanage_t)
Chris PeBenito 02bcb8
corecmd_exec_sbin(semanage_t)
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
files_read_etc_files(semanage_t)
Chris PeBenito 02bcb8
files_read_usr_files(semanage_t)
Chris PeBenito 02bcb8
files_list_pids(semanage_t)
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
mls_file_write_down(semanage_t)
Chris PeBenito 02bcb8
mls_rangetrans_target(semanage_t)
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
selinux_get_enforce_mode(semanage_t)
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
term_use_all_terms(semanage_t)
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
libs_use_ld_so(semanage_t)
Chris PeBenito 02bcb8
libs_use_shared_libs(semanage_t)
Chris PeBenito 02bcb8
libs_use_lib_files(semanage_t)
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
seutil_search_default_contexts(semanage_t)
Chris PeBenito 02bcb8
seutil_rw_file_contexts(semanage_t)
Chris PeBenito 02bcb8
seutil_domtrans_setfiles(semanage_t)
Chris PeBenito 02bcb8
seutil_domtrans_loadpolicy(semanage_t)
Chris PeBenito 02bcb8
seutil_read_config(semanage_t)
Chris PeBenito 02bcb8
seutil_manage_bin_policy(semanage_t)
Chris PeBenito 02bcb8
seutil_use_newrole_fds(semanage_t)
Chris PeBenito 02bcb8
seutil_manage_module_store(semanage_t)
Chris PeBenito 02bcb8
seutil_get_semanage_trans_lock(semanage_t)
Chris PeBenito 02bcb8
seutil_get_semanage_read_lock(semanage_t)
Chris PeBenito 02bcb8
Chris PeBenito 02bcb8
########################################
Chris PeBenito 02bcb8
#
Chris PeBenito ee5772
# Setfiles local policy
Chris PeBenito ee5772
#
Chris PeBenito ee5772
Chris PeBenito ee5772
allow setfiles_t self:capability { dac_override dac_read_search fowner };
Chris PeBenito 93727e
allow setfiles_t self:fifo_file rw_file_perms;
Chris PeBenito ee5772
Chris PeBenito cc41a9
allow setfiles_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:dir r_dir_perms;
Chris PeBenito cc41a9
allow setfiles_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:file r_file_perms;
Chris PeBenito cc41a9
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 ee5772
Chris PeBenito ee5772
kernel_read_system_state(setfiles_t)
Chris PeBenito c66a3a
kernel_relabelfrom_unlabeled_dirs(setfiles_t)
Chris PeBenito c66a3a
kernel_relabelfrom_unlabeled_files(setfiles_t)
Chris PeBenito c66a3a
kernel_relabelfrom_unlabeled_symlinks(setfiles_t)
Chris PeBenito c66a3a
kernel_relabelfrom_unlabeled_pipes(setfiles_t)
Chris PeBenito c66a3a
kernel_relabelfrom_unlabeled_sockets(setfiles_t)
Chris PeBenito c66a3a
Chris PeBenito c66a3a
dev_relabel_all_dev_nodes(setfiles_t)
Chris PeBenito d35c62
Chris PeBenito d35c62
fs_getattr_xattr_fs(setfiles_t)
Chris PeBenito ae9e27
fs_list_all(setfiles_t)
Chris PeBenito d35c62
Chris PeBenito 77f6e2
mls_file_read_up(setfiles_t)
Chris PeBenito 77f6e2
mls_file_write_down(setfiles_t)
Chris PeBenito 77f6e2
mls_file_upgrade(setfiles_t)
Chris PeBenito 77f6e2
mls_file_downgrade(setfiles_t)
Chris PeBenito 77f6e2
Chris PeBenito 5e0da6
selinux_get_fs_mount(setfiles_t)
Chris PeBenito 5e0da6
selinux_validate_context(setfiles_t)
Chris PeBenito 5e0da6
selinux_compute_access_vector(setfiles_t)
Chris PeBenito 5e0da6
selinux_compute_create_context(setfiles_t)
Chris PeBenito 5e0da6
selinux_compute_relabel_context(setfiles_t)
Chris PeBenito 5e0da6
selinux_compute_user_contexts(setfiles_t)
Chris PeBenito ee5772
Chris PeBenito 0fd9dc
term_use_all_user_ttys(setfiles_t)
Chris PeBenito 0fd9dc
term_use_all_user_ptys(setfiles_t)
Chris PeBenito 1815ba
term_use_unallocated_ttys(setfiles_t)
Chris PeBenito ee5772
Chris PeBenito c66a3a
# this is to satisfy the assertion:
Chris PeBenito c66a3a
auth_relabelto_shadow(setfiles_t)
Chris PeBenito c66a3a
Chris PeBenito 1c1ac6
init_use_fds(setfiles_t)
Chris PeBenito 15722e
init_use_script_fds(setfiles_t)
Chris PeBenito 1815ba
init_use_script_ptys(setfiles_t)
Chris PeBenito ee5772
Chris PeBenito 15722e
domain_use_interactive_fds(setfiles_t)
Chris PeBenito 1e5c2a
Chris PeBenito c9428d
libs_use_ld_so(setfiles_t)
Chris PeBenito c9428d
libs_use_shared_libs(setfiles_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
files_read_etc_runtime_files(setfiles_t)
Chris PeBenito 8fd367
files_read_etc_files(setfiles_t)
Chris PeBenito c66a3a
files_list_all(setfiles_t)
Chris PeBenito c66a3a
files_relabel_all_files(setfiles_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
logging_send_syslog_msg(setfiles_t)
Chris PeBenito ee5772
Chris PeBenito ee5772
miscfiles_read_localization(setfiles_t)
Chris PeBenito ee5772
Chris PeBenito 02bcb8
seutil_get_semanage_read_lock(setfiles_t)
Chris PeBenito 02bcb8
Chris PeBenito 15722e
userdom_use_all_users_fds(setfiles_t)
Chris PeBenito daa0e0
# for config files in a home directory
Chris PeBenito 103fe2
userdom_read_all_users_home_content_files(setfiles_t)