|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Authors: Stephen Smalley <sds@epoch.ncsc.mil> and Timothy Fraser
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
#################################
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Rules for the kernel_t domain.
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# kernel_t is the domain of kernel threads.
|
|
Chris PeBenito |
ab58ad |
# It is also the target type when checking permissions in the system class.
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
type kernel_t, domain, privmodule, privlog, sysctl_kernel_writer, mlsprocread, mlsprocwrite, privsysmod, etc_writer, privrangetrans ;
|
|
Chris PeBenito |
ab58ad |
role system_r types kernel_t;
|
|
Chris PeBenito |
ab58ad |
general_domain_access(kernel_t)
|
|
Chris PeBenito |
ab58ad |
general_proc_read_access(kernel_t)
|
|
Chris PeBenito |
ab58ad |
base_file_read_access(kernel_t)
|
|
Chris PeBenito |
ab58ad |
uses_shlib(kernel_t)
|
|
Chris PeBenito |
ab58ad |
can_exec(kernel_t, shell_exec_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Use capabilities.
|
|
Chris PeBenito |
ab58ad |
allow kernel_t self:capability *;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
r_dir_file(kernel_t, sysfs_t)
|
|
Chris PeBenito |
ab58ad |
allow kernel_t { usbfs_t usbdevfs_t }:dir search;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Run init in the init_t domain.
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans(kernel_t, init_exec_t, init_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
ifdef(`mls_policy', `
|
|
Chris PeBenito |
ab58ad |
# run init with maximum MLS range
|
|
Chris PeBenito |
ab58ad |
range_transition kernel_t init_exec_t s0 - s15:c0.c255;
|
|
Chris PeBenito |
ab58ad |
')
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Share state with the init process.
|
|
Chris PeBenito |
ab58ad |
allow kernel_t init_t:process share;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Mount and unmount file systems.
|
|
Chris PeBenito |
ab58ad |
allow kernel_t fs_type:filesystem mount_fs_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Send signal to any process.
|
|
Chris PeBenito |
ab58ad |
allow kernel_t domain:process signal;
|
|
Chris PeBenito |
ab58ad |
allow kernel_t domain:dir search;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Access the console.
|
|
Chris PeBenito |
ab58ad |
allow kernel_t device_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow kernel_t console_device_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Access the initrd filesystem.
|
|
Chris PeBenito |
ab58ad |
allow kernel_t file_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
ab58ad |
can_exec(kernel_t, file_t)
|
|
Chris PeBenito |
ab58ad |
ifdef(`chroot.te', `
|
|
Chris PeBenito |
ab58ad |
can_exec(kernel_t, chroot_exec_t)
|
|
Chris PeBenito |
ab58ad |
')
|
|
Chris PeBenito |
ab58ad |
allow kernel_t self:capability sys_chroot;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow kernel_t { unlabeled_t root_t file_t }:dir mounton;
|
|
Chris PeBenito |
ab58ad |
allow kernel_t unlabeled_t:fifo_file rw_file_perms;
|
|
Chris PeBenito |
ab58ad |
allow kernel_t file_t:dir rw_dir_perms;
|
|
Chris PeBenito |
ab58ad |
allow kernel_t file_t:blk_file create_file_perms;
|
|
Chris PeBenito |
ab58ad |
allow kernel_t { sysctl_t sysctl_kernel_t }:file { setattr rw_file_perms };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Lookup the policy.
|
|
Chris PeBenito |
ab58ad |
allow kernel_t policy_config_t:dir r_dir_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Load the policy configuration.
|
|
Chris PeBenito |
ab58ad |
can_loadpol(kernel_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# /proc/sys/kernel/modprobe is set to /bin/true if not using modules.
|
|
Chris PeBenito |
ab58ad |
can_exec(kernel_t, bin_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
ifdef(`targeted_policy', `
|
|
Chris PeBenito |
ab58ad |
unconfined_domain(kernel_t)
|
|
Chris PeBenito |
ab58ad |
')
|