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 343a23
#
Chris PeBenito b4cd15
# init_t is the domain of the init process.
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
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 b4cd15
type initctl_t;
Chris PeBenito c9428d
files_file_type(initctl_t)
Chris PeBenito b4cd15
Chris PeBenito 343a23
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 763c44
fs_associate(initrc_devpts_t)
Chris PeBenito 0fd9dc
fs_associate_noxattr(initrc_devpts_t)
Chris PeBenito 0fd9dc
term_pty(initrc_devpts_t)
Chris PeBenito 343a23
Chris PeBenito 343a23
type initrc_var_run_t;
Chris PeBenito c9428d
files_pid_file(initrc_var_run_t)
Chris PeBenito 343a23
Chris PeBenito 343a23
type initrc_state_t;
Chris PeBenito c9428d
files_file_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 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 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 0fd9dc
kernel_set_boolean(init_t)
Chris PeBenito b4cd15
kernel_read_system_state(init_t)
Chris PeBenito b4cd15
kernel_read_hardware_state(init_t)
Chris PeBenito b4cd15
kernel_share_state(init_t)
Chris PeBenito b4cd15
Chris PeBenito 0fd9dc
term_use_all_terms(init_t)
Chris PeBenito b4cd15
Chris PeBenito c9428d
corecmd_chroot_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 c9428d
files_read_generic_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 c9428d
files_exec_generic_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 b4cd15
selinux_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 763c44
	fs_use_tmpfs_character_devices(init_t)
Chris PeBenito 0fd9dc
	fs_create_tmpfs_data(init_t,initctl_t,fifo_file)
Chris PeBenito cbeef6
')
Chris PeBenito cbeef6
Chris PeBenito 3b857e
optional_policy(`authlogin.te',`
Chris PeBenito c9428d
	auth_rw_login_records(init_t)
Chris PeBenito 3b857e
')
Chris PeBenito 3b857e
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 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_hardware_state(initrc_t)
Chris PeBenito 0fd9dc
kernel_rw_hardware_config_option(initrc_t)
Chris PeBenito b4cd15
kernel_read_all_sysctl(initrc_t)
Chris PeBenito 0fd9dc
kernel_rw_all_sysctl(initrc_t)
Chris PeBenito b4cd15
kernel_get_selinux_enforcement_mode(initrc_t)
Chris PeBenito b4cd15
kernel_list_usb_hardware(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 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)
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 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 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 c9428d
auth_list_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 c9428d
domain_getsession_all_domains(initrc_t)
Chris PeBenito c9428d
domain_use_wide_inherit_fd(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 c9428d
files_getattr_all_files(initrc_t)
Chris PeBenito c9428d
files_delete_all_tmp_files(initrc_t)
Chris PeBenito c9428d
files_delete_all_lock_files(initrc_t)
Chris PeBenito c9428d
files_read_all_pids(initrc_t)
Chris PeBenito c9428d
files_delete_all_pids(initrc_t)
Chris PeBenito c9428d
files_read_generic_etc_files(initrc_t)
Chris PeBenito c9428d
files_manage_etc_runtime_files(initrc_t)
Chris PeBenito c9428d
files_manage_generic_lock_files(initrc_t)
Chris PeBenito c9428d
files_exec_generic_etc_files(initrc_t)
Chris PeBenito c9428d
files_read_usr_files(initrc_t)
Chris PeBenito c9428d
files_manage_urandom_seed(initrc_t)
Chris PeBenito c9428d
files_manage_spools(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 c9428d
logging_rw_generic_logs(initrc_t)
Chris PeBenito d490eb
logging_read_all_logs(initrc_t)
Chris PeBenito d490eb
logging_append_all_logs(initrc_t)
Chris PeBenito 5050e5
Chris PeBenito d490eb
miscfiles_read_localization(initrc_t)
Chris PeBenito 91a7ab
Chris PeBenito c9428d
modutils_read_module_conf(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito d490eb
selinux_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 c9428d
userdom_read_all_user_data(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 0fd9dc
	fs_create_tmpfs_data(initrc_t,initrc_var_run_t,dir)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
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 0fd9dc
	kernel_set_enforcement_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 d115b2
	bootloader_create_runtime_data(initrc_t)
Chris PeBenito d115b2
	bootloader_modify_bootloader_data_directory_symbolic_links(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 763c44
	fs_use_tmpfs_character_devices(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 129318
')
Chris PeBenito 7bba9d
Chris PeBenito daa0e0
optional_policy(`hotplug.te',`
Chris PeBenito d115b2
	kernel_read_usb_hardware_state(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 d115b2
	modutils_read_kernel_module_dependencies(initrc_t)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
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 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 dc771f
') dnl end rpm.te
Chris PeBenito dc771f
Chris PeBenito b4cd15
ifdef(`TODO',`
Chris PeBenito daa0e0
Chris PeBenito b4cd15
# Mount and unmount file systems.
Chris PeBenito b4cd15
allow initrc_t { file_t default_t }:dir { read search getattr mounton };
Chris PeBenito b4cd15
Chris PeBenito b4cd15
# Set device ownerships/modes.
Chris PeBenito b4cd15
allow initrc_t xconsole_device_t:fifo_file setattr;
Chris PeBenito b4cd15
Chris PeBenito b4cd15
# for lsof in shutdown scripts
Chris PeBenito c18e82
can_kerberos(initrc_t)
Chris PeBenito ba7740
dontaudit initrc_t krb5_conf_t:file write;
Chris PeBenito dd8229
allow initrc_t krb5_conf_t:file r_file_perms;
Chris PeBenito b4cd15
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_debian', `
Chris PeBenito d115b2
	allow initrc_t { etc_t device_t }:dir setattr;
Chris PeBenito b4cd15
Chris PeBenito d115b2
	# for storing state under /dev/shm
Chris PeBenito d115b2
	allow initrc_t tmpfs_t:dir setattr;
Chris PeBenito d115b2
	file_type_auto_trans(initrc_t, tmpfs_t, fixed_disk_device_t, blk_file)
Chris PeBenito d115b2
')
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 d115b2
')
Chris PeBenito b4cd15
Chris PeBenito 254bbc
ifdef(`targeted_policy', `
Chris PeBenito d115b2
	domain_auto_trans(unconfined_t, initrc_exec_t, initrc_t)
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
	domain_trans(initrc_t, shell_exec_t, unconfined_t)
Chris PeBenito d115b2
')
Chris PeBenito f5c42b
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# Shutting down xinet causes these
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# Rsync
Chris PeBenito b4cd15
dontaudit initrc_t mail_spool_t:lnk_file read;
Chris PeBenito 343a23
') dnl end TODO