2005-04-20 19:07:16 +00:00
|
|
|
|
2005-04-26 17:00:25 +00:00
|
|
|
policy_module(init,1.0)
|
|
|
|
|
2005-05-05 18:30:00 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2005-07-07 15:25:28 +00:00
|
|
|
# used for direct running of init scripts
|
|
|
|
# by admin domains
|
|
|
|
attribute direct_run_init;
|
|
|
|
attribute direct_init;
|
|
|
|
attribute direct_init_entry;
|
|
|
|
|
2005-04-22 22:00:09 +00:00
|
|
|
#
|
2005-04-14 20:18:17 +00:00
|
|
|
# init_t is the domain of the init process.
|
|
|
|
#
|
|
|
|
type init_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_type(init_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
role system_r types init_t;
|
|
|
|
|
2005-04-22 22:00:09 +00:00
|
|
|
#
|
|
|
|
# init_exec_t is the type of the init program.
|
|
|
|
#
|
2005-04-14 20:18:17 +00:00
|
|
|
type init_exec_t;
|
2005-06-10 01:01:13 +00:00
|
|
|
kernel_userland_entry(init_t,init_exec_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_entry_file(init_t,init_exec_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-05-25 20:58:21 +00:00
|
|
|
#
|
|
|
|
# init_var_run_t is the type for /var/run/shutdown.pid.
|
|
|
|
#
|
|
|
|
type init_var_run_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_pid_file(init_var_run_t)
|
2005-05-25 20:58:21 +00:00
|
|
|
|
2005-04-22 22:00:09 +00:00
|
|
|
#
|
|
|
|
# initctl_t is the type of the named pipe created
|
|
|
|
# by init during initialization. This pipe is used
|
|
|
|
# to communicate with init.
|
|
|
|
#
|
2005-04-14 20:18:17 +00:00
|
|
|
type initctl_t;
|
2005-06-29 14:26:41 +00:00
|
|
|
files_type(initctl_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-04-22 22:00:09 +00:00
|
|
|
type initrc_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_type(initrc_t)
|
2005-04-22 22:00:09 +00:00
|
|
|
role system_r types initrc_t;
|
|
|
|
|
|
|
|
type initrc_exec_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_entry_file(initrc_t,initrc_exec_t)
|
2005-04-22 22:00:09 +00:00
|
|
|
|
|
|
|
type initrc_devpts_t;
|
2005-06-10 01:01:13 +00:00
|
|
|
term_pty(initrc_devpts_t)
|
2005-09-05 18:17:17 +00:00
|
|
|
files_type(initrc_devpts_t)
|
2005-04-22 22:00:09 +00:00
|
|
|
|
|
|
|
type initrc_var_run_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_pid_file(initrc_var_run_t)
|
2005-04-22 22:00:09 +00:00
|
|
|
|
|
|
|
type initrc_state_t;
|
2005-06-29 14:26:41 +00:00
|
|
|
files_type(initrc_state_t)
|
2005-04-22 22:00:09 +00:00
|
|
|
|
|
|
|
type initrc_tmp_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_tmp_file(initrc_tmp_t)
|
2005-04-22 22:00:09 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Init local policy
|
|
|
|
#
|
|
|
|
|
2005-05-31 21:25:45 +00:00
|
|
|
# Use capabilities. old rule:
|
|
|
|
allow init_t self:capability ~sys_module;
|
|
|
|
# is ~sys_module really needed? observed:
|
|
|
|
# sys_boot
|
|
|
|
# sys_tty_config
|
|
|
|
# kill: now provided by domain_kill_all_domains()
|
|
|
|
# setuid (from /sbin/shutdown)
|
2005-06-13 17:35:46 +00:00
|
|
|
# sys_chroot (from /usr/bin/chroot): now provided by corecmd_chroot_exec_chroot()
|
2005-05-31 21:25:45 +00:00
|
|
|
|
2005-06-09 14:50:48 +00:00
|
|
|
allow init_t self:fifo_file rw_file_perms;
|
2005-05-26 20:38:45 +00:00
|
|
|
|
2005-04-19 18:58:16 +00:00
|
|
|
# Re-exec itself
|
2005-05-30 21:17:20 +00:00
|
|
|
allow init_t init_exec_t:file { getattr read ioctl execute execute_no_trans };
|
2005-04-19 18:58:16 +00:00
|
|
|
|
|
|
|
# For /var/run/shutdown.pid.
|
|
|
|
allow init_t init_var_run_t:file { create getattr read append write setattr unlink };
|
2005-06-13 17:35:46 +00:00
|
|
|
files_create_pid(init_t,init_var_run_t)
|
2005-04-19 18:58:16 +00:00
|
|
|
|
2005-05-25 20:58:21 +00:00
|
|
|
allow init_t initctl_t:fifo_file { create getattr read append write setattr unlink };
|
2005-06-10 01:01:13 +00:00
|
|
|
fs_associate_tmpfs(initctl_t)
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_create_dev_node(init_t,initctl_t,fifo_file)
|
2005-05-25 20:58:21 +00:00
|
|
|
|
2005-05-31 21:25:45 +00:00
|
|
|
# Modify utmp.
|
2005-06-10 01:01:13 +00:00
|
|
|
allow init_t initrc_var_run_t:file { rw_file_perms setattr };
|
2005-05-31 21:25:45 +00:00
|
|
|
|
2005-06-09 20:50:17 +00:00
|
|
|
# Run init scripts.
|
|
|
|
domain_auto_trans(init_t,initrc_exec_t,initrc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
kernel_read_system_state(init_t)
|
|
|
|
kernel_share_state(init_t)
|
2005-09-12 15:17:39 +00:00
|
|
|
kernel_sigchld_from(init_t)
|
|
|
|
# If you load a new policy that removes active domains, processes can
|
|
|
|
# get stuck if you do not allow unlabeled processes to signal init.
|
|
|
|
# If you load an incompatible policy, you should probably reboot,
|
|
|
|
# since you may have compromised system security.
|
|
|
|
kernel_sigchld_from_unlabeled(init_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-16 20:33:51 +00:00
|
|
|
dev_read_sysfs(init_t)
|
|
|
|
|
|
|
|
selinux_set_boolean(init_t)
|
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
term_use_all_terms(init_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-07-13 18:29:08 +00:00
|
|
|
corecmd_exec_chroot(init_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
corecmd_exec_bin(init_t)
|
|
|
|
corecmd_exec_sbin(init_t)
|
2005-05-24 22:22:26 +00:00
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
domain_kill_all_domains(init_t)
|
2005-05-27 20:44:05 +00:00
|
|
|
domain_signal_all_domains(init_t)
|
|
|
|
domain_signull_all_domains(init_t)
|
|
|
|
domain_sigstop_all_domains(init_t)
|
|
|
|
domain_sigstop_all_domains(init_t)
|
|
|
|
domain_sigchld_all_domains(init_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-29 14:26:41 +00:00
|
|
|
files_read_etc_files(init_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_rw_generic_pids(init_t)
|
|
|
|
files_dontaudit_search_isid_type_dir(init_t)
|
|
|
|
files_manage_etc_runtime_files(init_t)
|
2005-05-30 21:17:20 +00:00
|
|
|
# Run /etc/X11/prefdm:
|
2005-06-29 14:26:41 +00:00
|
|
|
files_exec_etc_files(init_t)
|
2005-05-24 22:22:26 +00:00
|
|
|
# file descriptors inherited from the rootfs:
|
2005-06-13 17:35:46 +00:00
|
|
|
files_dontaudit_rw_root_file(init_t)
|
|
|
|
files_dontaudit_rw_root_chr_dev(init_t)
|
2005-04-19 18:58:16 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
libs_use_ld_so(init_t)
|
|
|
|
libs_use_shared_libs(init_t)
|
|
|
|
libs_rw_ld_so_cache(init_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
logging_send_syslog_msg(init_t)
|
|
|
|
logging_rw_generic_logs(init_t)
|
2005-04-19 20:43:44 +00:00
|
|
|
|
2005-06-14 20:48:34 +00:00
|
|
|
seutil_read_config(init_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
miscfiles_read_localization(init_t)
|
|
|
|
|
2005-06-07 18:45:47 +00:00
|
|
|
ifdef(`distro_redhat',`
|
2005-06-29 20:53:53 +00:00
|
|
|
fs_use_tmpfs_chr_dev(init_t)
|
2005-06-10 01:01:13 +00:00
|
|
|
fs_create_tmpfs_data(init_t,initctl_t,fifo_file)
|
2005-05-24 22:22:26 +00:00
|
|
|
')
|
|
|
|
|
2005-09-12 21:40:56 +00:00
|
|
|
ifdef(`targeted_policy',`
|
|
|
|
unconfined_domain_template(init_t)
|
|
|
|
')
|
|
|
|
|
2005-05-31 21:25:45 +00:00
|
|
|
optional_policy(`authlogin.te',`
|
2005-06-13 17:35:46 +00:00
|
|
|
auth_rw_login_records(init_t)
|
2005-05-31 21:25:45 +00:00
|
|
|
')
|
|
|
|
|
2005-09-08 17:12:38 +00:00
|
|
|
optional_policy(`portmap.te',`
|
|
|
|
portmap_udp_sendto(init_t)
|
|
|
|
')
|
|
|
|
|
2005-05-26 20:38:45 +00:00
|
|
|
# Run the shell in the sysadm_t domain for single-user mode.
|
|
|
|
optional_policy(`userdomain.te',`
|
2005-06-13 17:35:46 +00:00
|
|
|
userdom_shell_domtrans_sysadm(init_t)
|
2005-05-26 20:38:45 +00:00
|
|
|
')
|
|
|
|
|
2005-04-22 22:00:09 +00:00
|
|
|
########################################
|
2005-04-19 18:58:16 +00:00
|
|
|
#
|
2005-04-22 22:00:09 +00:00
|
|
|
# Init script local policy
|
2005-04-19 18:58:16 +00:00
|
|
|
#
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
allow initrc_t self:process { getpgid setsched setpgid setrlimit getsched };
|
|
|
|
allow initrc_t self:capability ~{ sys_admin sys_module };
|
|
|
|
allow initrc_t self:passwd rootok;
|
|
|
|
|
|
|
|
# Allow IPC with self
|
2005-06-09 14:50:48 +00:00
|
|
|
allow initrc_t self:unix_dgram_socket create_socket_perms;
|
2005-04-14 20:18:17 +00:00
|
|
|
allow initrc_t self:unix_stream_socket { create listen accept ioctl read getattr write setattr append bind connect getopt setopt shutdown connectto };
|
2005-06-09 14:50:48 +00:00
|
|
|
allow initrc_t self:tcp_socket create_stream_socket_perms;
|
|
|
|
allow initrc_t self:udp_socket create_socket_perms;
|
|
|
|
allow initrc_t self:fifo_file rw_file_perms;
|
|
|
|
allow initrc_t self:netlink_route_socket r_netlink_socket_perms;
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-05-26 20:38:45 +00:00
|
|
|
allow initrc_t init_t:fd use;
|
|
|
|
|
2005-05-30 21:17:20 +00:00
|
|
|
allow initrc_t initrc_exec_t:file { getattr read ioctl execute execute_no_trans };
|
|
|
|
|
2005-06-09 14:50:48 +00:00
|
|
|
allow initrc_t initrc_state_t:dir create_dir_perms;
|
|
|
|
allow initrc_t initrc_state_t:file create_file_perms;
|
2005-04-14 20:18:17 +00:00
|
|
|
allow initrc_t initrc_state_t:lnk_file { create read getattr setattr unlink rename };
|
|
|
|
|
2005-06-09 14:50:48 +00:00
|
|
|
allow initrc_t initrc_var_run_t:file create_file_perms;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_create_pid(initrc_t,initrc_var_run_t)
|
2005-05-11 19:36:36 +00:00
|
|
|
|
2005-06-09 14:50:48 +00:00
|
|
|
allow initrc_t initrc_tmp_t:file create_file_perms;
|
|
|
|
allow initrc_t initrc_tmp_t:dir create_dir_perms;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_create_tmp_files(initrc_t,initrc_tmp_t, { file dir })
|
2005-05-05 18:30:00 +00:00
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
kernel_read_system_state(initrc_t)
|
|
|
|
kernel_read_software_raid_state(initrc_t)
|
|
|
|
kernel_read_network_state(initrc_t)
|
|
|
|
kernel_read_ring_buffer(initrc_t)
|
|
|
|
kernel_change_ring_buffer_level(initrc_t)
|
|
|
|
kernel_clear_ring_buffer(initrc_t)
|
|
|
|
kernel_get_sysvipc_info(initrc_t)
|
2005-06-14 19:56:46 +00:00
|
|
|
dev_read_sysfs(initrc_t)
|
|
|
|
dev_rw_sysfs(initrc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
kernel_read_all_sysctl(initrc_t)
|
2005-06-10 01:01:13 +00:00
|
|
|
kernel_rw_all_sysctl(initrc_t)
|
2005-06-14 20:48:34 +00:00
|
|
|
selinux_get_enforce_mode(initrc_t)
|
2005-06-14 19:56:46 +00:00
|
|
|
dev_list_usbfs(initrc_t)
|
2005-05-02 21:02:14 +00:00
|
|
|
# for lsof which is used by alsa shutdown:
|
2005-06-10 01:01:13 +00:00
|
|
|
kernel_dontaudit_getattr_message_if(initrc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-05-19 21:06:06 +00:00
|
|
|
bootloader_read_kernel_symbol_table(initrc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
corenet_tcp_sendrecv_all_if(initrc_t)
|
|
|
|
corenet_raw_sendrecv_all_if(initrc_t)
|
|
|
|
corenet_udp_sendrecv_all_if(initrc_t)
|
|
|
|
corenet_tcp_sendrecv_all_nodes(initrc_t)
|
|
|
|
corenet_raw_sendrecv_all_nodes(initrc_t)
|
|
|
|
corenet_udp_sendrecv_all_nodes(initrc_t)
|
|
|
|
corenet_tcp_sendrecv_all_ports(initrc_t)
|
|
|
|
corenet_udp_sendrecv_all_ports(initrc_t)
|
|
|
|
corenet_tcp_bind_all_nodes(initrc_t)
|
|
|
|
corenet_udp_bind_all_nodes(initrc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_read_rand(initrc_t)
|
|
|
|
dev_read_urand(initrc_t)
|
|
|
|
dev_write_rand(initrc_t)
|
|
|
|
dev_write_urand(initrc_t)
|
|
|
|
dev_read_framebuffer(initrc_t)
|
|
|
|
dev_read_realtime_clock(initrc_t)
|
|
|
|
dev_read_snd_mixer_dev(initrc_t)
|
|
|
|
dev_write_snd_mixer_dev(initrc_t)
|
|
|
|
dev_setattr_all_chr_files(initrc_t)
|
|
|
|
dev_read_lvm_control(initrc_t)
|
|
|
|
dev_delete_lvm_control(initrc_t)
|
2005-05-24 15:55:57 +00:00
|
|
|
# Wants to remove udev.tbl:
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_del_generic_symlinks(initrc_t)
|
2005-04-22 19:31:32 +00:00
|
|
|
|
2005-06-08 13:12:00 +00:00
|
|
|
fs_register_binary_executable_type(initrc_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
# cjp: not sure why these are here; should use mount policy
|
2005-06-08 13:12:00 +00:00
|
|
|
fs_mount_all_fs(initrc_t)
|
|
|
|
fs_unmount_all_fs(initrc_t)
|
|
|
|
fs_remount_all_fs(initrc_t)
|
2005-06-10 01:01:13 +00:00
|
|
|
fs_getattr_all_fs(initrc_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
storage_getattr_fixed_disk(initrc_t)
|
|
|
|
storage_setattr_fixed_disk(initrc_t)
|
2005-06-13 20:00:36 +00:00
|
|
|
storage_setattr_removable_device(initrc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
term_use_all_terms(initrc_t)
|
|
|
|
term_reset_tty_labels(initrc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
auth_rw_login_records(initrc_t)
|
|
|
|
auth_rw_lastlog(initrc_t)
|
|
|
|
auth_read_pam_pid(initrc_t)
|
|
|
|
auth_delete_pam_pid(initrc_t)
|
|
|
|
auth_list_pam_console_data(initrc_t)
|
2005-05-26 20:38:45 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
corecmd_exec_bin(initrc_t)
|
|
|
|
corecmd_exec_sbin(initrc_t)
|
|
|
|
corecmd_exec_shell(initrc_t)
|
|
|
|
corecmd_exec_ls(initrc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-05-05 17:44:11 +00:00
|
|
|
domain_kill_all_domains(initrc_t)
|
2005-05-30 21:17:20 +00:00
|
|
|
domain_signal_all_domains(initrc_t)
|
|
|
|
domain_signull_all_domains(initrc_t)
|
|
|
|
domain_sigstop_all_domains(initrc_t)
|
|
|
|
domain_sigstop_all_domains(initrc_t)
|
|
|
|
domain_sigchld_all_domains(initrc_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_read_all_domains_state(initrc_t)
|
|
|
|
domain_getsession_all_domains(initrc_t)
|
|
|
|
domain_use_wide_inherit_fd(initrc_t)
|
2005-09-01 20:13:42 +00:00
|
|
|
domain_exec_all_entry_files(initrc_t)
|
2005-05-30 21:17:20 +00:00
|
|
|
# for lsof which is used by alsa shutdown:
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_dontaudit_getattr_all_udp_sockets(initrc_t)
|
|
|
|
domain_dontaudit_getattr_all_tcp_sockets(initrc_t)
|
|
|
|
domain_dontaudit_getattr_all_unix_dgram_sockets(initrc_t)
|
|
|
|
domain_dontaudit_getattr_all_unnamed_pipes(initrc_t)
|
|
|
|
|
2005-07-15 15:17:57 +00:00
|
|
|
files_getattr_all_dirs(initrc_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_getattr_all_files(initrc_t)
|
2005-07-15 15:17:57 +00:00
|
|
|
files_getattr_all_symlinks(initrc_t)
|
|
|
|
files_getattr_all_pipes(initrc_t)
|
|
|
|
files_getattr_all_sockets(initrc_t)
|
2005-08-05 15:32:27 +00:00
|
|
|
files_purge_tmp(initrc_t)
|
2005-06-29 14:26:41 +00:00
|
|
|
files_delete_all_locks(initrc_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_read_all_pids(initrc_t)
|
|
|
|
files_delete_all_pids(initrc_t)
|
2005-06-29 14:26:41 +00:00
|
|
|
files_read_etc_files(initrc_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_manage_etc_runtime_files(initrc_t)
|
2005-06-29 14:26:41 +00:00
|
|
|
files_manage_generic_locks(initrc_t)
|
|
|
|
files_exec_etc_files(initrc_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_read_usr_files(initrc_t)
|
|
|
|
files_manage_urandom_seed(initrc_t)
|
2005-06-29 14:26:41 +00:00
|
|
|
files_manage_generic_spools(initrc_t)
|
2005-07-08 20:44:57 +00:00
|
|
|
# Mount and unmount file systems.
|
|
|
|
# cjp: not sure why these are here; should use mount policy
|
|
|
|
files_list_isid_type_dir(initrc_t)
|
|
|
|
files_mounton_isid_type_dir(initrc_t)
|
|
|
|
files_list_default(initrc_t)
|
|
|
|
files_mounton_default(initrc_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
|
|
|
|
libs_rw_ld_so_cache(initrc_t)
|
|
|
|
libs_use_ld_so(initrc_t)
|
|
|
|
libs_use_shared_libs(initrc_t)
|
|
|
|
libs_exec_lib_files(initrc_t)
|
|
|
|
|
|
|
|
logging_send_syslog_msg(initrc_t)
|
|
|
|
logging_rw_generic_logs(initrc_t)
|
2005-05-26 20:38:45 +00:00
|
|
|
logging_read_all_logs(initrc_t)
|
|
|
|
logging_append_all_logs(initrc_t)
|
2005-04-19 20:43:44 +00:00
|
|
|
|
2005-05-26 20:38:45 +00:00
|
|
|
miscfiles_read_localization(initrc_t)
|
2005-04-25 21:28:25 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
modutils_read_module_conf(initrc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-14 20:48:34 +00:00
|
|
|
seutil_read_config(initrc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
sysnet_read_config(initrc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
udev_rw_db(initrc_t)
|
2005-05-04 13:16:34 +00:00
|
|
|
|
2005-06-30 18:54:08 +00:00
|
|
|
userdom_read_all_user_files(initrc_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
# Allow access to the sysadm TTYs. Note that this will give access to the
|
|
|
|
# TTYs to any process in the initrc_t domain. Therefore, daemons and such
|
|
|
|
# started from init should be placed in their own domain.
|
2005-06-13 17:35:46 +00:00
|
|
|
userdom_use_sysadm_terms(initrc_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
|
2005-06-07 18:45:47 +00:00
|
|
|
ifdef(`distro_debian', `
|
2005-07-08 20:44:57 +00:00
|
|
|
dev_setattr_dev_dir(initrc_t)
|
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
fs_create_tmpfs_data(initrc_t,initrc_var_run_t,dir)
|
2005-07-08 20:44:57 +00:00
|
|
|
|
|
|
|
# for storing state under /dev/shm
|
|
|
|
fs_setattr_tmpfs_dir(initrc_t)
|
|
|
|
storage_create_fixed_disk_tmpfs(initrc_t)
|
|
|
|
|
|
|
|
files_setattr_etc_dir(initrc_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
')
|
|
|
|
|
2005-09-02 14:52:08 +00:00
|
|
|
ifdef(`distro_gentoo',`
|
|
|
|
optional_policy(`dhcp.te',`
|
|
|
|
dhcpd_setattr_state_files(initrc_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2005-06-07 18:45:47 +00:00
|
|
|
ifdef(`distro_redhat',`
|
2005-06-01 13:51:54 +00:00
|
|
|
# this is from kmodule, which should get its own policy:
|
|
|
|
allow initrc_t self:capability sys_admin;
|
|
|
|
|
2005-05-31 23:02:11 +00:00
|
|
|
# Red Hat systems seem to have a stray
|
|
|
|
# fd open from the initrd
|
2005-06-10 01:01:13 +00:00
|
|
|
kernel_dontaudit_use_fd(initrc_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_dontaudit_read_root_file(initrc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-14 20:48:34 +00:00
|
|
|
selinux_set_enforce_mode(initrc_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
|
2005-05-31 23:02:11 +00:00
|
|
|
# Create and read /boot/kernel.h and /boot/System.map.
|
|
|
|
# Redhat systems typically create this file at boot time.
|
2005-06-14 17:36:21 +00:00
|
|
|
bootloader_create_runtime_file(initrc_t)
|
|
|
|
bootloader_rw_boot_symlinks(initrc_t)
|
2005-05-30 21:17:20 +00:00
|
|
|
|
2005-05-31 23:02:11 +00:00
|
|
|
# These seem to be from the initrd
|
|
|
|
# during device initialization:
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_create_dir(initrc_t)
|
|
|
|
dev_rwx_zero_dev(initrc_t)
|
|
|
|
dev_rx_raw_memory(initrc_t)
|
|
|
|
dev_wx_raw_memory(initrc_t)
|
2005-05-31 23:02:11 +00:00
|
|
|
storage_raw_read_fixed_disk(initrc_t)
|
|
|
|
storage_raw_write_fixed_disk(initrc_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
|
2005-06-29 20:53:53 +00:00
|
|
|
fs_use_tmpfs_chr_dev(initrc_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
|
2005-05-31 23:02:11 +00:00
|
|
|
files_create_boot_flag(initrc_t)
|
|
|
|
|
|
|
|
# readahead asks for these
|
2005-06-13 17:35:46 +00:00
|
|
|
mta_read_aliases(initrc_t)
|
2005-06-01 13:51:54 +00:00
|
|
|
')
|
2005-05-13 14:37:13 +00:00
|
|
|
|
2005-07-08 20:44:57 +00:00
|
|
|
ifdef(`targeted_policy',`
|
2005-07-19 20:26:02 +00:00
|
|
|
unconfined_domain_template(initrc_t)
|
2005-07-08 20:44:57 +00:00
|
|
|
unconfined_shell_domtrans(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-08-23 17:26:19 +00:00
|
|
|
optional_policy(`bind.te',`
|
|
|
|
bind_read_config(initrc_t)
|
|
|
|
|
|
|
|
# for chmod in start script
|
|
|
|
bind_setattr_pid_dir(initrc_t)
|
|
|
|
|
|
|
|
# for /etc/rndc.key
|
|
|
|
ifdef(`distro_redhat',`
|
|
|
|
# Allow init script to cp localtime to named_conf_t
|
|
|
|
bind_write_config(initrc_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
')
|
|
|
|
|
2005-08-17 21:28:31 +00:00
|
|
|
optional_policy(`gpm.te',`
|
|
|
|
gpm_setattr_gpmctl(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-05-19 21:06:06 +00:00
|
|
|
optional_policy(`hotplug.te',`
|
2005-06-14 19:56:46 +00:00
|
|
|
dev_read_usbfs(initrc_t)
|
2005-05-31 23:02:11 +00:00
|
|
|
|
|
|
|
# init scripts run /etc/hotplug/usb.rc
|
|
|
|
hotplug_read_config(initrc_t)
|
|
|
|
|
2005-06-29 14:26:41 +00:00
|
|
|
modutils_read_mods_deps(initrc_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
')
|
|
|
|
|
2005-09-08 13:23:11 +00:00
|
|
|
optional_policy(`inn.te',`
|
|
|
|
inn_exec_config(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-07-18 18:31:49 +00:00
|
|
|
optional_policy(`ipsec.te',`
|
|
|
|
ipsec_read_config(initrc_t)
|
|
|
|
ipsec_manage_pid(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-07-01 13:31:34 +00:00
|
|
|
optional_policy(`kerberos.te',`
|
|
|
|
kerberos_use(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-08-17 18:33:43 +00:00
|
|
|
optional_policy(`ldap.te',`
|
|
|
|
ldap_read_config(initrc_t)
|
|
|
|
ldap_list_db_dir(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-08-15 14:46:17 +00:00
|
|
|
optional_policy(`loadkeys.te',`
|
|
|
|
loadkeys_exec(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-05-30 21:17:20 +00:00
|
|
|
optional_policy(`lvm.te',`
|
2005-05-31 23:02:11 +00:00
|
|
|
#allow initrc_t lvm_control_t:chr_file unlink;
|
|
|
|
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_read_lvm_control(initrc_t)
|
|
|
|
dev_create_generic_chr_file(initrc_t)
|
2005-05-30 21:17:20 +00:00
|
|
|
')
|
|
|
|
|
2005-07-08 20:44:57 +00:00
|
|
|
optional_policy(`mta.te',`
|
|
|
|
mta_dontaudit_read_spool_symlink(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-08-03 17:56:26 +00:00
|
|
|
optional_policy(`mysql.te',`
|
|
|
|
ifdef(`distro_redhat',`
|
|
|
|
mysql_manage_db_dir(initrc_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
mysql_stream_connect(initrc_t)
|
|
|
|
mysql_write_log(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-06-24 20:37:09 +00:00
|
|
|
optional_policy(`nis.te',`
|
|
|
|
nis_udp_sendto_ypbind(initrc_t)
|
|
|
|
nis_list_var_yp(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-07-18 18:31:49 +00:00
|
|
|
optional_policy(`raid.te',`
|
|
|
|
raid_manage_mdadm_pid(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-08-11 14:49:58 +00:00
|
|
|
optional_policy(`quota.te',`
|
|
|
|
quota_manage_flags(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-05-26 20:38:45 +00:00
|
|
|
optional_policy(`rhgb.te',`
|
2005-06-13 17:35:46 +00:00
|
|
|
corecmd_shell_entry_type(initrc_t)
|
2005-05-26 20:38:45 +00:00
|
|
|
')
|
|
|
|
|
2005-05-24 15:55:57 +00:00
|
|
|
optional_policy(`rpm.te',`
|
2005-05-31 23:02:11 +00:00
|
|
|
# bash tries to access a block device in the initrd
|
2005-06-10 01:01:13 +00:00
|
|
|
kernel_dontaudit_getattr_unlabeled_blk_dev(initrc_t)
|
2005-05-31 23:02:11 +00:00
|
|
|
|
|
|
|
# for a bug in rm
|
2005-06-13 17:35:46 +00:00
|
|
|
files_dontaudit_write_all_pids(initrc_t)
|
2005-05-31 23:02:11 +00:00
|
|
|
|
|
|
|
# bash tries ioctl for some reason
|
2005-06-13 17:35:46 +00:00
|
|
|
files_dontaudit_ioctl_all_pids(initrc_t)
|
2005-05-31 23:02:11 +00:00
|
|
|
|
|
|
|
# why is this needed:
|
2005-06-13 17:35:46 +00:00
|
|
|
rpm_manage_db(initrc_t)
|
2005-07-08 20:44:57 +00:00
|
|
|
')
|
2005-05-24 15:55:57 +00:00
|
|
|
|
2005-09-02 19:11:07 +00:00
|
|
|
optional_policy(`squid.te',`
|
|
|
|
squid_read_config(initrc_t)
|
|
|
|
squid_manage_logs(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-06-22 21:14:48 +00:00
|
|
|
optional_policy(`ssh.te',`
|
|
|
|
optional_policy(`inetd.te',`
|
|
|
|
tunable_policy(`run_ssh_inetd',`',`
|
|
|
|
ssh_dontaudit_read_server_keys(initrc_t)
|
|
|
|
')
|
|
|
|
',`
|
|
|
|
ssh_dontaudit_read_server_keys(initrc_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2005-06-29 20:53:53 +00:00
|
|
|
optional_policy(`sysnetwork.te',`
|
|
|
|
ifdef(`distro_redhat',`
|
|
|
|
sysnet_rw_dhcp_config(initrc_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
sysnet_read_dhcpc_state(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-09-09 13:24:11 +00:00
|
|
|
optional_policy(`zebra.te',`
|
|
|
|
zebra_read_config(initrc_t)
|
|
|
|
')
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
ifdef(`TODO',`
|
|
|
|
# Set device ownerships/modes.
|
|
|
|
allow initrc_t xconsole_device_t:fifo_file setattr;
|
|
|
|
|
2005-08-31 20:58:12 +00:00
|
|
|
allow initrc_t system_dbusd_t:dbus { send_msg acquire_svc };
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
# These rules are here to allow init scripts to su
|
|
|
|
#
|
2005-05-02 19:22:58 +00:00
|
|
|
optional_policy(`su.te', `
|
2005-04-14 20:18:17 +00:00
|
|
|
su_restricted_domain(initrc,system)
|
|
|
|
role system_r types initrc_su_t;
|
|
|
|
')
|
|
|
|
|
2005-06-07 18:45:47 +00:00
|
|
|
ifdef(`distro_redhat', `
|
2005-05-31 23:02:11 +00:00
|
|
|
# readahead asks for these
|
2005-06-09 14:50:48 +00:00
|
|
|
allow initrc_t var_lib_nfs_t:file r_file_perms;
|
2005-05-31 23:02:11 +00:00
|
|
|
')
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-07-08 20:44:57 +00:00
|
|
|
ifdef(`targeted_policy',`
|
2005-05-31 23:02:11 +00:00
|
|
|
allow unconfined_t initrc_t:dbus { acquire_svc send_msg };
|
|
|
|
allow initrc_t unconfined_t:dbus { acquire_svc send_msg };
|
|
|
|
')
|
2005-04-22 22:00:09 +00:00
|
|
|
') dnl end TODO
|