policy_module(init, 1.20.1) gen_require(` class passwd rootok; ') ######################################## # # Declarations # ## ##

## Dontaudit all daemons scheduling requests (setsched, sys_nice). ##

##
gen_tunable(daemons_dontaudit_scheduling, true) ## ##

## Allow all daemons to use tcp wrappers. ##

##
gen_tunable(daemons_use_tcp_wrapper, false) ## ##

## Allow all daemons the ability to read/write terminals ##

##
gen_tunable(daemons_use_tty, false) ## ##

## Allow all daemons to write corefiles to / ##

##
gen_tunable(daemons_dump_core, false) ## ##

## Enable cluster mode for daemons. ##

##
gen_tunable(daemons_enable_cluster_mode, false) ## ##

## Enable init create, setattr, mounton on non_security_file_type ##

##
gen_tunable(init_create_dirs, true) ## ##

## Allow init audit_control capability ##

##
gen_tunable(init_audit_control, false) # used for direct running of init scripts # by admin domains attribute direct_run_init; attribute direct_init; attribute direct_init_entry; attribute init_script_domain_type; attribute init_script_file_type; attribute init_run_all_scripts_domain; attribute initrc_transition_domain; # Attribute used for systemd so domains can allow systemd to create sock_files attribute init_sock_file_type; # Attribute for directories that systemd will watch based on path units # (see systemd.path(5) for more info) (Deprecated) attribute init_watch_path_type; # Mark process types as daemons attribute daemon; attribute systemprocess; attribute systemprocess_entry; # Mark process types as initrc domain attribute initrc_domain; # Mark file type as a daemon run directory attribute daemonrundir; # # init_t is the domain of the init process. # type init_t, initrc_transition_domain; type init_exec_t; domain_type(init_t) domain_entry_file(init_t, init_exec_t) domain_role_change_exemption(init_t) domain_subj_id_change_exemption(init_t) domain_obj_id_change_exemption(init_t) kernel_domtrans_to(init_t, init_exec_t) role system_r types init_t; init_initrc_domain(init_t) corecmd_shell_entry_type(init_t) # # init_tmp_t is the type for content in /tmp directory # type init_tmp_t; files_tmp_file(init_tmp_t) # # init_var_run_t is the type for /var/run/shutdown.pid. # type init_var_run_t; files_pid_file(init_var_run_t) # # init_var_lib_t is the type for /var/lib/systemd # type init_var_lib_t; files_type(init_var_lib_t) type machineid_t; files_config_file(machineid_t) # # initctl_t is the type of the named pipe created # by init during initialization. This pipe is used # to communicate with init. # type initctl_t; files_type(initctl_t) mls_trusted_object(initctl_t) type initrc_t, initrc_domain, init_script_domain_type, init_run_all_scripts_domain; type initrc_exec_t, init_script_file_type; domain_type(initrc_t) domain_entry_file(initrc_t, initrc_exec_t) role system_r types initrc_t; # should be part of the true block # of the below init_upstart tunable # but this has a typeattribute in it corecmd_shell_entry_type(initrc_t) corecmd_bin_entry_type(initrc_t) type initrc_devpts_t; term_pty(initrc_devpts_t) files_type(initrc_devpts_t) type initrc_state_t; files_type(initrc_state_t) type initrc_tmp_t; files_tmp_file(initrc_tmp_t) type initrc_var_log_t; logging_log_file(initrc_var_log_t) type initrc_var_run_t; files_pid_file(initrc_var_run_t) ifdef(`distro_gentoo',` type rc_exec_t; domain_entry_file(initrc_t, rc_exec_t) ') ifdef(`enable_mls',` kernel_ranged_domtrans_to(init_t, init_exec_t, s0 - mls_systemhigh) ') ######################################## # # Init local policy # # Use capabilities. old rule: allow init_t self:capability ~{ audit_control audit_write sys_module }; allow init_t self:capability2 ~{ mac_admin mac_override }; allow init_t self:cap_userns all_cap_userns_perms; allow init_t self:tcp_socket { listen accept }; allow init_t self:packet_socket create_socket_perms; allow init_t self:key manage_key_perms; allow init_t self:bpf { map_create map_read map_write prog_load prog_run }; # is ~sys_module really needed? observed: # sys_boot # sys_tty_config # kill: now provided by domain_kill_all_domains() # setuid (from /sbin/shutdown) # sys_chroot (from /usr/bin/chroot): now provided by corecmd_chroot_exec_chroot() allow init_t self:file mounton; allow init_t self:fifo_file rw_fifo_file_perms; allow init_t self:service manage_service_perms; allow init_t self:user_namespace create; # Re-exec itself can_exec(init_t, init_exec_t) # executing content in /run/initramfs manage_files_pattern(init_t, initrc_state_t, initrc_state_t) can_exec(init_t, initrc_state_t) allow daemon initrc_t:unix_dgram_socket sendto; allow init_t initrc_t:unix_stream_socket { connectto create_stream_socket_perms }; allow init_t initrc_t:tcp_socket create_stream_socket_perms; allow initrc_t init_t:unix_stream_socket { connectto rw_stream_socket_perms sendto }; allow initrc_t init_t:fifo_file rw_fifo_file_perms; manage_files_pattern(init_t, init_tmp_t, init_tmp_t) manage_dirs_pattern(init_t, init_tmp_t, init_tmp_t) manage_lnk_files_pattern(init_t, init_tmp_t, init_tmp_t) manage_sock_files_pattern(init_t, init_tmp_t, init_tmp_t) files_tmp_filetrans(init_t, init_tmp_t, { file sock_file }) allow init_t init_tmp_t:file map; manage_dirs_pattern(init_t, init_var_lib_t, init_var_lib_t) manage_files_pattern(init_t, init_var_lib_t, init_var_lib_t) manage_lnk_files_pattern(init_t, init_var_lib_t, init_var_lib_t) manage_sock_files_pattern(init_t, init_var_lib_t, init_var_lib_t) files_var_lib_filetrans(init_t, init_var_lib_t, { dir file }) allow init_t init_var_lib_t:dir mounton; allow init_t init_var_lib_t:file map; manage_dirs_pattern(init_t, init_var_run_t, init_var_run_t) manage_files_pattern(init_t, init_var_run_t, init_var_run_t) manage_lnk_files_pattern(init_t, init_var_run_t, init_var_run_t) manage_sock_files_pattern(init_t, init_var_run_t, init_var_run_t) manage_fifo_files_pattern(init_t, init_var_run_t, init_var_run_t) manage_blk_files_pattern(init_t, init_var_run_t, init_var_run_t) manage_chr_files_pattern(init_t, init_var_run_t, init_var_run_t) files_pid_filetrans(init_t, init_var_run_t, { dir file blk_file chr_file fifo_file}) allow init_t init_var_run_t:dir mounton; allow init_t init_var_run_t:file mounton; allow init_t init_var_run_t:sock_file relabelto; allow init_t init_var_run_t:blk_file { getattr relabelto }; allow init_t init_var_run_t:chr_file { getattr relabelto }; allow init_t init_var_run_t:fifo_file { getattr relabelto }; allow init_t machineid_t:file manage_file_perms; files_pid_filetrans(init_t, machineid_t, file, "machine-id") files_etc_filetrans(init_t, machineid_t, file, "machine-id") allow init_t machineid_t:file mounton; allow init_t initctl_t:fifo_file manage_fifo_file_perms; dev_filetrans(init_t, initctl_t, fifo_file) # Modify utmp. allow init_t initrc_var_run_t:file { rw_file_perms setattr }; kernel_read_system_state(init_t) kernel_share_state(init_t) kernel_stream_connect(init_t) kernel_rw_stream_socket_perms(init_t) kernel_rw_unix_dgram_sockets(init_t) kernel_mounton_systemd_ProtectKernelTunables(init_t) kernel_read_core_if(init_t) kernel_mounton_core_if(init_t) kernel_mounton_all_sysctls(init_t) kernel_get_sysvipc_info(init_t) kernel_load_module(init_t) kernel_read_all_proc(init_t) kernel_list_all_proc(init_t) kernel_mounton_all_proc(init_t) # There is bug in kernel in 4.16 where lot of domains requesting module_request, for now dontauditing kernel_dontaudit_request_load_module(init_t) corecmd_exec_chroot(init_t) corecmd_exec_bin(init_t) corenet_all_recvfrom_netlabel(init_t) corenet_tcp_bind_all_ports(init_t) corenet_udp_bind_all_ports(init_t) dev_create_all_files(init_t) dev_create_all_chr_files(init_t) dev_list_sysfs(init_t) dev_manage_sysfs(init_t) dev_mounton_all_device_nodes(init_t) dev_setattr_all_blk_files(init_t) dev_setattr_all_chr_files(init_t) dev_read_urand(init_t) dev_read_raw_memory(init_t) # Early devtmpfs dev_rw_generic_chr_files(init_t) dev_filetrans_all_named_dev(init_t) dev_write_watchdog(init_t) dev_rw_inherited_input_dev(init_t) dev_rw_dri(init_t) dev_rw_tpm(init_t) domain_getpgid_all_domains(init_t) domain_kill_all_domains(init_t) domain_signal_all_domains(init_t) domain_signull_all_domains(init_t) domain_sigstop_all_domains(init_t) domain_sigchld_all_domains(init_t) domain_read_all_domains_state(init_t) domain_getattr_all_domains(init_t) domain_setrlimit_all_domains(init_t) domain_rlimitinh_all_domains(init_t) domain_noatsecure_all_domains(init_t) domain_setpriority_all_domains(init_t) files_read_config_files(init_t) files_read_all_pids(init_t) files_map_all_pids(init_t) files_read_system_conf_files(init_t) files_rw_generic_pids(init_t) files_dontaudit_search_isid_type_dirs(init_t) files_read_isid_type_files(init_t) files_read_etc_runtime_files(init_t) files_manage_all_locks(init_t) files_manage_etc_runtime_files(init_t) files_manage_etc_symlinks(init_t) files_etc_filetrans_etc_runtime(init_t, file) # Run /etc/X11/prefdm: files_exec_etc_files(init_t) files_read_usr_files(init_t) files_write_root_dirs(init_t) # file descriptors inherited from the rootfs: files_dontaudit_rw_root_files(init_t) files_dontaudit_rw_root_chr_files(init_t) files_dontaudit_mounton_modules_object(init_t) files_manage_mnt_dirs(init_t) files_manage_mnt_files(init_t) files_read_mnt_symlinks(init_t) files_mounton_etc(init_t) files_create_default_dir(init_t) files_remount_rootfs(init_t) files_create_var_dirs(init_t) files_watch_non_security_dirs(init_t) files_watch_non_security_files(init_t) files_watch_non_security_lnk_files(init_t) fs_read_efivarfs_files(init_t) fs_setattr_efivarfs_files(init_t) fs_read_nfsd_files(init_t) fstools_getattr_swap_files(init_t) mcs_process_set_categories(init_t) mls_file_read_all_levels(init_t) mls_file_write_all_levels(init_t) mls_file_downgrade(init_t) mls_file_upgrade(init_t) mls_fd_use_all_levels(init_t) mls_fd_share_all_levels(init_t) mls_process_set_level(init_t) mls_process_write_down(init_t) mls_socket_read_all_levels(init_t) mls_socket_write_all_levels(init_t) mls_rangetrans_source(init_t) selinux_set_all_booleans(init_t) selinux_load_policy(init_t) selinux_mounton_fs(init_t) allow init_t security_t:security load_policy; selinux_compute_access_vector(init_t) selinux_compute_create_context(init_t) selinux_compute_user_contexts(init_t) selinux_validate_context(init_t) selinux_compute_relabel_context(init_t) selinux_unmount_fs(init_t) term_create_pty_dir(init_t) term_use_unallocated_ttys(init_t) term_setattr_unallocated_ttys(init_t) term_use_console(init_t) term_use_all_inherited_terms(init_t) term_use_usb_ttys(init_t) term_use_all_ptys(init_t) term_setattr_all_ptys(init_t) term_use_virtio_console(init_t) term_watch_console_dev(init_t) term_watch_reads_console_dev(init_t) term_watch_unallocated_ttys(init_t) term_watch_reads_unallocated_ttys(init_t) term_watch_user_ttys(init_t) term_watch_reads_user_ttys(init_t) # Run init scripts. init_domtrans_script(init_t) init_exec_notrans_direct_init_entry(init_t) libs_rw_ld_so_cache(init_t) logging_create_devlog_dev(init_t) logging_send_syslog_msg(init_t) logging_send_audit_msgs(init_t) logging_manage_generic_logs(init_t) logging_mmap_generic_logs(init_t) logging_relabel_devlog_dev(init_t) logging_manage_audit_config(init_t) logging_create_syslog_netlink_audit_socket(init_t) logging_write_var_log_dirs(init_t) logging_manage_var_log_symlinks(init_t) seutil_read_config(init_t) seutil_read_login_config(init_t) seutil_read_default_contexts(init_t) seutil_read_module_store(init_t) miscfiles_manage_localization(init_t) miscfiles_filetrans_named_content(init_t) udev_manage_rules_files(init_t) userdom_use_user_ttys(init_t) userdom_manage_tmp_dirs(init_t) userdom_manage_tmp_sockets(init_t) userdom_delete_user_tmp_files(init_t) userdom_delete_user_home_content_files(init_t) userdom_connectto_stream(init_t) userdom_rw_inherited_user_pipes(init_t) userdom_transition_login_userdomain(init_t) userdom_nnp_transition_login_userdomain(init_t) userdom_noatsecure_login_userdomain(init_t) userdom_sigchld_login_userdomain(init_t) userdom_use_user_ptys(init_t) userdom_watch_user_ptys(init_t) userdom_watch_reads_user_ptys(init_t) allow init_t self:process setsched; ifdef(`distro_gentoo',` allow init_t self:process { getcap setcap }; init_exec_rc(initrc_t) ') ifdef(`distro_redhat',` fs_manage_tmpfs_files(init_t) fs_manage_tmpfs_symlinks(init_t) fs_manage_tmpfs_sockets(init_t) fs_manage_tmpfs_chr_files(init_t) fs_exec_tmpfs_files(init_t) fs_read_tmpfs_symlinks(init_t) fs_tmpfs_filetrans(init_t, initctl_t, fifo_file) fs_tmpfs_filetrans_named_content(init_t) fs_relabelfrom_tmpfs_lnk_files(init_t) logging_stream_connect_syslog(init_t) logging_relabel_syslog_pid_socket(init_t) ') corecmd_shell_domtrans(init_t, initrc_t) storage_raw_rw_fixed_disk(init_t) sysnet_read_dhcpc_state(init_t) optional_policy(` anaconda_stream_connect(init_t) anaconda_create_unix_stream_sockets(init_t) ') optional_policy(` bootloader_domtrans(init_t) ') optional_policy(` boltd_mounton_var_lib(init_t) boltd_mounton_var_run(init_t) ') optional_policy(` chronyd_read_keys(init_t) ') optional_policy(` devicekit_mounton_var_lib(init_t) ') optional_policy(` fwupd_delete_cache_files(init_t) ') optional_policy(` fprintd_exec(init_t) fprintd_mounton_var_lib(init_t) ') optional_policy(` apache_create_log_dirs(init_t) apache_delete_tmp(init_t) apache_noatsecure(init_t) ') optional_policy(` dirsrv_noatsecure(init_t) ') optional_policy(` journalctl_exec(init_t) ') optional_policy(` kdump_read_crash(init_t) kdump_read_config(init_t) ') optional_policy(` gnome_filetrans_home_content(init_t) gnome_manage_data(init_t) gnome_manage_config(init_t) ') optional_policy(` gssproxy_noatsecure(init_t) ') optional_policy(` rpc_gssd_noatsecure(init_t) ') optional_policy(` anaconda_domtrans_install(init_t) ') optional_policy(` ipa_delete_tmp(init_t) ') optional_policy(` rpm_read_db(init_t) rpm_script_ioctl_stream_sockets(init_t) rpm_script_rw_stream_sockets(init_t) ') optional_policy(` iscsi_read_lib_files(init_t) iscsi_manage_lock(init_t) ') optional_policy(` modutils_domtrans_kmod(init_t) modutils_list_module_config(init_t) modutils_read_module_config(init_t) modutils_read_module_deps_files(init_t) ') optional_policy(` postfix_exec(init_t) postfix_list_spool(init_t) mta_getattr_spool(init_t) mta_read_config(init_t) mta_manage_aliases(init_t) ') optional_policy(` raid_manage_mdadm_pid(init_t) raid_relabel_mdadm_var_run_content(init_t) raid_stream_connect(init_t) ') optional_policy(` systemd_allow_mount_dir(init_t) systemd_allow_create_mount_dir(init_t) systemd_hostnamed_delete_config(init_t) ') optional_policy(` tangd_read_db_files(init_t) ') tunable_policy(`use_virtualbox',` logging_create_generic_logs(init_t) ') tunable_policy(`init_create_dirs',` files_create_non_security_dirs(init_t) files_mounton_non_security(init_t) files_setattr_non_security_dirs(init_t) ') tunable_policy(`init_audit_control',` allow init_t self:capability audit_control; ') allow init_t self:system all_system_perms; allow init_t self:system module_load; allow init_t self:unix_dgram_socket { create_socket_perms sendto }; allow init_t self:process { setkeycreate setsockcreate setfscreate setrlimit setexec }; allow init_t self:process { getcap setcap }; allow init_t self:unix_stream_socket { create_stream_socket_perms connectto recvfrom }; allow init_t self:netlink_kobject_uevent_socket create_socket_perms; allow init_t self:netlink_selinux_socket create_socket_perms; allow init_t self:unix_dgram_socket lock; # Until systemd is fixed allow daemon init_t:socket_class_set { getopt read getattr ioctl setopt write }; allow init_t self:udp_socket create_socket_perms; allow init_t self:netlink_route_socket create_netlink_socket_perms; allow init_t initrc_t:unix_dgram_socket create_socket_perms; tunable_policy(`deny_bluetooth',`',` allow init_t self:bluetooth_socket { create_socket_perms listen }; ') kernel_list_unlabeled(init_t) kernel_read_unlabeled_lnk_files(init_t) kernel_read_network_state(init_t) kernel_rw_all_sysctls(init_t) kernel_rw_security_state(init_t) kernel_rw_usermodehelper_state(init_t) kernel_read_software_raid_state(init_t) kernel_unmount_debugfs(init_t) kernel_setsched(init_t) kernel_mounton_kernel_sysctl(init_t) dev_write_kmsg(init_t) dev_write_urand(init_t) dev_rw_lvm_control(init_t) dev_rw_autofs(init_t) dev_manage_generic_symlinks(init_t) dev_manage_generic_dirs(init_t) dev_manage_generic_files(init_t) dev_read_generic_chr_files(init_t) dev_relabel_generic_dev_dirs(init_t) dev_relabel_all_dev_nodes(init_t) dev_relabel_all_dev_files(init_t) dev_manage_sysfs_dirs(init_t) dev_relabel_sysfs_dirs(init_t) dev_rw_wireless(init_t) files_search_all(init_t) files_mounton_all_mountpoints(init_t) files_unmount_all_file_type_fs(init_t) files_remount_all_file_type_fs(init_t) files_mounton_kernel_symbol_table(init_t) files_manage_all_pid_dirs(init_t) files_write_all_pid_sockets(init_t) files_manage_etc_dirs(init_t) files_manage_generic_tmp_dirs(init_t) files_relabel_all_pid_dirs(init_t) files_relabel_all_pid_files(init_t) files_create_all_pid_sockets(init_t) files_delete_all_pids(init_t) files_exec_generic_pid_files(init_t) files_create_all_pid_pipes(init_t) files_create_all_spool_sockets(init_t) files_delete_all_spool_sockets(init_t) files_create_var_lib_dirs(init_t) files_create_var_lib_symlinks(init_t) files_read_var_lib_symlinks(init_t) files_manage_urandom_seed(init_t) files_list_locks(init_t) files_list_spool(init_t) files_list_var(init_t) files_write_var_dirs(init_t) files_manage_var_symlinks(init_t) files_setattr_var_dirs(init_t) files_list_boot(init_t) files_list_home(init_t) files_create_lock_dirs(init_t) files_relabel_all_files(init_t) files_read_kernel_modules(init_t) files_map_kernel_modules(init_t) files_dontaudit_mounton_isid(init_t) files_delete_tmp_files(init_t) files_delete_tmp_pipes(init_t) files_delete_tmp_sockets(init_t) fs_getattr_all_fs(init_t) fs_manage_cgroup_dirs(init_t) fs_manage_cgroup_files(init_t) fs_manage_bpf_dirs(init_t) fs_manage_bpf_files(init_t) fs_manage_hugetlbfs_dirs(init_t) fs_manage_tmpfs_dirs(init_t) fs_relabel_tmpfs_blk_file(init_t) fs_relabel_tmpfs_chr_file(init_t) fs_relabel_pstore_dirs(init_t) fs_relabel_tmpfs_dirs(init_t) fs_relabel_tmpfs_files(init_t) fs_relabel_tmpfs_fifo_files(init_t) fs_mount_all_fs(init_t) fs_unmount_all_fs(init_t) fs_remount_all_fs(init_t) fs_list_all(init_t) fs_list_auto_mountpoints(init_t) fs_register_binary_executable_type(init_t) fs_relabel_tmpfs_sock_file(init_t) fs_rw_tmpfs_files(init_t) fs_relabel_cgroup_dirs(init_t) fs_search_cgroup_dirs(init_t) # for network namespaces fs_read_nsfs_files(init_t) storage_getattr_removable_dev(init_t) term_relabel_ptys_dirs(init_t) auth_relabel_login_records(init_t) auth_relabel_pam_console_data_dirs(init_t) auth_manage_faillog(init_t) clock_read_adjtime(init_t) init_read_script_state(init_t) seutil_read_file_contexts(init_t) systemd_exec_systemctl(init_t) systemd_manage_home_content(init_t) systemd_manage_unit_dirs(init_t) systemd_manage_random_seed(init_t) systemd_manage_all_unit_files(init_t) systemd_logger_stream_connect(init_t) systemd_login_manage_pid_files(init_t) systemd_config_all_services(init_t) systemd_relabelto_fifo_file_passwd_run(init_t) systemd_relabel_unit_dirs(init_t) systemd_relabel_unit_files(init_t) systemd_relabel_unit_symlinks(init_t) systemd_manage_unit_dirs(initrc_t) systemd_manage_unit_symlinks(initrc_t) systemd_config_all_services(initrc_t) systemd_read_unit_files(initrc_t) systemd_login_status(init_t) systemd_map_networkd_exec_files(init_t) systemd_map_resolved_exec_files(init_t) systemd_rfkill_setattr_lib(init_t) systemd_rfkill_mounton_var_lib(init_t) systemd_rfkill_manage_lib_dirs(init_t) systemd_timedated_mounton_var_lib(init_t) systemd_mounton_inhibit_dir(init_t) systemd_timedated_manage_lib_dirs(init_t) systemd_login_mounton_pid_dirs(init_t) systemd_mounton_inherited_logind_sessions_dirs(init_t) systemd_delete_private_tmp(init_t) systemd_userdbd_stream_connect(init_t) systemd_userdbd_runtime_filetrans(init_t) systemd_userdbd_runtime_manage_symlinks(init_t) systemd_write_inherited_logind_sessions_pipes(init_t) create_sock_files_pattern(init_t, init_sock_file_type, init_sock_file_type) create_dirs_pattern(init_t, var_log_t, var_log_t) auth_use_nsswitch(init_t) auth_rw_login_records(init_t) auth_rw_lastlog(init_t) auth_domtrans_chk_passwd(init_t) auth_manage_passwd(init_t) ifdef(`distro_redhat',` # it comes from setupr scripts used in systemd unit files # has been covered by initrc_t optional_policy(` bind_manage_config_dirs(init_t) bind_manage_config(init_t) bind_write_config(init_t) bind_setattr_zone_dirs(init_t) ') optional_policy(` ipsec_read_config(init_t) ipsec_manage_pid(init_t) ipsec_stream_connect(init_t) ') optional_policy(` rpc_manage_nfs_state_data(init_t) ') optional_policy(` sysnet_relabelfrom_dhcpc_state(init_t) sysnet_setattr_dhcp_state(init_t) ') ') optional_policy(` apcupsd_read_power_files(init_t) ') optional_policy(` lvm_rw_pipes(init_t) lvm_read_config(init_t) lvm_map_config(init_t) ') optional_policy(` lldpad_relabel_tmpfs(init_t) ') optional_policy(` consolekit_manage_log(init_t) ') optional_policy(` dbus_connect_system_bus(init_t) dbus_system_bus_client(init_t) dbus_delete_pid_files(init_t) dbus_manage_session_tmp_dirs(init_t) dbus_read_pid_sock_files(init_t) dbus_watch_pid_sock_files(init_t) optional_policy(` devicekit_dbus_chat_power(init_t) ') ') optional_policy(` # /var/run/dovecot/login/ssl-parameters.dat is a hard link to # /var/lib/dovecot/ssl-parameters.dat and init tries to clean up # the directory. But we do not want to allow this. # The master process of dovecot will manage this file. dovecot_dontaudit_unlink_lib_files(initrc_t) ') optional_policy(` fprintd_read_var_lib_dir(init_t) fprintd_setattr_var_lib_dir(init_t) ') optional_policy(` ibacm_create_netlink_rdma_socket(init_t) ibacm_read_pid_files(init_t) ') optional_policy(` insights_client_rw_pipes(init_t) ') optional_policy(` mount_manage_pid_files(init_t) mount_watch_reads_pid_dirs(init_t) mount_watch_reads_pid_files(init_t) ') optional_policy(` networkmanager_stream_connect(init_t) networkmanager_stream_connect(initrc_t) ') optional_policy(` plymouthd_stream_connect(init_t) plymouthd_exec_plymouth(init_t) plymouthd_filetrans_named_content(init_t) ') optional_policy(` ssh_getattr_server_keys(init_t) ') optional_policy(` sssd_stream_connect(init_t) ') optional_policy(` rpcbind_filetrans_named_content(init_t) rpcbind_relabel_sock_file(init_t) ') optional_policy(` stratisd_data_read_lnk_files(init_t) ') optional_policy(` systemd_filetrans_named_content(init_t) systemd_write_inhibit_pipes(init_t) ') optional_policy(` sysnet_filetrans_cloud_net_conf(init_t) ') optional_policy(` tlp_filetrans_named_content(initrc_t) ') optional_policy(` udev_read_db(init_t) udev_relabelto_db(init_t) udev_create_kobject_uevent_socket(init_t) udev_relabel_pid_sockfile(init_t) ') optional_policy(` xserver_relabel_xdm_tmp_dirs(init_t) xserver_manage_xdm_tmp_dirs(init_t) xserver_read_xdm_lib_files(init_t) ') optional_policy(` domain_named_filetrans(init_t) unconfined_server_domtrans(init_t) unconfined_server_noatsecure(init_t) unconfined_server_create_tcp_sockets(init_t) unconfined_server_create_udp_sockets(init_t) unconfined_server_create_unix_sockets(init_t) ') optional_policy(` userdom_exec_user_bin_files(init_t) userdom_rw_stream(init_t) ') ######################################## # # Init script local policy # allow initrc_t self:process { getpgid setsched setpgid setrlimit getsched }; allow initrc_t self:capability ~{ sys_ptrace audit_control audit_write sys_admin sys_module }; allow initrc_t self:capability2 block_suspend; dontaudit initrc_t self:capability { sys_ptrace sys_module }; # sysctl is triggering this allow initrc_t self:passwd rootok; allow initrc_t self:key manage_key_perms; # Allow IPC with self allow initrc_t self:unix_dgram_socket create_socket_perms; allow initrc_t self:unix_stream_socket { create listen accept ioctl read getattr write setattr append bind connect getopt setopt shutdown connectto }; 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 initrc_devpts_t:chr_file rw_term_perms; term_create_pty(initrc_t, initrc_devpts_t) # Going to single user mode init_telinit(initrc_t) can_exec(initrc_t, init_script_file_type) create_dirs_pattern(initrc_t, daemonrundir, daemonrundir) setattr_dirs_pattern(initrc_t, daemonrundir, daemonrundir) domtrans_pattern(init_run_all_scripts_domain, initrc_exec_t, initrc_t) manage_dirs_pattern(initrc_t, initrc_state_t, initrc_state_t) manage_files_pattern(initrc_t, initrc_state_t, initrc_state_t) manage_lnk_files_pattern(initrc_t, initrc_state_t, initrc_state_t) manage_fifo_files_pattern(initrc_t, initrc_state_t, initrc_state_t) allow initrc_t initrc_var_run_t:file manage_file_perms; files_pid_filetrans(initrc_t, initrc_var_run_t, file) files_manage_generic_pids_symlinks(initrc_t) files_create_var_run_dirs(initrc_t) files_relabelfrom_isid_type(initrc_t) can_exec(initrc_t, initrc_tmp_t) manage_files_pattern(initrc_t, initrc_tmp_t, initrc_tmp_t) manage_dirs_pattern(initrc_t, initrc_tmp_t, initrc_tmp_t) manage_lnk_files_pattern(initrc_t, initrc_tmp_t, initrc_tmp_t) files_tmp_filetrans(initrc_t, initrc_tmp_t, { file dir }) allow initrc_t initrc_tmp_t:dir relabelfrom; manage_dirs_pattern(initrc_t, initrc_var_log_t, initrc_var_log_t) manage_files_pattern(initrc_t, initrc_var_log_t, initrc_var_log_t) logging_log_filetrans(initrc_t, initrc_var_log_t, dir) init_write_initctl(initrc_t) 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) kernel_read_all_sysctls(initrc_t) kernel_request_load_module(initrc_t) kernel_rw_all_sysctls(initrc_t) # for lsof which is used by alsa shutdown: kernel_dontaudit_getattr_message_if(initrc_t) kernel_stream_connect(initrc_t) files_read_kernel_modules(initrc_t) files_read_config_files(initrc_t) files_read_var_lib_symlinks(initrc_t) files_setattr_pid_dirs(initrc_t) files_create_lock_dirs(initrc_t) files_pid_filetrans_lock_dir(initrc_t, "lock") files_read_kernel_symbol_table(initrc_t) files_exec_etc_files(initrc_t) files_manage_etc_symlinks(initrc_t) files_manage_system_conf_files(initrc_t) fs_manage_tmpfs_dirs(initrc_t) fs_manage_tmpfs_symlinks(initrc_t) fs_delete_tmpfs_files(initrc_t) fs_tmpfs_filetrans(initrc_t, initrc_state_t, file) fs_read_nfsd_files(initrc_t) corecmd_exec_all_executables(initrc_t) corenet_all_recvfrom_netlabel(initrc_t) corenet_tcp_sendrecv_generic_if(initrc_t) corenet_udp_sendrecv_generic_if(initrc_t) corenet_tcp_sendrecv_generic_node(initrc_t) corenet_udp_sendrecv_generic_node(initrc_t) corenet_tcp_sendrecv_all_ports(initrc_t) corenet_udp_sendrecv_all_ports(initrc_t) corenet_tcp_connect_all_ports(initrc_t) corenet_sendrecv_all_client_packets(initrc_t) dev_read_rand(initrc_t) dev_read_urand(initrc_t) dev_dontaudit_read_kmsg(initrc_t) dev_write_kmsg(initrc_t) dev_write_rand(initrc_t) dev_write_urand(initrc_t) dev_write_watchdog(initrc_t) dev_rw_sysfs(initrc_t) dev_read_usbfs(initrc_t) dev_read_framebuffer(initrc_t) dev_write_framebuffer(initrc_t) dev_read_realtime_clock(initrc_t) dev_read_sound_mixer(initrc_t) dev_write_sound_mixer(initrc_t) dev_setattr_generic_dirs(initrc_t) dev_setattr_all_chr_files(initrc_t) dev_rw_lvm_control(initrc_t) dev_rw_generic_chr_files(initrc_t) dev_delete_lvm_control_dev(initrc_t) dev_manage_generic_symlinks(initrc_t) dev_manage_generic_files(initrc_t) # Wants to remove udev.tbl: dev_delete_generic_symlinks(initrc_t) dev_getattr_all_blk_files(initrc_t) dev_getattr_all_chr_files(initrc_t) dev_rw_xserver_misc(initrc_t) domain_kill_all_domains(initrc_t) domain_signal_all_domains(initrc_t) domain_signull_all_domains(initrc_t) domain_sigstop_all_domains(initrc_t) domain_sigchld_all_domains(initrc_t) domain_read_all_domains_state(initrc_t) domain_getattr_all_domains(initrc_t) domain_getsession_all_domains(initrc_t) domain_use_interactive_fds(initrc_t) # for lsof which is used by alsa shutdown: domain_dontaudit_getattr_all_udp_sockets(initrc_t) domain_dontaudit_getattr_all_tcp_sockets(initrc_t) domain_dontaudit_getattr_all_dgram_sockets(initrc_t) domain_dontaudit_getattr_all_pipes(initrc_t) domain_obj_id_change_exemption(initrc_t) files_getattr_all_dirs(initrc_t) files_getattr_all_files(initrc_t) files_getattr_all_symlinks(initrc_t) files_getattr_all_pipes(initrc_t) files_getattr_all_sockets(initrc_t) files_purge_tmp(initrc_t) files_manage_all_locks(initrc_t) files_manage_boot_files(initrc_t) files_read_all_pids(initrc_t) files_delete_root_files(initrc_t) files_delete_all_pids(initrc_t) files_delete_all_pid_dirs(initrc_t) files_read_etc_files(initrc_t) files_manage_etc_runtime_files(initrc_t) files_etc_filetrans_etc_runtime(initrc_t, file) files_read_usr_files(initrc_t) files_manage_urandom_seed(initrc_t) files_manage_generic_spool(initrc_t) # Mount and unmount file systems. # cjp: not sure why these are here; should use mount policy files_list_isid_type_dirs(initrc_t) files_mounton_isid_type_dirs(initrc_t) files_list_default(initrc_t) files_mounton_default(initrc_t) files_manage_mnt_dirs(initrc_t) files_manage_mnt_files(initrc_t) fs_delete_cgroup_dirs(initrc_t) fs_list_cgroup_dirs(initrc_t) fs_rw_cgroup_files(initrc_t) fs_register_binary_executable_type(initrc_t) # cjp: not sure why these are here; should use mount policy fs_mount_all_fs(initrc_t) fs_unmount_all_fs(initrc_t) fs_remount_all_fs(initrc_t) fs_getattr_all_fs(initrc_t) fs_search_all(initrc_t) fs_getattr_nfsd_files(initrc_t) fs_dontaudit_create_tmpfs_chr_dev(initrc_t) # initrc_t needs to do a pidof which requires ptrace mcs_process_set_categories(initrc_t) mls_file_read_all_levels(initrc_t) mls_file_write_all_levels(initrc_t) mls_process_read_up(initrc_t) mls_process_write_down(initrc_t) mls_rangetrans_source(initrc_t) mls_fd_share_all_levels(initrc_t) mls_socket_write_to_clearance(initrc_t) selinux_get_enforce_mode(initrc_t) selinux_setcheckreqprot(initrc_t) storage_getattr_fixed_disk_dev(initrc_t) storage_setattr_fixed_disk_dev(initrc_t) storage_setattr_removable_dev(initrc_t) term_use_all_terms(initrc_t) term_reset_tty_labels(initrc_t) auth_rw_login_records(initrc_t) auth_manage_faillog(initrc_t) auth_setattr_login_records(initrc_t) auth_rw_lastlog(initrc_t) auth_read_pam_pid(initrc_t) auth_delete_pam_pid(initrc_t) auth_delete_pam_console_data(initrc_t) auth_use_nsswitch(initrc_t) libs_rw_ld_so_cache(initrc_t) libs_exec_lib_files(initrc_t) libs_exec_ld_so(initrc_t) logging_send_audit_msgs(initrc_t) logging_send_syslog_msg(initrc_t) logging_manage_generic_logs(initrc_t) logging_read_all_logs(initrc_t) logging_append_all_logs(initrc_t) logging_read_audit_config(initrc_t) # slapd needs to read cert files from its initscript miscfiles_manage_generic_cert_files(initrc_t) seutil_read_config(initrc_t) userdom_read_admin_home_files(initrc_t) userdom_read_user_home_content_files(initrc_t) # 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. userdom_use_inherited_user_terminals(initrc_t) ifdef(`distro_debian',` fs_tmpfs_filetrans(initrc_t, initrc_var_run_t, dir) # for storing state under /dev/shm fs_setattr_tmpfs_dirs(initrc_t) storage_manage_fixed_disk(initrc_t) storage_tmpfs_filetrans_fixed_disk(initrc_t) files_setattr_etc_dirs(initrc_t) ') ifdef(`distro_gentoo',` kernel_dontaudit_getattr_core_if(initrc_t) # seed udev /dev allow initrc_t self:process setfscreate; dev_create_null_dev(initrc_t) dev_create_zero_dev(initrc_t) term_create_console_dev(initrc_t) # unfortunately /sbin/rc does stupid tricks # with /dev/.rcboot to decide if we are in # early init dev_create_generic_dirs(initrc_t) dev_delete_generic_dirs(initrc_t) files_manage_all_pids(initrc_t) # allow bootmisc to create /var/lock/.keep. files_manage_generic_locks(initrc_t) files_manage_var_symlinks(initrc_t) files_pid_filetrans(initrc_t, initrc_state_t, dir, "openrc") # openrc uses tmpfs for its state data fs_tmpfs_filetrans(initrc_t, initrc_state_t, { dir file fifo_file lnk_file }) files_mountpoint(initrc_state_t) # init scripts touch this clock_dontaudit_write_adjtime(initrc_t) # for integrated run_init to read run_init_type. # happens during boot (/sbin/rc execs init scripts) seutil_read_default_contexts(initrc_t) # /lib/rcscripts/net/system.sh rewrites resolv.conf :( sysnet_create_config(initrc_t) sysnet_write_config(initrc_t) sysnet_setattr_config(initrc_t) optional_policy(` abrt_manage_pid_files(initrc_t) ') optional_policy(` alsa_read_lib(initrc_t) ') optional_policy(` arpwatch_manage_data_files(initrc_t) ') optional_policy(` dhcpd_setattr_state_files(initrc_t) ') ') ifdef(`distro_redhat',` # this is from kmodule, which should get its own policy: allow initrc_t self:capability sys_admin; allow initrc_t self:process setfscreate; # Red Hat systems seem to have a stray # fd open from the initrd kernel_use_fds(initrc_t) files_dontaudit_read_root_files(initrc_t) # These seem to be from the initrd # during device initialization: dev_create_generic_dirs(initrc_t) dev_rwx_zero(initrc_t) dev_rx_raw_memory(initrc_t) dev_wx_raw_memory(initrc_t) storage_raw_read_fixed_disk(initrc_t) storage_raw_write_fixed_disk(initrc_t) files_create_boot_dirs(initrc_t) files_create_boot_flag(initrc_t) files_rw_boot_symlinks(initrc_t) # wants to read /.fonts directory files_read_default_files(initrc_t) files_mountpoint(initrc_tmp_t) # Needs to cp localtime to /var dirs files_write_var_dirs(initrc_t) fs_read_tmpfs_symlinks(initrc_t) fs_rw_tmpfs_chr_files(initrc_t) storage_manage_fixed_disk(initrc_t) storage_dev_filetrans_fixed_disk(initrc_t) storage_getattr_removable_dev(initrc_t) # readahead asks for these auth_dontaudit_read_shadow(initrc_t) # init scripts cp /etc/localtime over other directories localtime miscfiles_rw_localization(initrc_t) miscfiles_setattr_localization(initrc_t) miscfiles_relabel_localization(initrc_t) miscfiles_filetrans_named_content(initrc_t) miscfiles_read_fonts(initrc_t) miscfiles_read_hwdata(initrc_t) optional_policy(` alsa_manage_rw_config(initrc_t) ') optional_policy(` abrt_manage_pid_files(initrc_t) ') optional_policy(` bind_manage_config_dirs(initrc_t) bind_manage_config(initrc_t) bind_write_config(initrc_t) bind_setattr_zone_dirs(initrc_t) ') optional_policy(` chronyd_pid_filetrans(initrc_t) ') optional_policy(` cyrus_write_data(initrc_t) ') optional_policy(` devicekit_append_inherited_log_files(initrc_t) devicekit_dbus_chat_power(initrc_t) ') optional_policy(` dirsrvadmin_read_config(initrc_t) dirsrv_manage_var_run(initrc_t) ') optional_policy(` gnome_manage_gconf_config(initrc_t) ') optional_policy(` ldap_read_db_files(initrc_t) ') optional_policy(` ntp_filetrans_named_content(initrc_t) ') optional_policy(` pulseaudio_stream_connect(initrc_t) ') optional_policy(` #for /etc/rc.d/init.d/nfs to create /etc/exports rpc_write_exports(initrc_t) rpc_manage_nfs_state_data(initrc_t) ') optional_policy(` rpcbind_stream_connect(initrc_t) ') optional_policy(` sysnet_rw_dhcp_config(initrc_t) sysnet_manage_config(initrc_t) sysnet_manage_dhcpc_state(initrc_t) sysnet_relabelfrom_dhcpc_state(initrc_t) sysnet_relabelfrom_net_conf(initrc_t) sysnet_relabelto_net_conf(initrc_t) #sysnet_filetrans_named_content(initrc_t) ') optional_policy(` tgtd_stream_connect(initrc_t) ') optional_policy(` wdmd_manage_pid_files(initrc_t) ') optional_policy(` xserver_delete_log(initrc_t) xserver_manage_user_fonts_dir(initrc_t) ') ') ifdef(`distro_suse',` optional_policy(` # set permissions on /tmp/.X11-unix xserver_setattr_xdm_tmp_dirs(initrc_t) ') ') domain_dontaudit_use_interactive_fds(daemon) init_use_notify(daemon) userdom_dontaudit_list_admin_dir(daemon) userdom_dontaudit_search_user_tmp(daemon) tunable_policy(`daemons_dontaudit_scheduling',` dontaudit daemon self:process { setsched }; dontaudit daemon self:capability { sys_nice }; ') tunable_policy(`daemons_use_tcp_wrapper',` corenet_tcp_connect_auth_port(daemon) ') tunable_policy(`daemons_use_tty',` term_use_unallocated_ttys(daemon) term_use_generic_ptys(daemon) term_use_all_ttys(daemon) term_use_all_ptys(daemon) ',` term_dontaudit_use_unallocated_ttys(daemon) term_dontaudit_use_generic_ptys(daemon) term_dontaudit_use_all_ttys(daemon) term_dontaudit_use_all_ptys(daemon) ') # system-config-services causes avc messages that should be dontaudited tunable_policy(`daemons_dump_core',` files_manage_root_files(daemon) ') optional_policy(` unconfined_dontaudit_rw_pipes(daemon) unconfined_dontaudit_rw_stream(daemon) userdom_dontaudit_read_user_tmp_files(daemon) userdom_dontaudit_write_user_tmp_files(daemon) ') optional_policy(` amavis_search_lib(initrc_t) amavis_setattr_pid_files(initrc_t) ') optional_policy(` dev_rw_apm_bios(initrc_t) ') optional_policy(` apache_read_config(initrc_t) apache_list_modules(initrc_t) # webmin seems to cause this. apache_search_sys_content(daemon) ') optional_policy(` asterisk_setattr_logs(initrc_t) asterisk_setattr_pid_files(initrc_t) ') optional_policy(` bind_read_config(initrc_t) # for chmod in start script bind_setattr_pid_dirs(initrc_t) ') optional_policy(` bluetooth_read_config(initrc_t) ') optional_policy(` cgroup_stream_connect_cgred(initrc_t) domain_setpriority_all_domains(initrc_t) ') optional_policy(` clamav_read_config(initrc_t) ') optional_policy(` courier_read_config(initrc_t) ') optional_policy(` cpucontrol_stub(initrc_t) dev_getattr_cpu_dev(initrc_t) ') optional_policy(` chronyd_append_keys(initrc_t) chronyd_read_keys(initrc_t) ') optional_policy(` cron_read_pipes(initrc_t) # managing /etc/cron.d/mailman content cron_manage_system_spool(initrc_t) ') optional_policy(` dev_getattr_printer_dev(initrc_t) cups_read_log(initrc_t) cups_read_rw_config(initrc_t) #cups init script clears error log cups_write_log(initrc_t) ') optional_policy(` daemontools_manage_svc(initrc_t) ') optional_policy(` dbus_connect_system_bus(initrc_t) dbus_system_bus_client(initrc_t) dbus_read_config(initrc_t) dbus_manage_lib_files(initrc_t) init_dbus_chat(initrc_t) optional_policy(` consolekit_dbus_chat(initrc_t) consolekit_manage_log(initrc_t) ') optional_policy(` networkmanager_dbus_chat(initrc_t) ') optional_policy(` policykit_dbus_chat(initrc_t) ') ') optional_policy(` ftp_read_config(initrc_t) ') optional_policy(` glance_manage_pid_files(initrc_t) ') optional_policy(` gpm_setattr_gpmctl(initrc_t) ') optional_policy(` firewalld_dbus_chat(initrc_t) ') optional_policy(` modutils_read_module_config(initrc_t) modutils_domtrans_kmod(initrc_t) ') optional_policy(` inn_exec_config(initrc_t) ') optional_policy(` ipsec_read_config(initrc_t) ipsec_manage_pid(initrc_t) ') optional_policy(` iscsi_stream_connect(initrc_t) iscsi_read_lib_files(initrc_t) ') optional_policy(` kerberos_use(initrc_t) ') optional_policy(` ldap_read_config(initrc_t) ldap_list_db(initrc_t) ') optional_policy(` loadkeys_exec(initrc_t) ') optional_policy(` # in emergency/recovery situations use sulogin locallogin_domtrans_sulogin(initrc_t) ') optional_policy(` # This is needed to permit chown to read /var/spool/lpd/lp. # This is opens up security more than necessary; this means that ANYTHING # running in the initrc_t domain can read the printer spool directory. # Perhaps executing /etc/rc.d/init.d/lpd should transition # to domain lpd_t, instead of waiting for executing lpd. lpd_list_spool(initrc_t) lpd_read_config(initrc_t) lpd_manage_spool(init_t) ') optional_policy(` #allow initrc_t lvm_control_t:chr_file unlink; dev_read_lvm_control(initrc_t) dev_create_generic_chr_files(initrc_t) lvm_read_config(initrc_t) ') optional_policy(` mailman_list_data(initrc_t) mailman_read_data_symlinks(initrc_t) ') optional_policy(` milter_delete_dkim_pid_files(initrc_t) milter_setattr_all_dirs(initrc_t) ') optional_policy(` mta_manage_aliases(initrc_t) mta_manage_config(initrc_t) mta_dontaudit_read_spool_symlinks(initrc_t) ') optional_policy(` ifdef(`distro_redhat',` mysql_manage_db_dirs(initrc_t) ') mysql_stream_connect(initrc_t) mysql_write_log(initrc_t) mysql_read_config(initrc_t) ') optional_policy(` nis_list_var_yp(initrc_t) ') optional_policy(` openvpn_read_config(initrc_t) ') optional_policy(` plymouthd_stream_connect(initrc_t) ') optional_policy(` postgresql_manage_db(initrc_t) postgresql_read_config(initrc_t) ') optional_policy(` postfix_list_spool(initrc_t) ') optional_policy(` psad_setattr_fifo_file(initrc_t) psad_setattr_log(initrc_t) psad_write_log(initrc_t) ') optional_policy(` puppet_rw_tmp(initrc_t) ') optional_policy(` qpidd_manage_var_run(initrc_t) ') optional_policy(` quota_manage_flags(initrc_t) ') optional_policy(` raid_manage_mdadm_pid(initrc_t) ') optional_policy(` ricci_manage_lib_files(initrc_t) ') optional_policy(` rhgb_rw_stream_sockets(initrc_t) rhgb_stream_connect(initrc_t) ') optional_policy(` rpc_read_exports(initrc_t) ') optional_policy(` # bash tries to access a block device in the initrd kernel_dontaudit_getattr_unlabeled_blk_files(initrc_t) # for a bug in rm files_dontaudit_write_all_pids(initrc_t) # bash tries ioctl for some reason files_dontaudit_ioctl_all_pids(initrc_t) ') optional_policy(` samba_rw_config(initrc_t) samba_read_winbind_pid(initrc_t) ') optional_policy(` sendmail_setattr_pid_files(initrc_t) ') optional_policy(` # shorewall-init script run /var/lib/shorewall/firewall shorewall_lib_domtrans(initrc_t) ') optional_policy(` squid_read_config(initrc_t) squid_manage_logs(initrc_t) ') ifdef(`enabled_mls',` optional_policy(` # allow init scripts to su su_restricted_domain_template(initrc, initrc_t, system_r) ') ') optional_policy(` ssh_dontaudit_read_server_keys(initrc_t) ssh_setattr_key_files(initrc_t) ') optional_policy(` stunnel_read_config(initrc_t) ') optional_policy(` udev_rw_db(initrc_t) udev_manage_pid_files(initrc_t) udev_manage_pid_dirs(initrc_t) udev_manage_rules_files(initrc_t) ') optional_policy(` uml_setattr_util_sockets(initrc_t) ') optional_policy(` virt_read_config(init_t) virt_stream_connect(init_t) virt_noatsecure(init_t) virt_rlimitinh(init_t) virt_transition_svirt_sandbox(init_t, system_r) virt_manage_sandbox_files(init_t) ') optional_policy(` virt_manage_pid_dirs(initrc_t) virt_manage_cache(initrc_t) virt_manage_lib_files(initrc_t) virt_stream_connect(initrc_t) virt_transition_svirt_sandbox(initrc_t, system_r) ') # Cron jobs used to start and stop services optional_policy(` cron_rw_pipes(daemon) cron_rw_inherited_user_spool_files(daemon) ') optional_policy(` cfengine_append_inherited_log(daemon) ') optional_policy(` unconfined_domain(initrc_t) domain_named_filetrans(initrc_t) domain_role_change_exemption(initrc_t) files_tmp_filetrans(initrc_t, initrc_tmp_t, { dir_file_class_set }) ifdef(`distro_redhat',` # system-config-services causes avc messages that should be dontaudited unconfined_dontaudit_rw_pipes(daemon) ') optional_policy(` authconfig_domtrans(initrc_t) ') optional_policy(` mono_domtrans(initrc_t) ') # Allow SELinux aware applications to request rpm_script_t execution rpm_transition_script(initrc_t, system_r) optional_policy(` rtkit_scheduled(initrc_t) ') ') optional_policy(` rpm_read_db(initrc_t) rpm_delete_db(initrc_t) ') optional_policy(` vmware_read_system_config(initrc_t) vmware_append_system_config(initrc_t) ') optional_policy(` miscfiles_manage_fonts(initrc_t) # cjp: is this really needed? xfs_read_sockets(initrc_t) ') optional_policy(` sanlock_manage_pid_files(initrc_t) ') optional_policy(` # Set device ownerships/modes. xserver_setattr_console_pipes(initrc_t) # init script wants to check if it needs to update windowmanagerlist xserver_read_xdm_rw_config(initrc_t) ') optional_policy(` zebra_read_config(initrc_t) ') userdom_inherit_append_user_home_content_files(daemon) userdom_inherit_append_user_tmp_files(daemon) userdom_dontaudit_rw_stream(daemon) logging_inherit_append_all_logs(daemon) optional_policy(` # sudo service restart causes this unconfined_signull(daemon) ') optional_policy(` xserver_dontaudit_append_xdm_home_files(daemon) tunable_policy(`use_nfs_home_dirs',` fs_dontaudit_rw_nfs_files(daemon) ') tunable_policy(`use_samba_home_dirs',` fs_dontaudit_rw_cifs_files(daemon) ') ') init_rw_script_stream_sockets(daemon) optional_policy(` abrt_stream_connect(daemon) ') optional_policy(` fail2ban_read_lib_files(daemon) ') optional_policy(` firstboot_dontaudit_leaks(daemon) ') init_rw_stream_sockets(daemon) init_dontaudit_script_leaks(daemon) allow init_t var_run_t:dir relabelto; init_stream_connect(initrc_t) allow initrc_t daemon:process siginh; allow daemon initrc_transition_domain:fifo_file rw_inherited_fifo_file_perms; allow daemon initrc_transition_domain:fd use; allow daemon init_var_run_t:dir search_dir_perms; allow systemprocess init_var_run_t:dir search_dir_perms; allow init_t daemon:unix_stream_socket create_stream_socket_perms; allow init_t daemon:unix_dgram_socket create_socket_perms; allow init_t daemon:tcp_socket create_stream_socket_perms; allow init_t daemon:udp_socket create_socket_perms; allow daemon init_t:unix_dgram_socket sendto; # need write to /var/run/systemd/notify init_write_pid_socket(daemon) allow daemon init_t:unix_stream_socket { append write read getattr ioctl }; # daemons started from init will # inherit fds from init for the console init_dontaudit_use_fds(daemon) term_dontaudit_use_console(daemon) # init script ptys are the stdin/out/err # when using run_init init_use_script_ptys(daemon) allow init_t daemon:process siginh; ifdef(`hide_broken_symptoms',` # RHEL4 systems seem to have a stray # fds open from the initrd ifdef(`distro_rhel4',` kernel_dontaudit_use_fds(daemon) ') dontaudit daemon init_t:dir search_dir_perms; dontaudit daemon init_t:file read_file_perms; ') optional_policy(` nscd_socket_use(daemon) ') optional_policy(` puppet_rw_tmp(daemon) ') allow direct_run_init daemon:process { noatsecure siginh rlimitinh }; allow initrc_t systemprocess:process siginh; allow systemprocess initrc_transition_domain:fifo_file rw_inherited_fifo_file_perms; allow systemprocess initrc_transition_domain:fd use; dontaudit systemprocess init_t:unix_stream_socket getattr; allow init_t daemon:unix_stream_socket create_stream_socket_perms; allow init_t daemon:unix_dgram_socket create_socket_perms; allow daemon init_t:unix_stream_socket ioctl; allow daemon init_t:unix_dgram_socket sendto; # need write to /var/run/systemd/notify init_write_pid_socket(daemon) init_rw_inherited_script_tmp_files(daemon) # Handle upstart/systemd direct transition to a executable allow init_t systemprocess:process { dyntransition siginh }; allow init_t systemprocess:unix_stream_socket create_stream_socket_perms; allow init_t systemprocess:unix_dgram_socket create_socket_perms; allow systemprocess init_t:unix_dgram_socket sendto; allow systemprocess init_t:unix_stream_socket { append write read getattr ioctl }; files_dontaudit_rw_inherited_locks(systemprocess) files_dontaudit_tmp_file_leaks(systemprocess) init_rw_inherited_script_tmp_files(systemprocess) logging_dontaudit_rw_inherited_generic_logs(systemprocess) userdom_dontaudit_search_user_home_dirs(systemprocess) userdom_dontaudit_rw_stream(systemprocess) userdom_dontaudit_write_user_tmp_files(systemprocess) tunable_policy(`daemons_use_tty',` term_use_all_ttys(systemprocess) term_use_all_ptys(systemprocess) ',` term_dontaudit_use_all_ttys(systemprocess) term_dontaudit_use_all_ptys(systemprocess) ') # these apps are often redirect output to random log files logging_inherit_append_all_logs(systemprocess) optional_policy(` abrt_stream_connect(systemprocess) ') optional_policy(` cfengine_append_inherited_log(systemprocess) ') optional_policy(` cron_rw_pipes(systemprocess) ') optional_policy(` puppet_rw_tmp(systemprocess) ') optional_policy(` xserver_dontaudit_append_xdm_home_files(systemprocess) ') optional_policy(` unconfined_dontaudit_rw_pipes(systemprocess) unconfined_dontaudit_rw_stream(systemprocess) userdom_dontaudit_read_user_tmp_files(systemprocess) ') init_rw_script_stream_sockets(systemprocess) role system_r types systemprocess; role system_r types daemon; #ifdef(`enable_mls',` # mls_rangetrans_target(systemprocess) #') allow initrc_domain daemon:process transition; allow daemon initrc_domain:fd use; allow daemon initrc_domain:fifo_file rw_inherited_fifo_file_perms; allow daemon initrc_domain:process sigchld; allow initrc_domain direct_init_entry:file { getattr open read map execute }; allow systemprocess initrc_domain:fd use; allow systemprocess initrc_domain:fifo_file rw_inherited_fifo_file_perms; allow systemprocess initrc_domain:process sigchld; allow initrc_domain systemprocess_entry:file { getattr open read execute map }; allow initrc_domain systemprocess:process transition; optional_policy(` systemd_getattr_unit_dirs(daemon) systemd_getattr_unit_dirs(systemprocess) systemd_exec_notify(daemon) ') optional_policy(` rgmanager_search_lib(initrc_domain) ') ifdef(`direct_sysadm_daemon',` allow daemon direct_run_init:fd use; allow daemon direct_run_init:fifo_file rw_inherited_fifo_file_perms; allow daemon direct_run_init:process sigchld; allow direct_run_init direct_init_entry:file { getattr open read execute }; ') optional_policy(` tunable_policy(`daemons_enable_cluster_mode',` rhcs_manage_cluster_pid_files(daemon) rhcs_manage_cluster_lib_files(daemon) rhcs_rw_inherited_cluster_tmp_files(daemon) rhcs_stream_connect_cluster_to(daemon,daemon) ',` rhcs_read_cluster_lib_files(daemon) rhcs_read_cluster_pid_files(daemon) ') ') optional_policy(` tunable_policy(`daemons_enable_cluster_mode',` #resource agents placed config files in /etc/cluster ccs_manage_config(daemon) ',` ccs_read_config(daemon) ') ')