Chris PeBenito e181fe
Chris PeBenito 18cc01
policy_module(init,1.2.1)
Chris PeBenito 960373
Chris PeBenito c38127
gen_require(`
Chris PeBenito c38127
	class passwd rootok;
Chris PeBenito c38127
')
Chris PeBenito c38127
Chris PeBenito bbd6a6
########################################
Chris PeBenito bbd6a6
#
Chris PeBenito bbd6a6
# Declarations
Chris PeBenito bbd6a6
#
Chris PeBenito bbd6a6
Chris PeBenito e5f806
# used for direct running of init scripts
Chris PeBenito e5f806
# by admin domains
Chris PeBenito e5f806
attribute direct_run_init;
Chris PeBenito e5f806
attribute direct_init;
Chris PeBenito e5f806
attribute direct_init_entry;
Chris PeBenito e5f806
Chris PeBenito 343a23
#
Chris PeBenito b4cd15
# init_t is the domain of the init process.
Chris PeBenito b4cd15
#
Chris PeBenito 23a444
# real declaration moved to mls until
Chris PeBenito 23a444
# range_transition works in loadable modules
Chris PeBenito 23a444
gen_require(`
Chris PeBenito 23a444
	type init_t;
Chris PeBenito 23a444
')
Chris PeBenito c9428d
domain_type(init_t)
Chris PeBenito b4cd15
role system_r types init_t;
Chris PeBenito b4cd15
Chris PeBenito 343a23
#
Chris PeBenito 343a23
# init_exec_t is the type of the init program.
Chris PeBenito 343a23
#
Chris PeBenito 77f6e2
# real declaration moved to mls until
Chris PeBenito 77f6e2
# range_transition works in loadable modules
Chris PeBenito 77f6e2
gen_require(`
Chris PeBenito 77f6e2
	type init_exec_t;
Chris PeBenito 77f6e2
')
Chris PeBenito 270d42
kernel_domtrans_to(init_t,init_exec_t)
Chris PeBenito c9428d
domain_entry_file(init_t,init_exec_t)
Chris PeBenito b4cd15
Chris PeBenito 343a23
#
Chris PeBenito efd8ed
# init_var_run_t is the type for /var/run/shutdown.pid.
Chris PeBenito efd8ed
#
Chris PeBenito efd8ed
type init_var_run_t;
Chris PeBenito c9428d
files_pid_file(init_var_run_t)
Chris PeBenito efd8ed
Chris PeBenito efd8ed
#
Chris PeBenito 343a23
# initctl_t is the type of the named pipe created 
Chris PeBenito 343a23
# by init during initialization.  This pipe is used
Chris PeBenito 343a23
# to communicate with init.
Chris PeBenito 343a23
#
Chris PeBenito f0574f
type initctl_t;
Chris PeBenito 8fd367
files_type(initctl_t)
Chris PeBenito f0574f
mls_trusted_object(initctl_t)
Chris PeBenito b4cd15
Chris PeBenito 77f6e2
# real declaration moved to mls until
Chris PeBenito 77f6e2
# range_transition works in loadable modules
Chris PeBenito 77f6e2
gen_require(`
Chris PeBenito 77f6e2
	type initrc_t;
Chris PeBenito 77f6e2
')
Chris PeBenito c9428d
domain_type(initrc_t)
Chris PeBenito 343a23
role system_r types initrc_t;
Chris PeBenito 343a23
Chris PeBenito 6f81e1
# real declaration moved to mls until
Chris PeBenito 6f81e1
# range_transition works in loadable modules
Chris PeBenito 6f81e1
gen_require(`
Chris PeBenito 6f81e1
	type initrc_exec_t;
Chris PeBenito 6f81e1
')
Chris PeBenito c9428d
domain_entry_file(initrc_t,initrc_exec_t)
Chris PeBenito 343a23
Chris PeBenito 343a23
type initrc_devpts_t;
Chris PeBenito 0fd9dc
term_pty(initrc_devpts_t)
Chris PeBenito 603f90
files_type(initrc_devpts_t)
Chris PeBenito 343a23
Chris PeBenito 343a23
type initrc_state_t;
Chris PeBenito 8fd367
files_type(initrc_state_t)
Chris PeBenito 343a23
Chris PeBenito 343a23
type initrc_tmp_t;
Chris PeBenito c9428d
files_tmp_file(initrc_tmp_t)
Chris PeBenito 343a23
Chris PeBenito a1fcff
type initrc_var_run_t;
Chris PeBenito a1fcff
files_pid_file(initrc_var_run_t)
Chris PeBenito a1fcff
Chris PeBenito 343a23
########################################
Chris PeBenito 343a23
#
Chris PeBenito 343a23
# Init local policy
Chris PeBenito 343a23
#
Chris PeBenito 343a23
Chris PeBenito 3b857e
# Use capabilities. old rule:
Chris PeBenito 3b857e
allow init_t self:capability ~sys_module;
Chris PeBenito 3b857e
# is ~sys_module really needed? observed: 
Chris PeBenito 3b857e
# sys_boot
Chris PeBenito 3b857e
# sys_tty_config
Chris PeBenito 3b857e
# kill: now provided by domain_kill_all_domains()
Chris PeBenito 3b857e
# setuid (from /sbin/shutdown)
Chris PeBenito c9428d
# sys_chroot (from /usr/bin/chroot): now provided by corecmd_chroot_exec_chroot()
Chris PeBenito 3b857e
Chris PeBenito dd8229
allow init_t self:fifo_file rw_file_perms;
Chris PeBenito d490eb
Chris PeBenito f05782
# Re-exec itself
Chris PeBenito f5c42b
allow init_t init_exec_t:file { getattr read ioctl execute execute_no_trans };
Chris PeBenito f05782
Chris PeBenito 0907bd
allow init_t initrc_t:unix_stream_socket connectto;
Chris PeBenito 0907bd
Chris PeBenito f05782
# For /var/run/shutdown.pid.
Chris PeBenito f05782
allow init_t init_var_run_t:file { create getattr read append write setattr unlink };
Chris PeBenito 9d5949
files_filetrans_pid(init_t,init_var_run_t)
Chris PeBenito f05782
Chris PeBenito efd8ed
allow init_t initctl_t:fifo_file { create getattr read append write setattr unlink };
Chris PeBenito 0fd9dc
fs_associate_tmpfs(initctl_t)
Chris PeBenito 207c47
dev_filetrans_dev(init_t,initctl_t,fifo_file)
Chris PeBenito efd8ed
Chris PeBenito 3b857e
# Modify utmp.
Chris PeBenito 0fd9dc
allow init_t initrc_var_run_t:file { rw_file_perms setattr };
Chris PeBenito 3b857e
Chris PeBenito 588ffa
# Run init scripts.
Chris PeBenito 588ffa
domain_auto_trans(init_t,initrc_exec_t,initrc_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
kernel_read_system_state(init_t)
Chris PeBenito b4cd15
kernel_share_state(init_t)
Chris PeBenito b4cd15
Chris PeBenito d35c62
dev_read_sysfs(init_t)
Chris PeBenito d35c62
Chris PeBenito 8967bf
mls_process_write_down(init_t)
Chris PeBenito 8967bf
Chris PeBenito d35c62
selinux_set_boolean(init_t)
Chris PeBenito d35c62
Chris PeBenito 0fd9dc
term_use_all_terms(init_t)
Chris PeBenito b4cd15
Chris PeBenito df00b2
corecmd_exec_chroot(init_t)
Chris PeBenito c9428d
corecmd_exec_bin(init_t)
Chris PeBenito c9428d
corecmd_exec_sbin(init_t)
Chris PeBenito cbeef6
Chris PeBenito b4cd15
domain_kill_all_domains(init_t)
Chris PeBenito c6fd1f
domain_signal_all_domains(init_t)
Chris PeBenito c6fd1f
domain_signull_all_domains(init_t)
Chris PeBenito c6fd1f
domain_sigstop_all_domains(init_t)
Chris PeBenito c6fd1f
domain_sigstop_all_domains(init_t)
Chris PeBenito c6fd1f
domain_sigchld_all_domains(init_t)
Chris PeBenito b4cd15
Chris PeBenito 8fd367
files_read_etc_files(init_t)
Chris PeBenito c9428d
files_rw_generic_pids(init_t)
Chris PeBenito 9e04f5
files_dontaudit_search_isid_type_dirs(init_t)
Chris PeBenito c9428d
files_manage_etc_runtime_files(init_t)
Chris PeBenito f5c42b
# Run /etc/X11/prefdm:
Chris PeBenito 8fd367
files_exec_etc_files(init_t)
Chris PeBenito cbeef6
# file descriptors inherited from the rootfs:
Chris PeBenito 9e04f5
files_dontaudit_rw_root_files(init_t)
Chris PeBenito 9e04f5
files_dontaudit_rw_root_chr_files(init_t)
Chris PeBenito f05782
Chris PeBenito c9428d
libs_use_ld_so(init_t)
Chris PeBenito c9428d
libs_use_shared_libs(init_t)
Chris PeBenito c9428d
libs_rw_ld_so_cache(init_t)
Chris PeBenito b4cd15
Chris PeBenito c9428d
logging_send_syslog_msg(init_t)
Chris PeBenito c9428d
logging_rw_generic_logs(init_t)
Chris PeBenito 5050e5
Chris PeBenito f0574f
mls_file_read_up(init_t)
Chris PeBenito f0574f
mls_file_write_down(init_t)
Chris PeBenito f0574f
mls_rangetrans_target(init_t)
Chris PeBenito f0574f
Chris PeBenito 5e0da6
seutil_read_config(init_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
miscfiles_read_localization(init_t)
Chris PeBenito b4cd15
Chris PeBenito 254bbc
ifdef(`distro_redhat',`
Chris PeBenito 4d851f
	fs_rw_tmpfs_chr_files(init_t)
Chris PeBenito 9d5949
	fs_filetrans_tmpfs(init_t,initctl_t,fifo_file)
Chris PeBenito cbeef6
')
Chris PeBenito cbeef6
Chris PeBenito 2705f9
ifdef(`targeted_policy',`
Chris PeBenito 2705f9
	unconfined_domain_template(init_t)
Chris PeBenito 2705f9
')
Chris PeBenito 2705f9
Chris PeBenito 132880
optional_policy(`authlogin',`
Chris PeBenito c9428d
	auth_rw_login_records(init_t)
Chris PeBenito 3b857e
')
Chris PeBenito 3b857e
Chris PeBenito 132880
optional_policy(`nscd',`
Chris PeBenito 1815ba
	nscd_socket_use(init_t)
Chris PeBenito 162dfc
')
Chris PeBenito 162dfc
Chris PeBenito 132880
optional_policy(`portmap',`
Chris PeBenito 1815ba
	portmap_udp_send(init_t)
Chris PeBenito eb3cb6
')
Chris PeBenito eb3cb6
Chris PeBenito d490eb
# Run the shell in the sysadm_t domain for single-user mode.
Chris PeBenito 132880
optional_policy(`userdomain',`
Chris PeBenito c9428d
	userdom_shell_domtrans_sysadm(init_t)
Chris PeBenito d490eb
')
Chris PeBenito d490eb
Chris PeBenito 0907bd
ifdef(`TODO',`
Chris PeBenito 0907bd
allow init_t ramfs_t:sock_file write;
Chris PeBenito 0907bd
')
Chris PeBenito 0907bd
Chris PeBenito b4cd15
########################################
Chris PeBenito b4cd15
#
Chris PeBenito 343a23
# Init script local policy
Chris PeBenito f05782
#
Chris PeBenito b4cd15
Chris PeBenito b4cd15
allow initrc_t self:process { getpgid setsched setpgid setrlimit getsched };
Chris PeBenito b4cd15
allow initrc_t self:capability ~{ sys_admin sys_module };
Chris PeBenito b4cd15
allow initrc_t self:passwd rootok;
Chris PeBenito b4cd15
Chris PeBenito b4cd15
# Allow IPC with self
Chris PeBenito dd8229
allow initrc_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito b4cd15
allow initrc_t self:unix_stream_socket { create listen accept ioctl read getattr write setattr append bind connect getopt setopt shutdown connectto };
Chris PeBenito dd8229
allow initrc_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito dd8229
allow initrc_t self:udp_socket create_socket_perms;
Chris PeBenito dd8229
allow initrc_t self:fifo_file rw_file_perms;
Chris PeBenito dd8229
allow initrc_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito b4cd15
Chris PeBenito d490eb
allow initrc_t init_t:fd use;
Chris PeBenito d490eb
Chris PeBenito b422aa
allow initrc_t initrc_devpts_t:chr_file rw_term_perms;
Chris PeBenito b422aa
term_create_pty(initrc_t,initrc_devpts_t)
Chris PeBenito b422aa
Chris PeBenito 77f6e2
can_exec(initrc_t,initrc_exec_t)
Chris PeBenito f5c42b
Chris PeBenito dd8229
allow initrc_t initrc_state_t:dir create_dir_perms;
Chris PeBenito dd8229
allow initrc_t initrc_state_t:file create_file_perms;
Chris PeBenito b4cd15
allow initrc_t initrc_state_t:lnk_file { create read getattr setattr unlink rename };
Chris PeBenito b4cd15
Chris PeBenito dd8229
allow initrc_t initrc_var_run_t:file create_file_perms;
Chris PeBenito 9d5949
files_filetrans_pid(initrc_t,initrc_var_run_t)
Chris PeBenito d25dd9
Chris PeBenito 77f6e2
can_exec(initrc_t,initrc_tmp_t)
Chris PeBenito dd8229
allow initrc_t initrc_tmp_t:file create_file_perms;
Chris PeBenito dd8229
allow initrc_t initrc_tmp_t:dir create_dir_perms;
Chris PeBenito 9d5949
files_filetrans_tmp(initrc_t,initrc_tmp_t, { file dir })
Chris PeBenito bbd6a6
Chris PeBenito b4cd15
kernel_read_system_state(initrc_t)
Chris PeBenito b4cd15
kernel_read_software_raid_state(initrc_t)
Chris PeBenito b4cd15
kernel_read_network_state(initrc_t)
Chris PeBenito b4cd15
kernel_read_ring_buffer(initrc_t)
Chris PeBenito b4cd15
kernel_change_ring_buffer_level(initrc_t)
Chris PeBenito b4cd15
kernel_clear_ring_buffer(initrc_t)
Chris PeBenito b4cd15
kernel_get_sysvipc_info(initrc_t)
Chris PeBenito 445522
kernel_read_all_sysctls(initrc_t)
Chris PeBenito 445522
kernel_rw_all_sysctls(initrc_t)
Chris PeBenito 07d6e3
# for lsof which is used by alsa shutdown:
Chris PeBenito 0fd9dc
kernel_dontaudit_getattr_message_if(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito daa0e0
bootloader_read_kernel_symbol_table(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito 0fd9dc
corenet_tcp_sendrecv_all_if(initrc_t)
Chris PeBenito 0fd9dc
corenet_raw_sendrecv_all_if(initrc_t)
Chris PeBenito 0fd9dc
corenet_udp_sendrecv_all_if(initrc_t)
Chris PeBenito 0fd9dc
corenet_tcp_sendrecv_all_nodes(initrc_t)
Chris PeBenito 0fd9dc
corenet_raw_sendrecv_all_nodes(initrc_t)
Chris PeBenito 0fd9dc
corenet_udp_sendrecv_all_nodes(initrc_t)
Chris PeBenito 0fd9dc
corenet_tcp_sendrecv_all_ports(initrc_t)
Chris PeBenito 0fd9dc
corenet_udp_sendrecv_all_ports(initrc_t)
Chris PeBenito bd7037
corenet_non_ipsec_sendrecv(initrc_t)
Chris PeBenito 0fd9dc
corenet_tcp_bind_all_nodes(initrc_t)
Chris PeBenito 0fd9dc
corenet_udp_bind_all_nodes(initrc_t)
Chris PeBenito 0907bd
corenet_tcp_connect_all_ports(initrc_t)
Chris PeBenito b4cd15
Karl MacMillan f0c985
dev_read_rand(initrc_t)
Karl MacMillan f0c985
dev_read_urand(initrc_t)
Karl MacMillan f0c985
dev_write_rand(initrc_t)
Karl MacMillan f0c985
dev_write_urand(initrc_t)
Chris PeBenito 0907bd
dev_rw_sysfs(initrc_t)
Chris PeBenito 0907bd
dev_list_usbfs(initrc_t)
Karl MacMillan f0c985
dev_read_framebuffer(initrc_t)
Karl MacMillan f0c985
dev_read_realtime_clock(initrc_t)
Chris PeBenito 207c47
dev_read_sound_mixer(initrc_t)
Chris PeBenito 207c47
dev_write_sound_mixer(initrc_t)
Karl MacMillan f0c985
dev_setattr_all_chr_files(initrc_t)
Karl MacMillan f0c985
dev_read_lvm_control(initrc_t)
Chris PeBenito 207c47
dev_delete_lvm_control_dev(initrc_t)
Chris PeBenito 605ba2
dev_manage_generic_symlinks(initrc_t)
Chris PeBenito dc771f
# Wants to remove udev.tbl:
Chris PeBenito 207c47
dev_delete_generic_symlinks(initrc_t)
Chris PeBenito 8a0da1
Chris PeBenito 763c44
fs_register_binary_executable_type(initrc_t)
Chris PeBenito 005a9a
# rhgb-console writes to ramfs
Chris PeBenito 4d851f
fs_write_ramfs_pipes(initrc_t)
Chris PeBenito daa0e0
# cjp: not sure why these are here; should use mount policy
Chris PeBenito 763c44
fs_mount_all_fs(initrc_t)
Chris PeBenito 763c44
fs_unmount_all_fs(initrc_t)
Chris PeBenito 763c44
fs_remount_all_fs(initrc_t)
Chris PeBenito 0fd9dc
fs_getattr_all_fs(initrc_t)
Chris PeBenito daa0e0
Chris PeBenito 0907bd
selinux_get_enforce_mode(initrc_t)
Chris PeBenito 0907bd
Chris PeBenito 1815ba
storage_getattr_fixed_disk_dev(initrc_t)
Chris PeBenito 1815ba
storage_setattr_fixed_disk_dev(initrc_t)
Chris PeBenito 1815ba
storage_setattr_removable_dev(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito 0fd9dc
term_use_all_terms(initrc_t)
Chris PeBenito 0fd9dc
term_reset_tty_labels(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito c9428d
auth_rw_login_records(initrc_t)
Chris PeBenito 93727e
auth_setattr_login_records(initrc_t)
Chris PeBenito c9428d
auth_rw_lastlog(initrc_t)
Chris PeBenito c9428d
auth_read_pam_pid(initrc_t)
Chris PeBenito c9428d
auth_delete_pam_pid(initrc_t)
Chris PeBenito a1fcff
auth_delete_pam_console_data(initrc_t)
Chris PeBenito d490eb
Chris PeBenito c9428d
corecmd_exec_bin(initrc_t)
Chris PeBenito c9428d
corecmd_exec_sbin(initrc_t)
Chris PeBenito c9428d
corecmd_exec_shell(initrc_t)
Chris PeBenito c9428d
corecmd_exec_ls(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito d0eddb
domain_kill_all_domains(initrc_t)
Chris PeBenito f5c42b
domain_signal_all_domains(initrc_t)
Chris PeBenito f5c42b
domain_signull_all_domains(initrc_t)
Chris PeBenito f5c42b
domain_sigstop_all_domains(initrc_t)
Chris PeBenito f5c42b
domain_sigstop_all_domains(initrc_t)
Chris PeBenito f5c42b
domain_sigchld_all_domains(initrc_t)
Chris PeBenito c9428d
domain_read_all_domains_state(initrc_t)
Chris PeBenito ccc597
domain_getattr_all_domains(initrc_t)
Chris PeBenito ccc597
domain_dontaudit_ptrace_all_domains(initrc_t)
Chris PeBenito c9428d
domain_getsession_all_domains(initrc_t)
Chris PeBenito c9428d
domain_use_wide_inherit_fd(initrc_t)
Chris PeBenito 9d3bdc
domain_exec_all_entry_files(initrc_t)
Chris PeBenito f5c42b
# for lsof which is used by alsa shutdown:
Chris PeBenito c9428d
domain_dontaudit_getattr_all_udp_sockets(initrc_t)
Chris PeBenito c9428d
domain_dontaudit_getattr_all_tcp_sockets(initrc_t)
Chris PeBenito 09741b
domain_dontaudit_getattr_all_dgram_sockets(initrc_t)
Chris PeBenito 09741b
domain_dontaudit_getattr_all_pipes(initrc_t)
Chris PeBenito c9428d
Chris PeBenito 50f650
files_getattr_all_dirs(initrc_t)
Chris PeBenito c9428d
files_getattr_all_files(initrc_t)
Chris PeBenito 50f650
files_getattr_all_symlinks(initrc_t)
Chris PeBenito 50f650
files_getattr_all_pipes(initrc_t)
Chris PeBenito 50f650
files_getattr_all_sockets(initrc_t)
Chris PeBenito ed78ea
files_purge_tmp(initrc_t)
Chris PeBenito 8fd367
files_delete_all_locks(initrc_t)
Chris PeBenito c9428d
files_read_all_pids(initrc_t)
Chris PeBenito c9428d
files_delete_all_pids(initrc_t)
Chris PeBenito a1fcff
files_delete_all_pid_dirs(initrc_t)
Chris PeBenito 8fd367
files_read_etc_files(initrc_t)
Chris PeBenito c9428d
files_manage_etc_runtime_files(initrc_t)
Chris PeBenito 8fd367
files_manage_generic_locks(initrc_t)
Chris PeBenito 8fd367
files_exec_etc_files(initrc_t)
Chris PeBenito c9428d
files_read_usr_files(initrc_t)
Chris PeBenito c9428d
files_manage_urandom_seed(initrc_t)
Chris PeBenito 9e04f5
files_manage_generic_spool(initrc_t)
Chris PeBenito a42ca7
# Mount and unmount file systems.
Chris PeBenito a42ca7
# cjp: not sure why these are here; should use mount policy
Chris PeBenito 9e04f5
files_list_isid_type_dirs(initrc_t)
Chris PeBenito 9e04f5
files_mounton_isid_type_dirs(initrc_t)
Chris PeBenito a42ca7
files_list_default(initrc_t)
Chris PeBenito a42ca7
files_mounton_default(initrc_t)
Chris PeBenito c9428d
Chris PeBenito c9428d
libs_rw_ld_so_cache(initrc_t)
Chris PeBenito c9428d
libs_use_ld_so(initrc_t)
Chris PeBenito c9428d
libs_use_shared_libs(initrc_t)
Chris PeBenito c9428d
libs_exec_lib_files(initrc_t)
Chris PeBenito c9428d
Chris PeBenito c9428d
logging_send_syslog_msg(initrc_t)
Chris PeBenito 0907bd
logging_manage_generic_logs(initrc_t)
Chris PeBenito d490eb
logging_read_all_logs(initrc_t)
Chris PeBenito d490eb
logging_append_all_logs(initrc_t)
Chris PeBenito 1815ba
logging_read_audit_config(initrc_t)
Chris PeBenito 5050e5
Chris PeBenito d490eb
miscfiles_read_localization(initrc_t)
Chris PeBenito 77f6e2
# slapd needs to read cert files from its initscript
Chris PeBenito 77f6e2
miscfiles_read_certs(initrc_t)
Chris PeBenito 91a7ab
Chris PeBenito f0574f
mls_file_read_up(initrc_t)
Chris PeBenito f0574f
mls_file_write_down(initrc_t)
Chris PeBenito f0574f
mls_process_read_up(initrc_t)
Chris PeBenito f0574f
mls_process_write_down(initrc_t)
Chris PeBenito bf080a
mls_rangetrans_source(initrc_t)
Chris PeBenito f0574f
Chris PeBenito 1815ba
modutils_read_module_config(initrc_t)
Chris PeBenito 725926
modutils_domtrans_insmod(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito 5e0da6
seutil_read_config(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito c9428d
sysnet_read_config(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito c9428d
udev_rw_db(initrc_t)
Chris PeBenito f1578d
Chris PeBenito fd89e1
userdom_read_all_user_files(initrc_t)
Chris PeBenito daa0e0
# Allow access to the sysadm TTYs. Note that this will give access to the 
Chris PeBenito daa0e0
# TTYs to any process in the initrc_t domain. Therefore, daemons and such
Chris PeBenito daa0e0
# started from init should be placed in their own domain.
Chris PeBenito c9428d
userdom_use_sysadm_terms(initrc_t)
Chris PeBenito daa0e0
Chris PeBenito 44d5d9
ifdef(`distro_debian',`
Chris PeBenito 207c47
	dev_setattr_generic_dirs(initrc_t)
Chris PeBenito a42ca7
Chris PeBenito 9d5949
	fs_filetrans_tmpfs(initrc_t,initrc_var_run_t,dir)
Chris PeBenito a42ca7
Chris PeBenito a42ca7
	# for storing state under /dev/shm
Chris PeBenito 4d851f
	fs_setattr_tmpfs_dirs(initrc_t)
Chris PeBenito a42ca7
	storage_create_fixed_disk_tmpfs(initrc_t)
Chris PeBenito a42ca7
Chris PeBenito 9e04f5
	files_setattr_etc_dirs(initrc_t)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito 7c8fc3
ifdef(`distro_gentoo',`
Chris PeBenito 132880
	optional_policy(`arpwatch',`
Chris PeBenito 4483ee
		arpwatch_manage_data_files(initrc_t)
Chris PeBenito 4483ee
	')
Chris PeBenito 4483ee
Chris PeBenito 132880
	optional_policy(`dhcp',`
Chris PeBenito 7c8fc3
		dhcpd_setattr_state_files(initrc_t)
Chris PeBenito 7c8fc3
	')
Chris PeBenito 7c8fc3
')
Chris PeBenito 7c8fc3
Chris PeBenito 254bbc
ifdef(`distro_redhat',`
Chris PeBenito 129318
	# this is from kmodule, which should get its own policy:
Chris PeBenito 129318
	allow initrc_t self:capability sys_admin;
Chris PeBenito 129318
Chris PeBenito d115b2
	# Red Hat systems seem to have a stray
Chris PeBenito d115b2
	# fd open from the initrd
Chris PeBenito 0fd9dc
	kernel_dontaudit_use_fd(initrc_t)
Chris PeBenito 9e04f5
	files_dontaudit_read_root_files(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito 5e0da6
	selinux_set_enforce_mode(initrc_t)
Chris PeBenito daa0e0
Chris PeBenito d115b2
	# Create and read /boot/kernel.h and /boot/System.map.
Chris PeBenito d115b2
	# Redhat systems typically create this file at boot time.
Chris PeBenito b57dd1
	bootloader_create_runtime_file(initrc_t)
Chris PeBenito b57dd1
	bootloader_rw_boot_symlinks(initrc_t)
Chris PeBenito f5c42b
Chris PeBenito d115b2
	# These seem to be from the initrd
Chris PeBenito d115b2
	# during device initialization:
Chris PeBenito 207c47
	dev_create_generic_dirs(initrc_t)
Chris PeBenito 207c47
	dev_rwx_zero(initrc_t)
Karl MacMillan f0c985
	dev_rx_raw_memory(initrc_t)
Karl MacMillan f0c985
	dev_wx_raw_memory(initrc_t)
Chris PeBenito d115b2
	storage_raw_read_fixed_disk(initrc_t)
Chris PeBenito d115b2
	storage_raw_write_fixed_disk(initrc_t)
Chris PeBenito daa0e0
Chris PeBenito 4d851f
	fs_rw_tmpfs_chr_files(initrc_t)
Chris PeBenito daa0e0
Chris PeBenito 005a9a
	storage_create_fixed_disk(initrc_t)
Chris PeBenito 1815ba
	storage_getattr_removable_dev(initrc_t)
Chris PeBenito 005a9a
Chris PeBenito d115b2
	files_create_boot_flag(initrc_t)
Chris PeBenito 005a9a
	# wants to read /.fonts directory
Chris PeBenito 005a9a
	files_read_default_files(initrc_t)
Chris PeBenito a6e32d
	files_mountpoint(initrc_tmp_t)
Chris PeBenito a6e32d
Chris PeBenito bf080a
	miscfiles_read_fonts(initrc_t)
Chris PeBenito bf080a
	miscfiles_read_hwdata(initrc_t)
Chris PeBenito bf080a
Chris PeBenito d115b2
	# readahead asks for these
Chris PeBenito bf080a
	auth_dontaudit_read_shadow(initrc_t)
Chris PeBenito 98a8ea
Chris PeBenito 132880
	optional_policy(`bind',`
Chris PeBenito 1815ba
		bind_manage_config_dirs(initrc_t)
Chris PeBenito 98a8ea
	')
Chris PeBenito 43989f
Chris PeBenito 132880
	optional_policy(`rpc',`
Chris PeBenito 43989f
		#for /etc/rc.d/init.d/nfs to create /etc/exports
Chris PeBenito 43989f
		rpc_write_exports(initrc_t)
Chris PeBenito 43989f
	')
Chris PeBenito 129318
')
Chris PeBenito 7bba9d
Chris PeBenito a42ca7
ifdef(`targeted_policy',`
Chris PeBenito 1815ba
	domain_subj_id_change_exemption(initrc_t)
Chris PeBenito 892266
	unconfined_domain_template(initrc_t)
Chris PeBenito 005a9a
',`
Chris PeBenito 005a9a
	# cjp: require doesnt work in optionals :\
Chris PeBenito 005a9a
	# this also would result in a type transition
Chris PeBenito 005a9a
	# conflict if sendmail is enabled
Chris PeBenito 132880
#	optional_policy(`sendmail',`',`
Chris PeBenito 005a9a
#		mta_send_mail(initrc_t)
Chris PeBenito 005a9a
#	')
Chris PeBenito 005a9a
')
Chris PeBenito 005a9a
Chris PeBenito 132880
optional_policy(`apm',`
Chris PeBenito 005a9a
	dev_rw_apm_bios(initrc_t)
Chris PeBenito a42ca7
')
Chris PeBenito a42ca7
Chris PeBenito 132880
optional_policy(`apache',`
Chris PeBenito 6e99a6
	apache_read_config(initrc_t)
Chris PeBenito 6e99a6
	apache_list_modules(initrc_t)
Chris PeBenito 6e99a6
')
Chris PeBenito 6e99a6
Chris PeBenito 7576fa
optional_policy(`automount',`
Chris PeBenito 3b4da4
	automount_exec_config(initrc_t)
Chris PeBenito 7576fa
')
Chris PeBenito 7576fa
Chris PeBenito 132880
optional_policy(`bind',`
Chris PeBenito d83fda
	bind_read_config(initrc_t)
Chris PeBenito d83fda
Chris PeBenito d83fda
	# for chmod in start script
Chris PeBenito 1815ba
	bind_setattr_pid_dirs(initrc_t)
Chris PeBenito d83fda
Chris PeBenito d83fda
	# for /etc/rndc.key
Chris PeBenito d83fda
	ifdef(`distro_redhat',`
Chris PeBenito d83fda
		# Allow init script to cp localtime to named_conf_t
Chris PeBenito d83fda
		bind_write_config(initrc_t)
Chris PeBenito d83fda
	')
Chris PeBenito d83fda
')
Chris PeBenito d83fda
Chris PeBenito 132880
optional_policy(`bluetooth',`
Chris PeBenito d4dca5
	dev_read_usbfs(initrc_t)
Chris PeBenito bf080a
	bluetooth_read_config(initrc_t)
Chris PeBenito d4dca5
')
Chris PeBenito d4dca5
Chris PeBenito 132880
optional_policy(`cpucontrol',`
Chris PeBenito 725926
	cpucontrol_stub(initrc_t)
Chris PeBenito 207c47
	dev_getattr_cpu_dev(initrc_t)
Chris PeBenito 921055
')
Chris PeBenito 921055
Chris PeBenito 9fd4b8
optional_policy(`cups',`
Chris PeBenito 9fd4b8
	cups_read_log(initrc_t)
Chris PeBenito 9fd4b8
')
Chris PeBenito 9fd4b8
Chris PeBenito 44d5d9
optional_policy(`daemontools',`
Chris PeBenito 44d5d9
	daemontools_manage_svc(initrc_t)
Chris PeBenito 44d5d9
')
Chris PeBenito 44d5d9
Chris PeBenito 132880
optional_policy(`dbus',`
Chris PeBenito 005a9a
	dbus_connect_system_bus(initrc_t)
Chris PeBenito 1815ba
	dbus_send_system_bus(initrc_t)
Chris PeBenito d828b5
	dbus_system_bus_client_template(initrc,initrc_t)
Chris PeBenito bf080a
	dbus_read_config(initrc_t)
Chris PeBenito 005a9a
Chris PeBenito d828b5
	optional_policy(`networkmanager',`
Chris PeBenito d828b5
		networkmanager_dbus_chat(initrc_t)
Chris PeBenito 005a9a
	')
Chris PeBenito 005a9a
')
Chris PeBenito 005a9a
Chris PeBenito 132880
optional_policy(`ftp',`
Chris PeBenito 246a60
	ftp_read_config(initrc_t)
Chris PeBenito 246a60
')
Chris PeBenito 246a60
Chris PeBenito 132880
optional_policy(`gpm',`
Chris PeBenito f862c3
	gpm_setattr_gpmctl(initrc_t)
Chris PeBenito f862c3
')
Chris PeBenito f862c3
Chris PeBenito 132880
optional_policy(`hotplug',`
Chris PeBenito 8bd678
	dev_read_usbfs(initrc_t)
Chris PeBenito d115b2
Chris PeBenito d115b2
	# init scripts run /etc/hotplug/usb.rc
Chris PeBenito d115b2
	hotplug_read_config(initrc_t)
Chris PeBenito d115b2
Chris PeBenito 1815ba
	modutils_read_module_deps(initrc_t)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito 132880
optional_policy(`inn',`
Chris PeBenito 9b0640
	inn_exec_config(initrc_t)
Chris PeBenito 9b0640
')
Chris PeBenito 9b0640
Chris PeBenito 132880
optional_policy(`ipsec',`
Chris PeBenito a5f339
	ipsec_read_config(initrc_t)
Chris PeBenito a5f339
	ipsec_manage_pid(initrc_t)
Chris PeBenito a5f339
')
Chris PeBenito a5f339
Chris PeBenito 132880
optional_policy(`kerberos',`
Chris PeBenito a7a979
	kerberos_use(initrc_t)
Chris PeBenito a7a979
')
Chris PeBenito a7a979
Chris PeBenito 132880
optional_policy(`ldap',`
Chris PeBenito 2961e7
	ldap_read_config(initrc_t)
Chris PeBenito 1815ba
	ldap_list_db(initrc_t)
Chris PeBenito 2961e7
')
Chris PeBenito 2961e7
Chris PeBenito 132880
optional_policy(`loadkeys',`
Chris PeBenito 21468a
	loadkeys_exec(initrc_t)
Chris PeBenito 21468a
')
Chris PeBenito 21468a
Chris PeBenito 132880
optional_policy(`lpd',`
Chris PeBenito ad3b9d
	# This is needed to permit chown to read /var/spool/lpd/lp.
Chris PeBenito ad3b9d
	# This is opens up security more than necessary; this means that ANYTHING
Chris PeBenito ad3b9d
	# running in the initrc_t domain can read the printer spool directory.
Chris PeBenito ad3b9d
	# Perhaps executing /etc/rc.d/init.d/lpd should transition
Chris PeBenito ad3b9d
	# to domain lpd_t, instead of waiting for executing lpd.
Chris PeBenito ad3b9d
	lpd_list_spool(initrc_t)
Chris PeBenito ad3b9d
Chris PeBenito ad3b9d
	lpd_read_config(initrc_t)
Chris PeBenito ad3b9d
')
Chris PeBenito ad3b9d
Chris PeBenito 132880
optional_policy(`lvm',`
Chris PeBenito d115b2
	#allow initrc_t lvm_control_t:chr_file unlink;
Chris PeBenito d115b2
Karl MacMillan f0c985
	dev_read_lvm_control(initrc_t)
Chris PeBenito 207c47
	dev_create_generic_chr_files(initrc_t)
Chris PeBenito a77e65
Chris PeBenito a77e65
	lvm_read_config(initrc_t)
Chris PeBenito f5c42b
')
Chris PeBenito f5c42b
Chris PeBenito 132880
optional_policy(`mailman',`
Chris PeBenito 799a0b
	mailman_list_data(initrc_t)
Chris PeBenito 799a0b
	mailman_read_data_symlinks(initrc_t)
Chris PeBenito 799a0b
')
Chris PeBenito 799a0b
Chris PeBenito 132880
optional_policy(`mta',`
Chris PeBenito bf080a
	mta_read_config(initrc_t)
Chris PeBenito 1815ba
	mta_dontaudit_read_spool_symlinks(initrc_t)
Chris PeBenito a42ca7
')
Chris PeBenito a42ca7
Chris PeBenito 132880
optional_policy(`mysql',`
Chris PeBenito 42be7c
	ifdef(`distro_redhat',`
Chris PeBenito 1815ba
		mysql_manage_db_dirs(initrc_t)
Chris PeBenito 42be7c
	')
Chris PeBenito 42be7c
Chris PeBenito 42be7c
	mysql_stream_connect(initrc_t)
Chris PeBenito 42be7c
	mysql_write_log(initrc_t)
Chris PeBenito 42be7c
')
Chris PeBenito 42be7c
Chris PeBenito 132880
optional_policy(`nis',`
Chris PeBenito fa6757
	nis_use_ypbind(initrc_t)
Chris PeBenito 1815ba
	nis_udp_send_ypbind(initrc_t)
Chris PeBenito e88003
	nis_list_var_yp(initrc_t)
Chris PeBenito e88003
')
Chris PeBenito e88003
Chris PeBenito 132880
optional_policy(`nscd',`
Chris PeBenito 1815ba
	nscd_socket_use(initrc_t)
Chris PeBenito d49d52
')
Chris PeBenito d49d52
Chris PeBenito 132880
optional_policy(`raid',`
Chris PeBenito a5f339
	raid_manage_mdadm_pid(initrc_t)
Chris PeBenito a5f339
')
Chris PeBenito a5f339
Chris PeBenito 132880
optional_policy(`rpc',`
Chris PeBenito 43989f
	rpc_read_exports(initrc_t)
Chris PeBenito 43989f
')
Chris PeBenito 43989f
Chris PeBenito 132880
optional_policy(`postgresql',`
Chris PeBenito a1fcff
	postgresql_manage_db(initrc_t)
Chris PeBenito a1fcff
	postgresql_read_config(initrc_t)
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito 132880
optional_policy(`postfix',`
Chris PeBenito 04926d
	postfix_list_spool(initrc_t)
Chris PeBenito 04926d
')
Chris PeBenito 04926d
Chris PeBenito 132880
optional_policy(`quota',`
Chris PeBenito 052c95
	quota_manage_flags(initrc_t)
Chris PeBenito 052c95
')
Chris PeBenito 052c95
Chris PeBenito 132880
optional_policy(`rhgb',`
Chris PeBenito c9428d
	corecmd_shell_entry_type(initrc_t)
Chris PeBenito d490eb
')
Chris PeBenito d490eb
Chris PeBenito 132880
optional_policy(`rpm',`
Chris PeBenito d115b2
	# bash tries to access a block device in the initrd
Chris PeBenito 445522
	kernel_dontaudit_getattr_unlabeled_blk_files(initrc_t)
Chris PeBenito d115b2
Chris PeBenito d115b2
	# for a bug in rm
Chris PeBenito c9428d
	files_dontaudit_write_all_pids(initrc_t)
Chris PeBenito d115b2
Chris PeBenito d115b2
	# bash tries ioctl for some reason
Chris PeBenito c9428d
	files_dontaudit_ioctl_all_pids(initrc_t)
Chris PeBenito d115b2
Chris PeBenito d115b2
	# why is this needed:
Chris PeBenito c9428d
	rpm_manage_db(initrc_t)
Chris PeBenito a42ca7
')
Chris PeBenito dc771f
Chris PeBenito 132880
optional_policy(`samba',`
Chris PeBenito 84c922
	samba_rw_config(initrc_t)
Chris PeBenito 79cde3
	samba_read_winbind_pid(initrc_t)
Chris PeBenito 84c922
')
Chris PeBenito 84c922
Chris PeBenito 132880
optional_policy(`squid',`
Chris PeBenito 0f707d
	squid_read_config(initrc_t)
Chris PeBenito 0f707d
	squid_manage_logs(initrc_t)
Chris PeBenito 0f707d
')
Chris PeBenito 0f707d
Chris PeBenito 132880
optional_policy(`ssh',`
Chris PeBenito c38127
	ssh_dontaudit_read_server_keys(initrc_t)
Chris PeBenito 9ccd96
')
Chris PeBenito 9ccd96
Chris PeBenito bb6763
# allow init scripts to su
Chris PeBenito 132880
optional_policy(`su',`
Chris PeBenito bb6763
	su_restricted_domain_template(initrc,initrc_t,system_r)
Chris PeBenito bb6763
')
Chris PeBenito bb6763
Chris PeBenito 132880
optional_policy(`sysnetwork',`
Chris PeBenito ebdc3b
	ifdef(`distro_redhat',`
Chris PeBenito ebdc3b
		sysnet_rw_dhcp_config(initrc_t)
Chris PeBenito ebdc3b
	')
Chris PeBenito ebdc3b
Chris PeBenito ebdc3b
	sysnet_read_dhcpc_state(initrc_t)
Chris PeBenito ebdc3b
')
Chris PeBenito ebdc3b
Chris PeBenito 3f4188
optional_policy(`xfs',`
Chris PeBenito 3f4188
	miscfiles_manage_fonts(initrc_t)
Chris PeBenito 3f4188
Chris PeBenito 3f4188
	# cjp: is this really needed?
Chris PeBenito 1815ba
	xfs_read_sockets(initrc_t)
Chris PeBenito 3f4188
')
Chris PeBenito 3f4188
Chris PeBenito 132880
optional_policy(`zebra',`
Chris PeBenito 9ff300
	zebra_read_config(initrc_t)
Chris PeBenito 9ff300
')
Chris PeBenito 9ff300
Chris PeBenito b4cd15
ifdef(`TODO',`
Chris PeBenito b4cd15
# Set device ownerships/modes.
Chris PeBenito b4cd15
allow initrc_t xconsole_device_t:fifo_file setattr;
Chris PeBenito b4cd15
Chris PeBenito a1fcff
# during boot up initrc needs to do the following
Chris PeBenito a1fcff
allow initrc_t default_t:dir write;
Chris PeBenito 0c3d17
Chris PeBenito 254bbc
ifdef(`distro_redhat', `
Chris PeBenito 0907bd
	allow initrc_t device_t:dir create;
Chris PeBenito 98a8ea
Chris PeBenito 77f6e2
	ifdef(`xserver.te', `
Chris PeBenito 77f6e2
	# wants to cleanup xserver log dir
Chris PeBenito 77f6e2
	allow initrc_t xserver_log_t:dir rw_dir_perms;
Chris PeBenito 77f6e2
	allow initrc_t xserver_log_t:file unlink;
Chris PeBenito 77f6e2
	')
Chris PeBenito 77f6e2
Chris PeBenito d115b2
')
Chris PeBenito 343a23
') dnl end TODO