Chris PeBenito e181fe
Chris PeBenito 51a89c
policy_module(selinuxutil,1.1.2)
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 8bd678
domain_role_change_exempt(newrole_t)
Chris PeBenito 8bd678
domain_obj_id_change_exempt(newrole_t)
Chris PeBenito c9428d
domain_type(newrole_t)
Chris PeBenito c9428d
domain_wide_inherit_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 8bd678
domain_obj_id_change_exempt(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 fe9b05
domain_system_change_exempt(run_init_t)
Chris PeBenito 8623d5
Chris PeBenito a1f94a
type setfiles_t, can_relabelto_binary_policy;
Chris PeBenito 8bd678
domain_obj_id_change_exempt(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 c9428d
domain_use_wide_inherit_fd(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 c9428d
init_use_fd(checkpolicy_t)
Chris PeBenito c9428d
init_use_script_pty(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 c9428d
userdom_use_all_user_fd(checkpolicy_t)
Chris PeBenito 26c87e
Chris PeBenito 33acca
ifdef(`targeted_policy',`
Chris PeBenito 33acca
	term_use_generic_pty(checkpolicy_t)
Chris PeBenito 33acca
	term_use_unallocated_tty(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 d35c62
fs_getattr_xattr_fs(load_policy_t)
Chris PeBenito d35c62
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 c9428d
init_use_script_fd(load_policy_t)
Chris PeBenito c9428d
init_use_script_pty(load_policy_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
domain_use_wide_inherit_fd(load_policy_t)
Chris PeBenito 1e5c2a
Chris PeBenito 77f6e2
# for mcs.conf
Chris PeBenito 77f6e2
files_read_etc_files(load_policy_t)
Chris PeBenito bf080a
files_read_etc_runtime_files(load_policy_t)
Chris PeBenito efd8ed
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 c9428d
userdom_use_all_user_fd(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 bf080a
		unconfined_dontaudit_read_pipe(load_policy_t)
Chris PeBenito bf080a
	')
Chris PeBenito bf080a
')
Chris PeBenito bf080a
Chris PeBenito bf080a
ifdef(`targeted_policy',`
Chris PeBenito 9ca7e7
	term_use_unallocated_tty(load_policy_t)
Chris PeBenito 9ca7e7
	term_use_generic_pty(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 ee5772
Chris PeBenito c9428d
auth_domtrans_chk_passwd(newrole_t)
Chris PeBenito 1e5c2a
Chris PeBenito 725926
corecmd_list_bin(newrole_t)
Chris PeBenito 725926
corecmd_read_bin_symlink(newrole_t)
Chris PeBenito 725926
Chris PeBenito c9428d
domain_use_wide_inherit_fd(newrole_t)
Chris PeBenito ebdc3b
# for when the user types "exec newrole" at the command line:
Chris PeBenito ebdc3b
domain_sigchld_wide_inherit_fd(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 c9428d
userdom_use_unpriv_users_fd(newrole_t)
Chris PeBenito ae9e27
# for some PAM modules and for cwd
Chris PeBenito ae9e27
userdom_dontaudit_search_all_users_home(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 493d6c
	nscd_use_socket(newrole_t)
Chris PeBenito 493d6c
')
Chris PeBenito 493d6c
Chris PeBenito ab940a
ifdef(`TODO',`
Chris PeBenito ee5772
ifdef(`gnome-pty-helper.te', `allow newrole_t gphdomain:fd use;')
Chris PeBenito ee5772
') dnl ifdef TODO
Chris PeBenito ee5772
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 0fd9dc
kernel_use_fd(restorecon_t)
Chris PeBenito 445522
kernel_rw_pipes(restorecon_t)
Chris PeBenito ee5772
kernel_read_system_state(restorecon_t)
Chris PeBenito d35c62
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 0fd9dc
term_use_unallocated_tty(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 c9428d
init_use_fd(restorecon_t)
Chris PeBenito c9428d
init_use_script_pty(restorecon_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
domain_use_wide_inherit_fd(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 c9428d
userdom_use_all_user_fd(restorecon_t)
Chris PeBenito 26c87e
Chris PeBenito ee5772
# relabeling rules
Chris PeBenito 0fd9dc
kernel_relabel_unlabeled(restorecon_t)
Karl MacMillan f0c985
dev_relabel_all_dev_nodes(restorecon_t)
Karl MacMillan f0c985
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 ebdc3b
	fs_use_tmpfs_chr_dev(restorecon_t)
Chris PeBenito ebdc3b
	fs_use_tmpfs_blk_dev(restorecon_t)
Chris PeBenito ebdc3b
	fs_relabel_tmpfs_blk_dev(restorecon_t)
Chris PeBenito ebdc3b
	fs_relabel_tmpfs_chr_dev(restorecon_t)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito ae9e27
ifdef(`hide_broken_symptoms',`
Chris PeBenito 3df88d
	udev_dontaudit_rw_unix_dgram_socket(restorecon_t)
Chris PeBenito ae9e27
')
Chris PeBenito ae9e27
Chris PeBenito 132880
optional_policy(`hotplug',`
Chris PeBenito 21871a
	hotplug_use_fd(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 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 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 c9428d
	domain_use_wide_inherit_fd(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 8623d5
ifdef(`TODO',`
Chris PeBenito 254bbc
ifdef(`distro_gentoo', `
Chris PeBenito 0c73cd
	# Gentoo integrated run_init+open_init_pty-runscript:
Chris PeBenito c9428d
	domain_entry_file(run_init_t,initrc_exec_t)
Chris PeBenito 21871a
	domain_auto_trans(sysadm_t,initrc_exec_t,run_init_t)
Chris PeBenito 8623d5
')
Chris PeBenito 8623d5
') dnl end TODO
Chris PeBenito 8623d5
Chris PeBenito ee5772
########################################
Chris PeBenito ee5772
#
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 ae9e27
kernel_list_unlabeled(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 0fd9dc
term_use_unallocated_tty(setfiles_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
init_use_fd(setfiles_t)
Chris PeBenito c9428d
init_use_script_fd(setfiles_t)
Chris PeBenito c9428d
init_use_script_pty(setfiles_t)
Chris PeBenito ee5772
Chris PeBenito c9428d
domain_use_wide_inherit_fd(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 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 c9428d
userdom_use_all_user_fd(setfiles_t)
Chris PeBenito daa0e0
# for config files in a home directory
Chris PeBenito fd89e1
userdom_read_all_user_files(setfiles_t)
Chris PeBenito 26c87e
Chris PeBenito ee5772
# relabeling rules
Chris PeBenito 0fd9dc
kernel_relabel_unlabeled(setfiles_t)
Karl MacMillan f0c985
dev_relabel_all_dev_nodes(setfiles_t)
Chris PeBenito 9e04f5
files_list_all(setfiles_t)
Chris PeBenito efd8ed
files_relabel_all_files(setfiles_t)
Chris PeBenito a1f94a
# this is to satisfy the assertion:
Chris PeBenito c9428d
auth_relabelto_shadow(setfiles_t)
Chris PeBenito ee5772
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 setfiles can not be run!
Chris PeBenito ee5772
allow setfiles_t lib_t:file { read execute };
Chris PeBenito ee5772
') dnl endif TODO