Chris PeBenito e181fe
Chris PeBenito 960373
policy_module(init,1.0)
Chris PeBenito 960373
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 f0574f
type init_t;
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 b4cd15
type init_exec_t;
Chris PeBenito 0fd9dc
kernel_userland_entry(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 f0574f
type initrc_t;
Chris PeBenito c9428d
domain_type(initrc_t)
Chris PeBenito 343a23
role system_r types initrc_t;
Chris PeBenito 343a23
Chris PeBenito 343a23
type initrc_exec_t;
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 c9428d
files_create_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)
Karl MacMillan f0c985
dev_create_dev_node(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 712566
kernel_sigchld_from(init_t)
Chris PeBenito 712566
# If you load a new policy that removes active domains, processes can
Chris PeBenito 712566
# get stuck if you do not allow unlabeled processes to signal init.
Chris PeBenito 712566
# If you load an incompatible policy, you should probably reboot,
Chris PeBenito 712566
# since you may have compromised system security.
Chris PeBenito 712566
kernel_sigchld_from_unlabeled(init_t)
Chris PeBenito b4cd15
Chris PeBenito d35c62
dev_read_sysfs(init_t)
Chris PeBenito d35c62
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 c9428d
files_dontaudit_search_isid_type_dir(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 c9428d
files_dontaudit_rw_root_file(init_t)
Chris PeBenito c9428d
files_dontaudit_rw_root_chr_dev(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 ebdc3b
	fs_use_tmpfs_chr_dev(init_t)
Chris PeBenito 0fd9dc
	fs_create_tmpfs_data(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 3b857e
optional_policy(`authlogin.te',`
Chris PeBenito c9428d
	auth_rw_login_records(init_t)
Chris PeBenito 3b857e
')
Chris PeBenito 3b857e
Chris PeBenito eb3cb6
optional_policy(`portmap.te',`
Chris PeBenito eb3cb6
	portmap_udp_sendto(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 d490eb
optional_policy(`userdomain.te',`
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 f5c42b
allow initrc_t initrc_exec_t:file { getattr read ioctl execute execute_no_trans };
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 c9428d
files_create_pid(initrc_t,initrc_var_run_t)
Chris PeBenito d25dd9
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 c9428d
files_create_tmp_files(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 b4cd15
kernel_read_all_sysctl(initrc_t)
Chris PeBenito 0fd9dc
kernel_rw_all_sysctl(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 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)
Karl MacMillan f0c985
dev_read_snd_mixer_dev(initrc_t)
Karl MacMillan f0c985
dev_write_snd_mixer_dev(initrc_t)
Karl MacMillan f0c985
dev_setattr_all_chr_files(initrc_t)
Karl MacMillan f0c985
dev_read_lvm_control(initrc_t)
Karl MacMillan f0c985
dev_delete_lvm_control(initrc_t)
Chris PeBenito 605ba2
dev_manage_generic_symlinks(initrc_t)
Chris PeBenito dc771f
# Wants to remove udev.tbl:
Karl MacMillan f0c985
dev_del_generic_symlinks(initrc_t)
Chris PeBenito 8a0da1
Chris PeBenito 763c44
fs_register_binary_executable_type(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 0fd9dc
storage_getattr_fixed_disk(initrc_t)
Chris PeBenito 0fd9dc
storage_setattr_fixed_disk(initrc_t)
Chris PeBenito 5a45e7
storage_setattr_removable_device(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 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 c9428d
domain_dontaudit_getattr_all_unix_dgram_sockets(initrc_t)
Chris PeBenito c9428d
domain_dontaudit_getattr_all_unnamed_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 8fd367
files_manage_generic_spools(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 a42ca7
files_list_isid_type_dir(initrc_t)
Chris PeBenito a42ca7
files_mounton_isid_type_dir(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 605ba2
logging_read_auditd_config(initrc_t)
Chris PeBenito 5050e5
Chris PeBenito d490eb
miscfiles_read_localization(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 f0574f
Chris PeBenito c9428d
modutils_read_module_conf(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 254bbc
ifdef(`distro_debian', `
Chris PeBenito a42ca7
	dev_setattr_dev_dir(initrc_t)
Chris PeBenito a42ca7
Chris PeBenito 0fd9dc
	fs_create_tmpfs_data(initrc_t,initrc_var_run_t,dir)
Chris PeBenito a42ca7
Chris PeBenito a42ca7
	# for storing state under /dev/shm
Chris PeBenito a42ca7
	fs_setattr_tmpfs_dir(initrc_t)
Chris PeBenito a42ca7
	storage_create_fixed_disk_tmpfs(initrc_t)
Chris PeBenito a42ca7
Chris PeBenito a42ca7
	files_setattr_etc_dir(initrc_t)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito 7c8fc3
ifdef(`distro_gentoo',`
Chris PeBenito 7c8fc3
	optional_policy(`dhcp.te',`
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 c9428d
	files_dontaudit_read_root_file(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:
Karl MacMillan f0c985
	dev_create_dir(initrc_t)
Karl MacMillan f0c985
	dev_rwx_zero_dev(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 ebdc3b
	fs_use_tmpfs_chr_dev(initrc_t)
Chris PeBenito daa0e0
Chris PeBenito d115b2
	files_create_boot_flag(initrc_t)
Chris PeBenito d115b2
Chris PeBenito d115b2
	# readahead asks for these
Chris PeBenito c9428d
	mta_read_aliases(initrc_t)
Chris PeBenito 98a8ea
Chris PeBenito 98a8ea
	optional_policy(`bind.te',`
Chris PeBenito 98a8ea
		bind_manage_config_dir(initrc_t)
Chris PeBenito 98a8ea
	')
Chris PeBenito 129318
')
Chris PeBenito 7bba9d
Chris PeBenito a42ca7
ifdef(`targeted_policy',`
Chris PeBenito 605ba2
	domain_subj_id_change_exempt(initrc_t)
Chris PeBenito 892266
	unconfined_domain_template(initrc_t)
Chris PeBenito a42ca7
	unconfined_shell_domtrans(initrc_t)
Chris PeBenito a42ca7
')
Chris PeBenito a42ca7
Chris PeBenito 6e99a6
optional_policy(`apache.te',`
Chris PeBenito 6e99a6
	apache_read_config(initrc_t)
Chris PeBenito 6e99a6
	apache_list_modules(initrc_t)
Chris PeBenito 6e99a6
')
Chris PeBenito 6e99a6
Chris PeBenito d83fda
optional_policy(`bind.te',`
Chris PeBenito d83fda
	bind_read_config(initrc_t)
Chris PeBenito d83fda
Chris PeBenito d83fda
	# for chmod in start script
Chris PeBenito d83fda
	bind_setattr_pid_dir(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 d83fda
Chris PeBenito 921055
optional_policy(`cpucontrol.te',`
Chris PeBenito 921055
	cpucontrol_stub()
Chris PeBenito 921055
	dev_getattr_cpu(initrc_t)
Chris PeBenito 921055
')
Chris PeBenito 921055
Chris PeBenito 246a60
optional_policy(`ftp.te',`
Chris PeBenito 246a60
	ftp_read_config(initrc_t)
Chris PeBenito 246a60
')
Chris PeBenito 246a60
Chris PeBenito f862c3
optional_policy(`gpm.te',`
Chris PeBenito f862c3
	gpm_setattr_gpmctl(initrc_t)
Chris PeBenito f862c3
')
Chris PeBenito f862c3
Chris PeBenito daa0e0
optional_policy(`hotplug.te',`
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 8fd367
	modutils_read_mods_deps(initrc_t)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito 9b0640
optional_policy(`inn.te',`
Chris PeBenito 9b0640
	inn_exec_config(initrc_t)
Chris PeBenito 9b0640
')
Chris PeBenito 9b0640
Chris PeBenito a5f339
optional_policy(`ipsec.te',`
Chris PeBenito a5f339
	ipsec_read_config(initrc_t)
Chris PeBenito a5f339
	ipsec_manage_pid(initrc_t)
Chris PeBenito a5f339
')
Chris PeBenito a5f339
Chris PeBenito a7a979
optional_policy(`kerberos.te',`
Chris PeBenito a7a979
	kerberos_use(initrc_t)
Chris PeBenito a7a979
')
Chris PeBenito a7a979
Chris PeBenito 2961e7
optional_policy(`ldap.te',`
Chris PeBenito 2961e7
	ldap_read_config(initrc_t)
Chris PeBenito 2961e7
	ldap_list_db_dir(initrc_t)
Chris PeBenito 2961e7
')
Chris PeBenito 2961e7
Chris PeBenito 21468a
optional_policy(`loadkeys.te',`
Chris PeBenito 21468a
	loadkeys_exec(initrc_t)
Chris PeBenito 21468a
')
Chris PeBenito 21468a
Chris PeBenito f5c42b
optional_policy(`lvm.te',`
Chris PeBenito d115b2
	#allow initrc_t lvm_control_t:chr_file unlink;
Chris PeBenito d115b2
Karl MacMillan f0c985
	dev_read_lvm_control(initrc_t)
Karl MacMillan f0c985
	dev_create_generic_chr_file(initrc_t)
Chris PeBenito f5c42b
')
Chris PeBenito f5c42b
Chris PeBenito a42ca7
optional_policy(`mta.te',`
Chris PeBenito a42ca7
	mta_dontaudit_read_spool_symlink(initrc_t)
Chris PeBenito a42ca7
')
Chris PeBenito a42ca7
Chris PeBenito 42be7c
optional_policy(`mysql.te',`
Chris PeBenito 42be7c
	ifdef(`distro_redhat',`
Chris PeBenito 42be7c
		mysql_manage_db_dir(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 e88003
optional_policy(`nis.te',`
Chris PeBenito fa6757
	nis_use_ypbind(initrc_t)
Chris PeBenito e88003
	nis_udp_sendto_ypbind(initrc_t)
Chris PeBenito e88003
	nis_list_var_yp(initrc_t)
Chris PeBenito e88003
')
Chris PeBenito e88003
Chris PeBenito a5f339
optional_policy(`raid.te',`
Chris PeBenito a5f339
	raid_manage_mdadm_pid(initrc_t)
Chris PeBenito a5f339
')
Chris PeBenito a5f339
Chris PeBenito a1fcff
optional_policy(`postgresql.te',`
Chris PeBenito a1fcff
	postgresql_manage_db(initrc_t)
Chris PeBenito a1fcff
	postgresql_read_config(initrc_t)
Chris PeBenito a1fcff
')
Chris PeBenito a1fcff
Chris PeBenito 052c95
optional_policy(`quota.te',`
Chris PeBenito 052c95
	quota_manage_flags(initrc_t)
Chris PeBenito 052c95
')
Chris PeBenito 052c95
Chris PeBenito d490eb
optional_policy(`rhgb.te',`
Chris PeBenito c9428d
	corecmd_shell_entry_type(initrc_t)
Chris PeBenito d490eb
')
Chris PeBenito d490eb
Chris PeBenito dc771f
optional_policy(`rpm.te',`
Chris PeBenito d115b2
	# bash tries to access a block device in the initrd
Chris PeBenito 0fd9dc
	kernel_dontaudit_getattr_unlabeled_blk_dev(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 84c922
optional_policy(`samba.te',`
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 0f707d
optional_policy(`squid.te',`
Chris PeBenito 0f707d
	squid_read_config(initrc_t)
Chris PeBenito 0f707d
	squid_manage_logs(initrc_t)
Chris PeBenito 0f707d
')
Chris PeBenito 0f707d
Chris PeBenito 9ccd96
optional_policy(`ssh.te',`
Chris PeBenito 9ccd96
	optional_policy(`inetd.te',`
Chris PeBenito 9ccd96
		tunable_policy(`run_ssh_inetd',`',`
Chris PeBenito 9ccd96
			ssh_dontaudit_read_server_keys(initrc_t)
Chris PeBenito 9ccd96
		')
Chris PeBenito 9ccd96
	',`
Chris PeBenito 9ccd96
		ssh_dontaudit_read_server_keys(initrc_t)
Chris PeBenito 9ccd96
	')
Chris PeBenito 9ccd96
')
Chris PeBenito 9ccd96
Chris PeBenito ebdc3b
optional_policy(`sysnetwork.te',`
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 9ff300
optional_policy(`zebra.te',`
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 0c3d17
allow initrc_t system_dbusd_t:dbus { send_msg acquire_svc };
Chris PeBenito a1fcff
allow initrc_t system_dbusd_t:unix_stream_socket connectto;
Chris PeBenito a1fcff
allow initrc_t system_dbusd_var_run_t:sock_file write;
Chris PeBenito a1fcff
Chris PeBenito a1fcff
# rhgb-console writes to ramfs
Chris PeBenito a1fcff
allow initrc_t ramfs_t:fifo_file write;
Chris PeBenito a1fcff
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 b4cd15
#
Chris PeBenito b4cd15
#  These rules are here to allow init scripts to su
Chris PeBenito b4cd15
#
Chris PeBenito 25baab
optional_policy(`su.te', `
Chris PeBenito b4cd15
su_restricted_domain(initrc,system)
Chris PeBenito b4cd15
role system_r types initrc_su_t;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito 254bbc
ifdef(`distro_redhat', `
Chris PeBenito d115b2
	# readahead asks for these
Chris PeBenito dd8229
	allow initrc_t var_lib_nfs_t:file r_file_perms;
Chris PeBenito 0907bd
Chris PeBenito 0907bd
	file_type_auto_trans(initrc_t, device_t, fixed_disk_device_t, blk_file)
Chris PeBenito 0907bd
	allow initrc_t file_type:{ dir_file_class_set socket_class_set } getattr;
Chris PeBenito 0907bd
	allow initrc_t self:capability sys_admin;
Chris PeBenito 0907bd
	allow initrc_t device_t:dir create;
Chris PeBenito 98a8ea
Chris PeBenito 98a8ea
	optional_policy(`rpm.te',`
Chris PeBenito 98a8ea
		rpm_stub()
Chris PeBenito 98a8ea
		#read ahead wants to read this
Chris PeBenito 98a8ea
		allow initrc_t system_cron_spool_t:file { getattr read };
Chris PeBenito 98a8ea
	')
Chris PeBenito d115b2
')
Chris PeBenito b4cd15
Chris PeBenito a42ca7
ifdef(`targeted_policy',`
Chris PeBenito d115b2
	allow unconfined_t initrc_t:dbus { acquire_svc send_msg };
Chris PeBenito d115b2
	allow initrc_t unconfined_t:dbus { acquire_svc send_msg };
Chris PeBenito d115b2
')
Chris PeBenito 343a23
') dnl end TODO