## ## Policy for kernel threads, proc filesystem,and unlabeled processes and objects. ## ## ## This policy has initial SIDs. ## ######################################## ## ## Allows to start userland processes ## by transitioning to the specified domain. ## ## ## The process type entered by kernel. ## ## ## The executable type for the entrypoint. ## # interface(`kernel_userland_entry',` gen_require(` type kernel_t; class process sigchld; class fifo_file rw_file_perms; class fd use; ') domain_auto_trans(kernel_t, $2, $1) allow $1 kernel_t:fd use; allow kernel_t $1:fd use; allow kernel_t $1:fifo_file rw_file_perms; allow $1 kernel_t:process sigchld; ') ######################################## ## ## Allows the kernel to mount filesystems on ## the specified directory type. ## ## ## The type of the directory to use as a mountpoint. ## # interface(`kernel_rootfs_mountpoint',` gen_require(` type kernel_t; class dir mounton; ') allow kernel_t $1:dir mounton; ') ######################################## ## ## Send a SIGCHLD signal to kernel threads. ## ## ## The type of the process sending the signal. ## # interface(`kernel_sigchld',` gen_require(` type kernel_t; class process sigchld; ') allow kernel_t $1:process sigchld; ') ######################################## ## ## Allows the kernel to share state information with ## the caller. ## ## ## The type of the process with which to share state information. ## # interface(`kernel_share_state',` gen_require(` type kernel_t; class process share; ') allow kernel_t $1:process share; ') ######################################## ## ## Permits caller to use kernel file descriptors. ## ## ## The type of the process using the descriptors. ## # interface(`kernel_use_fd',` gen_require(` type kernel_t; class fd use; ') allow $1 kernel_t:fd use; ') ######################################## ## ## Do not audit attempts to use ## kernel file descriptors. ## ## ## The type of process not to audit. ## # interface(`kernel_dontaudit_use_fd',` gen_require(` type kernel_t; class fd use; ') dontaudit $1 kernel_t:fd use; ') ######################################## ## ## Read and write kernel unnamed pipes. ## ## ## Domain allowed access. ## # interface(`kernel_rw_pipe',` gen_require(` type kernel_t; class fifo_file { read write }; ') allow $1 kernel_t:fifo_file { read write }; ') ######################################## ## ## Read and write kernel unix datagram sockets. ## ## ## Domain allowed access. ## # interface(`kernel_rw_unix_dgram_socket',` gen_require(` type kernel_t; class unix_dgram_socket { read write ioctl }; ') allow $1 kernel_t:unix_dgram_socket { read write ioctl }; ') ######################################## ## ## Send messages to kernel unix datagram sockets. ## ## ## Domain allowed access. ## # interface(`kernel_sendto_unix_dgram_socket',` gen_require(` type kernel_t; class unix_dgram_socket sendto; ') allow $1 kernel_t:unix_dgram_socket sendto; ') ######################################## ## ## Allows caller to load kernel modules ## ## ## The process type to allow to load kernel modules. ## # interface(`kernel_load_module',` gen_require(` attribute can_load_kernmodule; class capability sys_module; ') allow $1 self:capability sys_module; typeattribute $1 can_load_kernmodule; ') ######################################## ## ## Allows caller to read the ring buffer. ## ## ## The process type allowed to read the ring buffer. ## # interface(`kernel_read_ring_buffer',` gen_require(` type kernel_t; class system syslog_read; ') allow $1 kernel_t:system syslog_read; ') ######################################## ## ## Do not audit attempts to read the ring buffer. ## ## ## The domain to not audit. ## # interface(`kernel_dontaudit_read_ring_buffer',` gen_require(` type kernel_t; class system syslog_read; ') dontaudit $1 kernel_t:system syslog_read; ') ######################################## ## ## Change the level of kernel messages logged to the console. ## ## ## The type of the process performing this action. ## # interface(`kernel_change_ring_buffer_level',` gen_require(` type kernel_t; class system syslog_console; ') allow $1 kernel_t:system syslog_console; ') ######################################## ## ## Allows the caller to clear the ring buffer. ## ## ## The process type clearing the buffer. ## # interface(`kernel_clear_ring_buffer',` gen_require(` type kernel_t; class system syslog_mod; ') allow $1 kernel_t:system syslog_mod; ') ######################################## ## ## Get information on all System V IPC objects. ## ## ## ## # interface(`kernel_get_sysvipc_info',` gen_require(` type kernel_t; class system ipc_info; ') allow $1 kernel_t:system ipc_info; ') ######################################## ## ## Get the attributes of the proc filesystem. ## ## ## Domain allowed access. ## # interface(`kernel_getattr_proc',` gen_require(` type proc_t; class filesystem getattr; ') allow $1 proc_t:filesystem getattr; ') ######################################## ## ## Search directories in /proc. ## ## ## Domain allowed access. ## # interface(`kernel_search_proc',` gen_require(` type proc_t; class dir search; ') allow $1 proc_t:dir search; ') ######################################## ## ## List the contents of directories in /proc. ## ## ## Domain allowed access. ## # interface(`kernel_list_proc',` gen_require(` type proc_t; class dir r_dir_perms; ') allow $1 proc_t:dir r_dir_perms; ') ######################################## ## ## Read symbolic links in /proc. ## ## ## Domain allowed access. ## # interface(`kernel_read_proc_symlinks',` gen_require(` type proc_t; class dir search; class lnk_file { getattr read }; ') allow $1 proc_t:dir search; allow $1 proc_t:lnk_file { getattr read }; ') ######################################## ## ## Allows caller to read system state information in proc. ## ## ## The process type reading the system state information. ## # interface(`kernel_read_system_state',` gen_require(` type proc_t; class dir r_dir_perms; class lnk_file { getattr read }; class file r_file_perms; ') allow $1 proc_t:dir r_dir_perms; allow $1 proc_t:lnk_file { getattr read }; allow $1 proc_t:file r_file_perms; ') ######################################## ## ## Do not audit attempts by caller to ## read system state information in proc. ## ## ## The process type not to audit. ## # interface(`kernel_dontaudit_read_system_state',` gen_require(` type proc_t; class file read; ') allow $1 proc_t:file read; ') ####################################### ## ## Allow caller to read the state information for software raid. ## ## ## The process type reading software raid state. ## # interface(`kernel_read_software_raid_state',` gen_require(` type proc_t, proc_mdstat_t; class dir r_dir_perms; class file r_file_perms; ') allow $1 proc_t:dir r_dir_perms; allow $1 proc_mdstat_t:file r_file_perms; ') ####################################### ## ## Allow caller to read and set the state information for software raid. ## ## ## The process type reading software raid state. ## # interface(`kernel_rw_software_raid_state',` gen_require(` type proc_t, proc_mdstat_t; class dir r_dir_perms; class file rw_file_perms; ') allow $1 proc_t:dir r_dir_perms; allow $1 proc_mdstat_t:file rw_file_perms; ') ######################################## ## ## Allows caller to get attribues of core kernel interface. ## ## ## The process type getting the attibutes. ## # interface(`kernel_getattr_core',` gen_require(` type proc_t, proc_kcore_t; class dir { search getattr read }; class file getattr; ') allow $1 proc_t:dir r_dir_perms; allow $1 proc_kcore_t:file getattr; ') ######################################## ## ## Do not audit attempts to get the attributes of ## core kernel interfaces. ## ## ## The process type to not audit. ## # interface(`kernel_dontaudit_getattr_core',` gen_require(` type proc_kcore_t; class file getattr; ') dontaudit $1 proc_kcore_t:file getattr; ') ######################################## ## ## Allow caller to read kernel messages ## using the /proc/kmsg interface. ## ## ## The process type reading the messages. ## # interface(`kernel_read_messages',` gen_require(` attribute can_receive_kernel_messages; type proc_kmsg_t, proc_t; class dir search; class file r_file_perms; ') allow $1 proc_t:dir search; allow $1 proc_kmsg_t:file r_file_perms; typeattribute $1 can_receive_kernel_messages; ') ######################################## ## ## Allow caller to get the attributes of kernel message ## interface (/proc/kmsg). ## ## ## The process type getting the attributes. ## # interface(`kernel_getattr_message_if',` gen_require(` type proc_kmsg_t, proc_t; class dir search; class file getattr; ') allow $1 proc_t:dir search; allow $1 proc_kmsg_t:file getattr; ') ######################################## ## ## Do not audit attempts by caller to get the attributes of kernel ## message interfaces. ## ## ## The process type not to audit. ## # interface(`kernel_dontaudit_getattr_message_if',` gen_require(` type proc_kmsg_t, proc_t; class file getattr; ') dontaudit $1 proc_kmsg_t:file getattr; ') ######################################## ## ## Allow caller to read the network state information. ## ## ## The process type reading the state. ## ## # interface(`kernel_read_network_state',` gen_require(` type proc_t, proc_net_t; class dir r_dir_perms; class file r_file_perms; ') allow $1 proc_t:dir search; allow $1 proc_net_t:dir r_dir_perms; allow $1 proc_net_t:file r_file_perms; ') ######################################## ## ## Do not audit attempts by caller to search the sysctl directory. ## ## ## The process type not to audit. ## ## # interface(`kernel_dontaudit_search_sysctl_dir',` gen_require(` type sysctl_t; class dir search; ') dontaudit $1 sysctl_t:dir search; ') ######################################## ## ## Allow caller to read the device sysctls. ## ## ## The process type to allow to read the device sysctls. ## # interface(`kernel_read_device_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_dev_t; class dir r_dir_perms; class file r_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_dev_t:dir r_dir_perms; allow $1 sysctl_dev_t:file r_file_perms; ') ######################################## ## ## Read and write device sysctls. ## ## ## The type of the process performing this action. ## # interface(`kernel_rw_device_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_dev_t; class dir r_dir_perms; class file rw_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_dev_t:file rw_file_perms; ') ######################################## ## ## Allow caller to read virtual memory sysctls. ## ## ## The type of the process performing this action. ## ## # interface(`kernel_read_vm_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_vm_t; class dir r_dir_perms; class file r_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_vm_t:file r_file_perms; ') ######################################## ## ## Read and write virtual memory sysctls. ## ## ## The type of the process performing this action. ## # interface(`kernel_rw_vm_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_vm_t; class dir r_dir_perms; class file rw_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_vm_t:file rw_file_perms; ') ######################################## ## ## Do not audit attempts by caller to search sysctl network directories. ## ## ## The process type not to audit. ## # interface(`kernel_dontaudit_search_network_sysctl_dir',` gen_require(` type sysctl_net_t; class dir search; ') dontaudit $1 sysctl_net_t:dir search; ') ######################################## ## ## Allow caller to read network sysctls. ## ## ## The type of the process performing this action. ## ## # interface(`kernel_read_net_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_net_t; class dir r_dir_perms; class file f_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_net_t:dir r_dir_perms; allow $1 sysctl_net_t:file r_file_perms; ') ######################################## ## ## Allow caller to modiry contents of sysctl network files. ## ## ## The type of the process performing this action. ## # interface(`kernel_rw_net_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_net_t; class dir r_dir_perms; class file rw_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_net_t:dir r_dir_perms; allow $1 sysctl_net_t:file rw_file_perms; ') ######################################## ## ## Allow caller to read unix domain ## socket sysctls. ## ## ## The type of the process performing this action. ## # interface(`kernel_read_unix_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_net_t, sysctl_net_unix_t; class dir r_dir_perms; class file r_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_net_t:dir r_dir_perms; allow $1 sysctl_net_unix_t:file r_file_perms; ') ######################################## ## ## Read and write unix domain ## socket sysctls. ## ## ## The type of the process performing this action. ## # interface(`kernel_rw_unix_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_net_t, sysctl_net_unix_t; class dir r_dir_perms; class file rw_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_net_t:dir r_dir_perms; allow $1 sysctl_net_unix_t:file rw_file_perms; ') ######################################## ## ## Read the hotplug sysctl. ## ## ## The type of the process performing this action. ## # interface(`kernel_read_hotplug_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_kernel_t, sysctl_hotplug_t; class dir r_dir_perms; class file r_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_kernel_t:dir r_dir_perms; allow $1 sysctl_hotplug_t:file r_file_perms; ') ######################################## ## ## Read and write the hotplug sysctl. ## ## ## The type of the process performing this action. ## # interface(`kernel_rw_hotplug_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_kernel_t, sysctl_hotplug_t; class dir r_dir_perms; class file rw_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_kernel_t:dir r_dir_perms; allow $1 sysctl_hotplug_t:file rw_file_perms; ') ######################################## ## ## Read the modprobe sysctl. ## ## ## The type of the process performing this action. ## # interface(`kernel_read_modprobe_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_kernel_t, sysctl_modprobe_t; class dir r_dir_perms; class file r_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_kernel_t:dir r_dir_perms; allow $1 sysctl_modprobe_t:file r_file_perms; ') ######################################## ## ## Read and write the modprobe sysctl. ## ## ## The type of the process performing this action. ## # interface(`kernel_rw_modprobe_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_kernel_t, sysctl_modprobe_t; class dir r_dir_perms; class file rw_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_kernel_t:dir r_dir_perms; allow $1 sysctl_modprobe_t:file rw_file_perms; ') ######################################## ## ## Read generic kernel sysctls. ## ## ## The type of the process performing this action. ## # interface(`kernel_read_kernel_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_kernel_t; class dir r_dir_perms; class file r_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_kernel_t:dir r_dir_perms; allow $1 sysctl_kernel_t:file r_file_perms; ') ######################################## ## ## Read and write generic kernel sysctls. ## ## ## The type of the process performing this action. ## # interface(`kernel_rw_kernel_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_kernel_t; class dir r_dir_perms; class file rw_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_kernel_t:dir r_dir_perms; allow $1 sysctl_kernel_t:file rw_file_perms; ') ######################################## ## ## Read filesystem sysctls. ## ## ## The type of the process performing this action. ## # interface(`kernel_read_fs_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_fs_t; class dir r_dir_perms; class file r_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_fs_t:dir r_dir_perms; allow $1 sysctl_fs_t:file r_file_perms; ') ######################################## ## ## Read and write fileystem sysctls. ## ## ## The type of the process performing this action. ## # interface(`kernel_rw_fs_sysctl',` gen_require(` type proc_t, sysctl_t, sysctl_fs_t; class dir r_dir_perms; class file rw_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_t:dir r_dir_perms; allow $1 sysctl_fs_t:dir r_dir_perms; allow $1 sysctl_fs_t:file rw_file_perms; ') ######################################## ## ## Read IRQ sysctls. ## ## ## The type of the process performing this action. ## # interface(`kernel_read_irq_sysctl',` gen_require(` type proc_t, sysctl_irq_t; class dir r_dir_perms; class file r_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_irq_t:dir r_dir_perms; allow $1 sysctl_irq_t:file r_file_perms; ') ######################################## ## ## Read and write IRQ sysctls. ## ## ## The type of the process performing this action. ## ## # interface(`kernel_rw_irq_sysctl',` gen_require(` type proc_t, sysctl_irq_t; class dir r_dir_perms; class file rw_file_perms; ') allow $1 proc_t:dir search; allow $1 sysctl_irq_t:dir r_dir_perms; allow $1 sysctl_irq_t:file rw_file_perms; ') ######################################## # # kernel_read_rpc_sysctl(domain) # interface(`kernel_read_rpc_sysctl',` gen_require(` type proc_t, proc_net_t, sysctl_rpc_t; class dir r_dir_perms; class file r_file_perms; ') allow $1 proc_t:dir search; allow $1 proc_net_t:dir search; allow $1 sysctl_rpc_t:dir r_dir_perms; allow $1 sysctl_rpc_t:file r_file_perms; ') ######################################## # # kernel_rw_rpc_sysctl(domain) # interface(`kernel_rw_rpc_sysctl',` gen_require(` type proc_t, proc_net_t, sysctl_rpc_t; class dir r_dir_perms; class file rw_file_perms; ') allow $1 proc_t:dir search; allow $1 proc_net_t:dir search; allow $1 sysctl_rpc_t:dir r_dir_perms; allow $1 sysctl_rpc_t:file rw_file_perms; ') ######################################## ## ## Allow caller to read all sysctls. ## ## ## The type of the process performing this action. ## # interface(`kernel_read_all_sysctl',` kernel_read_device_sysctl($1) kernel_read_vm_sysctl($1) kernel_read_net_sysctl($1) kernel_read_unix_sysctl($1) kernel_read_hotplug_sysctl($1) kernel_read_modprobe_sysctl($1) kernel_read_kernel_sysctl($1) kernel_read_fs_sysctl($1) kernel_read_irq_sysctl($1) kernel_read_rpc_sysctl($1) ') ######################################## ## ## Read and write all sysctls. ## ## ## The type of the process performing this action. ## # interface(`kernel_rw_all_sysctl',` kernel_rw_device_sysctl($1) kernel_rw_vm_sysctl($1) kernel_rw_net_sysctl($1) kernel_rw_unix_sysctl($1) kernel_rw_hotplug_sysctl($1) kernel_rw_modprobe_sysctl($1) kernel_rw_kernel_sysctl($1) kernel_rw_fs_sysctl($1) kernel_rw_irq_sysctl($1) kernel_rw_rpc_sysctl($1) ') ######################################## ## ## Send a kill signal to unlabeled processes. ## ## ## The type of the process performing this action. ## # interface(`kernel_kill_unlabeled',` gen_require(` type unlabeled_t; class process sigkill; ') allow $1 unlabeled_t:process sigkill; ') ######################################## ## ## Send general signals to unlabeled processes. ## ## ## The type of the process performing this action. ## # interface(`kernel_signal_unlabeled',` gen_require(` type unlabeled_t; class process signal; ') allow $1 unlabeled_t:process signal; ') ######################################## ## ## Send a null signal to unlabeled processes. ## ## ## The type of the process performing this action. ## # interface(`kernel_signull_unlabeled',` gen_require(` type unlabeled_t; class process signull; ') allow $1 unlabeled_t:process signull; ') ######################################## ## ## Send a stop signal to unlabeled processes. ## ## ## The type of the process performing this action. ## # interface(`kernel_sigstop_unlabeled',` gen_require(` type unlabeled_t; class process sigstop; ') allow $1 unlabeled_t:process sigstop; ') ######################################## ## ## Send a child terminated signal to unlabeled processes. ## ## ## The type of the process performing this action. ## # interface(`kernel_sigchld_unlabeled',` gen_require(` type unlabeled_t; class process sigchld; ') allow $1 unlabeled_t:process sigchld; ') ######################################## ## ## List unlabeled directories. ## ## ## Domain allowed access. ## # interface(`kernel_list_unlabeled',` gen_require(` type unlabeled_t; class dir r_dir_perms; ') allow $1 unlabeled_t:dir r_dir_perms; ') ######################################## ## ## Read and write unlabeled directories. ## ## ## Domain allowed access. ## # interface(`kernel_rw_unlabeled_dir',` gen_require(` type unlabeled_t; class dir rw_dir_perms; ') allow $1 unlabeled_t:dir rw_dir_perms; ') ######################################## ## ## Do not audit attempts by caller to get attributes for ## unlabeled block devices. ## ## ## The process type not to audit. ## # interface(`kernel_dontaudit_getattr_unlabeled_blk_dev',` gen_require(` type unlabeled_t; class blk_file getattr; ') allow $1 unlabeled_t:blk_file getattr; ') ######################################## ## ## Read and write unlabeled block device nodes. ## ## ## Domain allowed access. ## # interface(`kernel_use_unlabeled_blk_dev',` gen_require(` type unlabeled_t; class blk_file rw_file_perms; ') allow $1 unlabeled_t:blk_file getattr; ') ######################################## ## ## Allow caller to relabel unlabeled objects. ## ## ## The process type relabeling the objects. ## # interface(`kernel_relabel_unlabeled',` gen_require(` type unlabeled_t; class dir { getattr relabelfrom }; class file { getattr relabelfrom }; class lnk_file { getattr relabelfrom }; class fifo_file { getattr relabelfrom }; class sock_file { getattr relabelfrom }; class chr_file { getattr relabelfrom }; class blk_file { getattr relabelfrom }; ') allow $1 unlabeled_t:dir_file_class_set { getattr relabelfrom }; ') ######################################## ## ## Unconfined access to the kernel. ## ## ## Domain allowed access. ## # interface(`kernel_unconfined',` gen_require(` type kernel_t, unlabeled_t; attribute can_load_kernmodule, can_receive_kernel_messages; ') # allow $1 proc_fs:{ dir file } *; allow $1 sysctl_t:{ dir file } *; allow $1 kernel_t:system *; allow $1 unlabeled_t:{ dir lnk_file sock_file fifo_file blk_file } *; allow $1 unlabeled_t:filesystem *; typeattribute $1 can_load_kernmodule, can_receive_kernel_messages; kernel_rw_all_sysctl($1) ')