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 b4cd15
domain_make_domain(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 ff3138
kernel_make_userland_entrypoint(init_t,init_exec_t)
Chris PeBenito b4cd15
domain_make_entrypoint_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 efd8ed
files_make_daemon_runtime_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 b4cd15
files_make_file(initctl_t)
Chris PeBenito b4cd15
Chris PeBenito 343a23
type initrc_t;
Chris PeBenito 343a23
domain_make_domain(initrc_t)
Chris PeBenito 343a23
role system_r types initrc_t;
Chris PeBenito 343a23
Chris PeBenito 343a23
type initrc_exec_t;
Chris PeBenito 343a23
domain_make_entrypoint_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 763c44
fs_noxattr_associate(initrc_devpts_t)
Chris PeBenito b16c6b
terminal_make_pseudoterminal(initrc_devpts_t)
Chris PeBenito 343a23
Chris PeBenito 343a23
type initrc_var_run_t;
Chris PeBenito d25dd9
files_make_daemon_runtime_file(initrc_var_run_t)
Chris PeBenito 343a23
Chris PeBenito 343a23
type initrc_state_t;
Chris PeBenito 343a23
files_make_file(initrc_state_t)
Chris PeBenito 343a23
Chris PeBenito 343a23
type initrc_tmp_t;
Chris PeBenito 38e24a
files_make_temporary_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 3b857e
# sys_chroot (from /usr/bin/chroot): now provided by corecommands_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 bbd6a6
files_create_daemon_runtime_data(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 763c44
fs_tmpfs_associate(initctl_t)
Chris PeBenito efd8ed
devices_create_dev_entry(init_t,initctl_t,fifo_file)
Chris PeBenito efd8ed
Chris PeBenito 3b857e
# Modify utmp.
Chris PeBenito dd8229
allow init_t initrc_var_run_t:file rw_file_perms;
Chris PeBenito 3b857e
Chris PeBenito f05782
# Run init scripts.  this is ok since initrc
Chris PeBenito f05782
# is also in this module
Chris PeBenito f05782
allow init_t initrc_t:process transition;
Chris PeBenito dd8229
allow init_t initrc_exec_t:file rx_file_perms;
Chris PeBenito e7fcdc
type_transition init_t initrc_exec_t:process initrc_t;
Chris PeBenito cbeef6
dontaudit init_t initrc_t:process { noatsecure siginh rlimitinh };
Chris PeBenito f05782
Chris PeBenito b4cd15
kernel_sigchld_from(init_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
# If you load a new policy that removes active domains, processes can
Chris PeBenito b4cd15
# get stuck if you do not allow unlabeled processes to signal init
Chris PeBenito b4cd15
# If you load an incompatible policy, you should probably reboot,
Chris PeBenito b4cd15
# since you may have compromised system security.
Chris PeBenito b4cd15
kernel_unlabeled_sigchld_from(init_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
kernel_set_selinux_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 b4cd15
terminal_use_all_terminals(init_t)
Chris PeBenito b4cd15
Chris PeBenito cbeef6
corecommands_chroot(init_t)
Chris PeBenito cbeef6
corecommands_execute_general_programs(init_t)
Chris PeBenito cbeef6
corecommands_execute_system_programs(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 f5c42b
files_read_general_system_config(init_t)
Chris PeBenito b4cd15
files_modify_system_runtime_data(init_t)
Chris PeBenito 3b857e
files_ignore_search_isid_type_dir(init_t)
Chris PeBenito 3b857e
files_manage_runtime_system_config(init_t)
Chris PeBenito f5c42b
# Run /etc/X11/prefdm:
Chris PeBenito f5c42b
files_execute_system_config_script(init_t)
Chris PeBenito cbeef6
# file descriptors inherited from the rootfs:
Chris PeBenito f05782
files_ignore_modify_rootfs_file(init_t)
Chris PeBenito f05782
files_ignore_modify_rootfs_device(init_t)
Chris PeBenito f05782
Chris PeBenito b4cd15
libraries_use_dynamic_loader(init_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(init_t)
Chris PeBenito 3b857e
libraries_modify_dynamic_loader_cache(init_t)
Chris PeBenito b4cd15
Chris PeBenito 5050e5
logging_send_system_log_message(init_t)
Chris PeBenito 3b857e
logging_modify_system_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 763c44
	fs_create_private_tmpfs_data(init_t,initctl_t,fifo_file)
Chris PeBenito cbeef6
')
Chris PeBenito cbeef6
Chris PeBenito 3b857e
optional_policy(`authlogin.te',`
Chris PeBenito d115b2
	authlogin_modify_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 d115b2
	userdomain_sysadm_shell_transition(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 d25dd9
files_create_daemon_runtime_data(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 bbd6a6
files_create_private_tmp_data(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 b4cd15
kernel_modify_hardware_config_option(initrc_t)
Chris PeBenito b4cd15
kernel_read_all_sysctl(initrc_t)
Chris PeBenito b4cd15
kernel_modify_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 07d6e3
kernel_ignore_get_message_interface_attributes(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito daa0e0
bootloader_read_kernel_symbol_table(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito d11566
corenetwork_sendrecv_tcp_on_all_interfaces(initrc_t)
Chris PeBenito d11566
corenetwork_sendrecv_raw_on_all_interfaces(initrc_t)
Chris PeBenito d11566
corenetwork_sendrecv_udp_on_all_interfaces(initrc_t)
Chris PeBenito d11566
corenetwork_sendrecv_tcp_on_all_nodes(initrc_t)
Chris PeBenito d11566
corenetwork_sendrecv_raw_on_all_nodes(initrc_t)
Chris PeBenito d11566
corenetwork_sendrecv_udp_on_all_nodes(initrc_t)
Chris PeBenito d11566
corenetwork_sendrecv_tcp_on_all_ports(initrc_t)
Chris PeBenito d11566
corenetwork_sendrecv_udp_on_all_ports(initrc_t)
Chris PeBenito 0e730c
corenetwork_bind_tcp_on_all_nodes(initrc_t)
Chris PeBenito 0e730c
corenetwork_bind_udp_on_all_nodes(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
devices_get_random_data(initrc_t)
Chris PeBenito b4cd15
devices_get_pseudorandom_data(initrc_t)
Chris PeBenito b4cd15
devices_add_entropy(initrc_t)
Chris PeBenito b4cd15
devices_set_pseudorandom_seed(initrc_t)
Chris PeBenito b4cd15
devices_read_framebuffer(initrc_t)
Chris PeBenito b4cd15
devices_read_realtime_clock(initrc_t)
Chris PeBenito b4cd15
devices_read_sound_mixer_levels(initrc_t)
Chris PeBenito b4cd15
devices_write_sound_mixer_levels(initrc_t)
Chris PeBenito 8a0da1
devices_set_all_character_device_attributes(initrc_t)
Chris PeBenito d490eb
devices_read_lvm_control_channel(initrc_t)
Chris PeBenito d490eb
devices_remove_lvm_control_channel(initrc_t)
Chris PeBenito dc771f
# Wants to remove udev.tbl:
Chris PeBenito dc771f
devices_remove_dev_symbolic_links(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 763c44
fs_get_all_fs_attributes(initrc_t)
Chris PeBenito daa0e0
Chris PeBenito ba7740
storage_get_fixed_disk_attributes(initrc_t)
Chris PeBenito 8a0da1
storage_set_fixed_disk_attributes(initrc_t)
Chris PeBenito 8a0da1
storage_set_removable_device_attributes(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
terminal_use_all_terminals(initrc_t)
Chris PeBenito ba7740
terminal_reset_physical_terminal_labels(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito d490eb
authlogin_modify_login_records(initrc_t)
Chris PeBenito d490eb
authlogin_modify_last_login_log(initrc_t)
Chris PeBenito f5c42b
authlogin_pam_read_runtime_data(initrc_t)
Chris PeBenito f5c42b
authlogin_pam_remove_runtime_data(initrc_t)
Chris PeBenito f5c42b
authlogin_pam_console_read_runtime_data_dir(initrc_t)
Chris PeBenito d490eb
Chris PeBenito daa0e0
corecommands_execute_general_programs(initrc_t)
Chris PeBenito daa0e0
corecommands_execute_system_programs(initrc_t)
Chris PeBenito daa0e0
corecommands_execute_shell(initrc_t)
Chris PeBenito f5c42b
corecommands_execute_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 d0eddb
domain_read_all_domains_process_state(initrc_t)
Chris PeBenito d490eb
domain_get_all_domains_session_id(initrc_t)
Chris PeBenito ba7740
domain_use_widely_inheritable_file_descriptors(initrc_t)
Chris PeBenito f5c42b
# for lsof which is used by alsa shutdown:
Chris PeBenito f5c42b
domain_ignore_get_all_domains_udp_socket_attributes(initrc_t)
Chris PeBenito f5c42b
domain_ignore_get_all_domains_tcp_socket_attributes(initrc_t)
Chris PeBenito f5c42b
domain_ignore_get_all_domains_unix_dgram_socket_attributes(initrc_t)
Chris PeBenito f5c42b
domain_ignore_get_all_domains_pipe_attributes(initrc_t)
Chris PeBenito ba7740
Chris PeBenito 8a0da1
files_get_all_file_attributes(initrc_t)
Chris PeBenito b4cd15
files_remove_all_tmp_data(initrc_t)
Chris PeBenito b4cd15
files_remove_all_lock_files(initrc_t)
Chris PeBenito d115b2
files_read_all_daemon_runtime_data(initrc_t)
Chris PeBenito b4cd15
files_remove_all_daemon_runtime_data(initrc_t)
Chris PeBenito b4cd15
files_read_general_system_config(initrc_t)
Chris PeBenito d490eb
files_manage_runtime_system_config(initrc_t)
Chris PeBenito 033c80
files_manage_system_lock_files(initrc_t)
Chris PeBenito b4cd15
files_execute_system_config_script(initrc_t)
Chris PeBenito 3ce6cb
files_read_general_application_resources(initrc_t)
Chris PeBenito b4cd15
files_manage_pseudorandom_saved_seed(initrc_t)
Chris PeBenito d115b2
files_manage_system_spools(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito daa0e0
libraries_modify_dynamic_loader_cache(initrc_t)
Chris PeBenito daa0e0
libraries_use_dynamic_loader(initrc_t)
Chris PeBenito daa0e0
libraries_use_shared_libraries(initrc_t)
Chris PeBenito daa0e0
libraries_execute_library_scripts(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito 5050e5
logging_send_system_log_message(initrc_t)
Chris PeBenito d490eb
logging_modify_system_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 b4cd15
modutils_read_kernel_module_loading_config(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito d490eb
selinux_read_config(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito d490eb
sysnetwork_read_network_config(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito 7bba9d
udev_modify_database(initrc_t)
Chris PeBenito f1578d
Chris PeBenito daa0e0
userdomain_read_all_users_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 daa0e0
userdomain_use_admin_terminals(initrc_t)
Chris PeBenito daa0e0
Chris PeBenito 254bbc
ifdef(`distro_debian', `
Chris PeBenito 763c44
	fs_create_private_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 d115b2
	kernel_ignore_use_file_descriptors(initrc_t)
Chris PeBenito d115b2
	files_ignore_read_rootfs_file(initrc_t)
Chris PeBenito b4cd15
Chris PeBenito d115b2
	kernel_set_selinux_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:
Chris PeBenito 129318
	devices_add_dev_dir(initrc_t)
Chris PeBenito d115b2
	devices_legacy_use_dev_zero(initrc_t)
Chris PeBenito d115b2
	devices_legacy_raw_read_memory(initrc_t)
Chris PeBenito d115b2
	devices_legacy_raw_write_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 d115b2
	mta_read_mail_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
Chris PeBenito d115b2
	devices_read_lvm_control_channel(initrc_t)
Chris PeBenito d115b2
	devices_add_generic_character_device(initrc_t)
Chris PeBenito f5c42b
')
Chris PeBenito f5c42b
Chris PeBenito d490eb
optional_policy(`rhgb.te',`
Chris PeBenito d115b2
	corecommands_make_shell_entrypoint(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 d115b2
	kernel_ignore_get_unlabeled_block_device_attributes(initrc_t)
Chris PeBenito d115b2
Chris PeBenito d115b2
	# for a bug in rm
Chris PeBenito d115b2
	files_ignore_write_all_daemon_runtime_data(initrc_t)
Chris PeBenito d115b2
Chris PeBenito d115b2
	# bash tries ioctl for some reason
Chris PeBenito d115b2
	files_ignore_ioctl_all_daemon_runtime_data(initrc_t)
Chris PeBenito d115b2
Chris PeBenito d115b2
	# why is this needed:
Chris PeBenito d115b2
	rpm_manage_package_database(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