2017-08-09 00:02:22 +00:00
|
|
|
policy_module(kernel, 1.23.1)
|
2005-04-26 17:00:25 +00:00
|
|
|
|
2005-06-14 20:40:09 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2011-09-13 18:45:14 +00:00
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Disable kernel module loading.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
|
|
|
gen_bool(secure_mode_insmod, false)
|
|
|
|
|
2005-05-09 17:41:29 +00:00
|
|
|
# assertion related attributes
|
2005-04-25 16:11:21 +00:00
|
|
|
attribute can_load_kernmodule;
|
|
|
|
attribute can_receive_kernel_messages;
|
2009-11-19 14:25:38 +00:00
|
|
|
attribute can_dump_kernel;
|
2005-04-25 16:11:21 +00:00
|
|
|
|
2011-09-13 18:45:14 +00:00
|
|
|
neverallow ~can_load_kernmodule self:capability sys_module;
|
2005-09-12 15:17:39 +00:00
|
|
|
|
2005-07-20 17:06:10 +00:00
|
|
|
# domains with unconfined access to kernel resources
|
|
|
|
attribute kern_unconfined;
|
|
|
|
|
|
|
|
# regular entries in proc
|
|
|
|
attribute proc_type;
|
|
|
|
|
|
|
|
# sysctls
|
|
|
|
attribute sysctl_type;
|
|
|
|
|
2005-11-29 21:27:15 +00:00
|
|
|
role system_r;
|
|
|
|
role sysadm_r;
|
|
|
|
role staff_r;
|
|
|
|
role user_r;
|
2006-01-24 22:03:36 +00:00
|
|
|
|
2007-10-02 16:04:50 +00:00
|
|
|
# here until order dependence is fixed:
|
|
|
|
role unconfined_r;
|
|
|
|
|
2006-01-24 22:03:36 +00:00
|
|
|
ifdef(`enable_mls',`
|
|
|
|
role secadm_r;
|
2006-06-12 21:36:38 +00:00
|
|
|
role auditadm_r;
|
2006-01-24 22:03:36 +00:00
|
|
|
')
|
2005-11-29 21:27:15 +00:00
|
|
|
|
2005-04-25 16:11:21 +00:00
|
|
|
#
|
2005-04-14 20:18:17 +00:00
|
|
|
# kernel_t is the domain of kernel threads.
|
|
|
|
# It is also the target type when checking permissions in the system class.
|
2009-11-19 14:25:38 +00:00
|
|
|
#
|
2005-09-26 20:26:32 +00:00
|
|
|
type kernel_t, can_load_kernmodule;
|
2005-08-18 21:27:20 +00:00
|
|
|
domain_base_type(kernel_t)
|
2005-09-26 20:26:32 +00:00
|
|
|
mls_rangetrans_source(kernel_t)
|
|
|
|
role system_r types kernel_t;
|
2006-10-04 17:25:34 +00:00
|
|
|
sid kernel gen_context(system_u:system_r:kernel_t,mls_systemhigh)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-09-19 21:17:45 +00:00
|
|
|
#
|
|
|
|
# DebugFS
|
|
|
|
#
|
|
|
|
|
|
|
|
type debugfs_t;
|
2012-03-25 12:42:37 +00:00
|
|
|
files_mountpoint(debugfs_t)
|
2005-09-19 21:17:45 +00:00
|
|
|
fs_type(debugfs_t)
|
|
|
|
allow debugfs_t self:filesystem associate;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon debugfs / gen_context(system_u:object_r:debugfs_t,s0)
|
2005-09-19 21:17:45 +00:00
|
|
|
|
2007-03-19 18:48:14 +00:00
|
|
|
#
|
|
|
|
# kvmFS
|
|
|
|
#
|
|
|
|
|
|
|
|
type kvmfs_t;
|
|
|
|
fs_type(kvmfs_t)
|
|
|
|
genfscon kvmfs / gen_context(system_u:object_r:kvmfs_t,s0)
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
# Procfs types
|
|
|
|
#
|
|
|
|
|
2005-07-20 17:06:10 +00:00
|
|
|
type proc_t, proc_type;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_mountpoint(proc_t)
|
2005-06-28 17:48:59 +00:00
|
|
|
fs_type(proc_t)
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc / gen_context(system_u:object_r:proc_t,s0)
|
|
|
|
genfscon proc /sysvipc gen_context(system_u:object_r:proc_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2007-10-29 22:08:34 +00:00
|
|
|
type proc_afs_t, proc_type;
|
|
|
|
genfscon proc /fs/openafs gen_context(system_u:object_r:proc_afs_t,s0)
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
# kernel message interface
|
2005-07-20 17:06:10 +00:00
|
|
|
type proc_kmsg_t, proc_type;
|
2006-10-04 17:25:34 +00:00
|
|
|
genfscon proc /kmsg gen_context(system_u:object_r:proc_kmsg_t,mls_systemhigh)
|
2006-04-10 21:04:51 +00:00
|
|
|
neverallow ~{ can_receive_kernel_messages kern_unconfined } proc_kmsg_t:file ~getattr;
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
# /proc kcore: inaccessible
|
2005-07-20 17:06:10 +00:00
|
|
|
type proc_kcore_t, proc_type;
|
2009-11-19 14:25:38 +00:00
|
|
|
neverallow ~{ can_dump_kernel kern_unconfined } proc_kcore_t:file ~getattr;
|
2006-10-04 17:25:34 +00:00
|
|
|
genfscon proc /kcore gen_context(system_u:object_r:proc_kcore_t,mls_systemhigh)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-07-20 17:06:10 +00:00
|
|
|
type proc_mdstat_t, proc_type;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /mdstat gen_context(system_u:object_r:proc_mdstat_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-07-20 17:06:10 +00:00
|
|
|
type proc_net_t, proc_type;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /net gen_context(system_u:object_r:proc_net_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2006-03-23 19:19:38 +00:00
|
|
|
type proc_xen_t, proc_type;
|
2009-06-11 15:00:48 +00:00
|
|
|
files_mountpoint(proc_xen_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
genfscon proc /xen gen_context(system_u:object_r:proc_xen_t,s0)
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
# Sysctl types
|
|
|
|
#
|
|
|
|
|
2005-07-20 17:06:10 +00:00
|
|
|
# /proc/sys directory, base directory of sysctls
|
|
|
|
type sysctl_t, sysctl_type;
|
|
|
|
files_mountpoint(sysctl_t)
|
2005-10-06 19:33:06 +00:00
|
|
|
sid sysctl gen_context(system_u:object_r:sysctl_t,s0)
|
|
|
|
genfscon proc /sys gen_context(system_u:object_r:sysctl_t,s0)
|
2005-07-20 17:06:10 +00:00
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
# /proc/irq directory and files
|
2005-07-20 17:06:10 +00:00
|
|
|
type sysctl_irq_t, sysctl_type;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /irq gen_context(system_u:object_r:sysctl_irq_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
# /proc/net/rpc directory and files
|
2005-07-20 17:06:10 +00:00
|
|
|
type sysctl_rpc_t, sysctl_type;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /net/rpc gen_context(system_u:object_r:sysctl_rpc_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2009-06-11 15:00:48 +00:00
|
|
|
# /proc/sys/crypto directory and files
|
|
|
|
type sysctl_crypto_t, sysctl_type;
|
|
|
|
genfscon proc /sys/crypto gen_context(system_u:object_r:sysctl_crypto_t,s0)
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
# /proc/sys/fs directory and files
|
2005-07-20 17:06:10 +00:00
|
|
|
type sysctl_fs_t, sysctl_type;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_mountpoint(sysctl_fs_t)
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /sys/fs gen_context(system_u:object_r:sysctl_fs_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
# /proc/sys/kernel directory and files
|
2005-07-20 17:06:10 +00:00
|
|
|
type sysctl_kernel_t, sysctl_type;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /sys/kernel gen_context(system_u:object_r:sysctl_kernel_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
# /proc/sys/kernel/modprobe file
|
2005-07-20 17:06:10 +00:00
|
|
|
type sysctl_modprobe_t, sysctl_type;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /sys/kernel/modprobe gen_context(system_u:object_r:sysctl_modprobe_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
# /proc/sys/kernel/hotplug file
|
2005-07-20 17:06:10 +00:00
|
|
|
type sysctl_hotplug_t, sysctl_type;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /sys/kernel/hotplug gen_context(system_u:object_r:sysctl_hotplug_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
# /proc/sys/net directory and files
|
2005-07-20 17:06:10 +00:00
|
|
|
type sysctl_net_t, sysctl_type;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /sys/net gen_context(system_u:object_r:sysctl_net_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
# /proc/sys/net/unix directory and files
|
2005-07-20 17:06:10 +00:00
|
|
|
type sysctl_net_unix_t, sysctl_type;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /sys/net/unix gen_context(system_u:object_r:sysctl_net_unix_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
# /proc/sys/vm directory and files
|
2005-07-20 17:06:10 +00:00
|
|
|
type sysctl_vm_t, sysctl_type;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /sys/vm gen_context(system_u:object_r:sysctl_vm_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2015-12-10 16:08:27 +00:00
|
|
|
type sysctl_vm_overcommit_t, sysctl_type;
|
|
|
|
genfscon proc /sys/vm/overcommit_memory gen_context(system_u:object_r:sysctl_vm_overcommit_t,s0)
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
# /proc/sys/dev directory and files
|
2005-07-20 17:06:10 +00:00
|
|
|
type sysctl_dev_t, sysctl_type;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /sys/dev gen_context(system_u:object_r:sysctl_dev_t,s0)
|
2005-04-25 16:11:21 +00:00
|
|
|
|
2005-07-20 17:06:10 +00:00
|
|
|
#
|
|
|
|
# unlabeled_t is the type of unlabeled objects.
|
|
|
|
# Objects that have no known labeling information or that
|
|
|
|
# have labels that are no longer valid are treated as having this type.
|
|
|
|
#
|
2014-01-16 16:19:00 +00:00
|
|
|
# Mountpoint permissions are for the case when a file has been assigned
|
|
|
|
# an extended attribute for the first time (old file_t). Directories
|
|
|
|
# where filesystems are mounted may never get relabeled.
|
|
|
|
#
|
|
|
|
type unlabeled_t alias file_t;
|
|
|
|
kernel_rootfs_mountpoint(unlabeled_t)
|
|
|
|
files_mountpoint(unlabeled_t)
|
2011-03-31 13:49:01 +00:00
|
|
|
fs_associate(unlabeled_t)
|
2014-01-16 16:19:00 +00:00
|
|
|
sid file gen_context(system_u:object_r:unlabeled_t,s0)
|
2006-10-04 17:25:34 +00:00
|
|
|
sid unlabeled gen_context(system_u:object_r:unlabeled_t,mls_systemhigh)
|
2016-03-22 19:43:30 +00:00
|
|
|
neverallow * unlabeled_t:file entrypoint;
|
2005-07-20 17:06:10 +00:00
|
|
|
|
|
|
|
# These initial sids are no longer used, and can be removed:
|
2006-10-04 17:25:34 +00:00
|
|
|
sid any_socket gen_context(system_u:object_r:unlabeled_t,mls_systemhigh)
|
2005-10-06 19:33:06 +00:00
|
|
|
sid file_labels gen_context(system_u:object_r:unlabeled_t,s0)
|
2006-10-04 17:25:34 +00:00
|
|
|
sid icmp_socket gen_context(system_u:object_r:unlabeled_t,mls_systemhigh)
|
|
|
|
sid igmp_packet gen_context(system_u:object_r:unlabeled_t,mls_systemhigh)
|
2006-04-10 21:04:51 +00:00
|
|
|
sid init gen_context(system_u:object_r:unlabeled_t,s0)
|
2006-10-04 17:25:34 +00:00
|
|
|
sid kmod gen_context(system_u:object_r:unlabeled_t,mls_systemhigh)
|
|
|
|
sid policy gen_context(system_u:object_r:unlabeled_t,mls_systemhigh)
|
|
|
|
sid scmp_packet gen_context(system_u:object_r:unlabeled_t,mls_systemhigh)
|
2005-10-06 19:33:06 +00:00
|
|
|
sid sysctl_modprobe gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid sysctl_fs gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid sysctl_kernel gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid sysctl_net gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid sysctl_net_unix gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid sysctl_vm gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid sysctl_dev gen_context(system_u:object_r:unlabeled_t,s0)
|
2006-10-04 17:25:34 +00:00
|
|
|
sid tcp_socket gen_context(system_u:object_r:unlabeled_t,mls_systemhigh)
|
2005-07-20 17:06:10 +00:00
|
|
|
|
2005-04-25 16:11:21 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# kernel local policy
|
|
|
|
#
|
|
|
|
|
2017-08-13 20:21:44 +00:00
|
|
|
allow kernel_t self:capability { chown dac_override dac_read_search fowner fsetid kill setgid setuid setpcap linux_immutable net_bind_service net_broadcast net_admin net_raw ipc_lock ipc_owner sys_rawio sys_chroot sys_ptrace sys_pacct sys_admin sys_boot sys_nice sys_resource sys_time sys_tty_config mknod lease audit_write audit_control setfcap };
|
|
|
|
allow kernel_t self:process { transition signal_perms getsched setsched getsession getpgid setpgid getcap setcap share getattr noatsecure siginh rlimitinh dyntransition setkeycreate setsockcreate getrlimit };
|
2005-06-08 20:28:45 +00:00
|
|
|
allow kernel_t self:shm create_shm_perms;
|
|
|
|
allow kernel_t self:sem create_sem_perms;
|
2005-04-25 16:11:21 +00:00
|
|
|
allow kernel_t self:msg { send receive };
|
2005-06-08 20:28:45 +00:00
|
|
|
allow kernel_t self:msgq create_msgq_perms;
|
|
|
|
allow kernel_t self:unix_dgram_socket create_socket_perms;
|
|
|
|
allow kernel_t self:unix_stream_socket create_stream_socket_perms;
|
2005-04-25 16:11:21 +00:00
|
|
|
allow kernel_t self:unix_dgram_socket sendto;
|
|
|
|
allow kernel_t self:unix_stream_socket connectto;
|
2007-10-09 17:29:48 +00:00
|
|
|
allow kernel_t self:fifo_file rw_fifo_file_perms;
|
|
|
|
allow kernel_t self:sock_file read_sock_file_perms;
|
2005-04-25 16:11:21 +00:00
|
|
|
allow kernel_t self:fd use;
|
|
|
|
|
2009-06-11 15:00:48 +00:00
|
|
|
allow kernel_t debugfs_t:dir search_dir_perms;
|
|
|
|
|
2007-10-09 17:29:48 +00:00
|
|
|
allow kernel_t proc_t:dir list_dir_perms;
|
|
|
|
allow kernel_t proc_t:file read_file_perms;
|
|
|
|
allow kernel_t proc_t:lnk_file read_lnk_file_perms;
|
2006-05-26 19:04:18 +00:00
|
|
|
|
2007-10-09 17:29:48 +00:00
|
|
|
allow kernel_t proc_net_t:dir list_dir_perms;
|
|
|
|
allow kernel_t proc_net_t:file read_file_perms;
|
2006-05-26 19:04:18 +00:00
|
|
|
|
2007-10-09 17:29:48 +00:00
|
|
|
allow kernel_t proc_mdstat_t:file read_file_perms;
|
2006-05-26 19:04:18 +00:00
|
|
|
|
2005-04-25 16:11:21 +00:00
|
|
|
allow kernel_t proc_kcore_t:file getattr;
|
2006-05-26 19:04:18 +00:00
|
|
|
|
2005-04-25 16:11:21 +00:00
|
|
|
allow kernel_t proc_kmsg_t:file getattr;
|
2006-05-26 19:04:18 +00:00
|
|
|
|
2007-10-09 17:29:48 +00:00
|
|
|
allow kernel_t sysctl_kernel_t:dir list_dir_perms;
|
|
|
|
allow kernel_t sysctl_kernel_t:file read_file_perms;
|
|
|
|
allow kernel_t sysctl_t:dir list_dir_perms;
|
2005-04-25 16:11:21 +00:00
|
|
|
|
2006-05-26 19:04:18 +00:00
|
|
|
# Other possible mount points for the root fs are in files
|
|
|
|
allow kernel_t unlabeled_t:dir mounton;
|
|
|
|
# Kernel-generated traffic e.g., TCP resets on
|
|
|
|
# connections with invalidated labels:
|
|
|
|
allow kernel_t unlabeled_t:packet send;
|
2005-09-15 15:34:31 +00:00
|
|
|
|
2016-12-18 20:58:44 +00:00
|
|
|
kernel_mounton_proc_dirs(kernel_t)
|
2013-11-09 09:45:14 +00:00
|
|
|
kernel_request_load_module(kernel_t)
|
|
|
|
|
2009-02-03 15:45:30 +00:00
|
|
|
# Allow unlabeled network traffic
|
2008-05-26 18:38:06 +00:00
|
|
|
allow unlabeled_t unlabeled_t:packet { forward_in forward_out };
|
2009-02-03 15:45:30 +00:00
|
|
|
corenet_in_generic_if(unlabeled_t)
|
|
|
|
corenet_in_generic_node(unlabeled_t)
|
2008-05-26 18:38:06 +00:00
|
|
|
|
2007-06-27 15:23:21 +00:00
|
|
|
corenet_all_recvfrom_unlabeled(kernel_t)
|
|
|
|
corenet_all_recvfrom_netlabel(kernel_t)
|
2005-06-09 21:07:58 +00:00
|
|
|
# Kernel-generated traffic e.g., ICMP replies:
|
|
|
|
corenet_raw_sendrecv_all_if(kernel_t)
|
|
|
|
corenet_raw_sendrecv_all_nodes(kernel_t)
|
2006-01-06 22:51:40 +00:00
|
|
|
corenet_raw_send_generic_if(kernel_t)
|
2005-06-09 21:07:58 +00:00
|
|
|
# Kernel-generated traffic e.g., TCP resets:
|
2005-06-10 01:01:13 +00:00
|
|
|
corenet_tcp_sendrecv_all_if(kernel_t)
|
|
|
|
corenet_tcp_sendrecv_all_nodes(kernel_t)
|
2006-01-06 22:51:40 +00:00
|
|
|
corenet_raw_send_generic_node(kernel_t)
|
2006-05-26 18:04:46 +00:00
|
|
|
corenet_send_all_packets(kernel_t)
|
2005-06-09 21:07:58 +00:00
|
|
|
|
2017-05-24 14:14:59 +00:00
|
|
|
corenet_ib_access_all_pkeys(kernel_t)
|
|
|
|
corenet_ib_access_unlabeled_pkeys(kernel_t)
|
|
|
|
corenet_ib_manage_subnet_all_endports(kernel_t)
|
|
|
|
corenet_ib_manage_subnet_unlabeled_endports(kernel_t)
|
|
|
|
|
2016-12-18 20:58:44 +00:00
|
|
|
dev_mounton_sysfs(kernel_t)
|
2005-09-15 15:34:31 +00:00
|
|
|
dev_read_sysfs(kernel_t)
|
|
|
|
dev_search_usbfs(kernel_t)
|
2010-05-03 15:17:16 +00:00
|
|
|
# devtmpfs handling:
|
|
|
|
dev_create_generic_dirs(kernel_t)
|
|
|
|
dev_delete_generic_dirs(kernel_t)
|
|
|
|
dev_create_generic_blk_files(kernel_t)
|
|
|
|
dev_delete_generic_blk_files(kernel_t)
|
|
|
|
dev_create_generic_chr_files(kernel_t)
|
|
|
|
dev_delete_generic_chr_files(kernel_t)
|
2010-08-18 15:36:34 +00:00
|
|
|
dev_mounton(kernel_t)
|
2016-12-18 20:58:44 +00:00
|
|
|
dev_delete_generic_symlinks(kernel_t)
|
|
|
|
dev_rw_generic_chr_files(kernel_t)
|
|
|
|
dev_setattr_generic_blk_files(kernel_t)
|
|
|
|
dev_setattr_generic_chr_files(kernel_t)
|
|
|
|
dev_getattr_fs(kernel_t)
|
|
|
|
dev_getattr_sysfs(kernel_t)
|
2017-04-29 18:17:47 +00:00
|
|
|
dev_write_kmsg(kernel_t)
|
2005-06-09 21:07:58 +00:00
|
|
|
|
2009-11-19 14:25:38 +00:00
|
|
|
# Mount root file system. Used when loading a policy
|
2005-06-09 21:07:58 +00:00
|
|
|
# from initrd, then mounting the root filesystem
|
|
|
|
fs_mount_all_fs(kernel_t)
|
2008-06-07 13:53:29 +00:00
|
|
|
fs_unmount_all_fs(kernel_t)
|
2005-06-09 21:07:58 +00:00
|
|
|
|
2016-12-18 20:58:44 +00:00
|
|
|
fs_getattr_tmpfs(kernel_t)
|
|
|
|
fs_getattr_tmpfs_dirs(kernel_t)
|
|
|
|
fs_manage_tmpfs_dirs(kernel_t)
|
|
|
|
fs_manage_tmpfs_files(kernel_t)
|
|
|
|
fs_manage_tmpfs_sockets(kernel_t)
|
|
|
|
fs_delete_tmpfs_symlinks(kernel_t)
|
|
|
|
|
|
|
|
selinux_getattr_fs(kernel_t)
|
2005-09-15 15:34:31 +00:00
|
|
|
selinux_load_policy(kernel_t)
|
|
|
|
|
2016-12-18 20:58:44 +00:00
|
|
|
term_getattr_pty_fs(kernel_t)
|
2005-09-15 15:34:31 +00:00
|
|
|
term_use_console(kernel_t)
|
2016-12-18 20:58:44 +00:00
|
|
|
term_use_generic_ptys(kernel_t)
|
2005-09-15 15:34:31 +00:00
|
|
|
|
single binary modutils
On Tuesday, 2 August 2016 7:59:28 PM AEDT Chris PeBenito wrote:
> On 07/31/16 08:34, Russell Coker wrote:
> > The following patch deals with a single binary for modutils, so depmod_t,
> > and insmod_t are merged.
>
> Since the main SELinux distros (including RHEL/CentOS 7) all have merged
> modutils these days, I'm open to taking a patch that fully merges these
> domains (in which case renaming to kmod_t, with proper aliasing seems
> the best idea).
>
> However, it's been some time since I used a busybox-based system; does
> busybox still have separated tools? Yes, this is a bit of an obvious
> question since busybox is also single-binary, but IIRC, the embedded
> guys made some tiny helper scripts or executables so proper
> transitioning could occur. Separate domains may still make sense.
As we have had no response from Busybox users in the last 3 months and also no
response to the thread Luis started in 2013 I think it's safe to assume that
they don't need this.
I've attached a new patch which renames to kmod_t as you suggested. Please
consider it for inclusion.
--
My Main Blog http://etbe.coker.com.au/
My Documents Blog http://doc.coker.com.au/
Description: Change modutils policy to match the use of a single binary
Author: Russell Coker <russell@coker.com.au>
Last-Update: 2014-06-25
2016-10-21 08:35:53 +00:00
|
|
|
# for kdevtmpfs
|
|
|
|
term_setattr_unlink_unallocated_ttys(kernel_t)
|
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
corecmd_exec_shell(kernel_t)
|
2007-03-23 23:24:59 +00:00
|
|
|
corecmd_list_bin(kernel_t)
|
2005-06-09 21:07:58 +00:00
|
|
|
# /proc/sys/kernel/modprobe is set to /bin/true if not using modules.
|
2005-06-13 17:35:46 +00:00
|
|
|
corecmd_exec_bin(kernel_t)
|
2005-06-09 21:07:58 +00:00
|
|
|
|
|
|
|
domain_signal_all_domains(kernel_t)
|
2005-09-15 15:34:31 +00:00
|
|
|
domain_search_all_domains_state(kernel_t)
|
2005-06-09 20:50:17 +00:00
|
|
|
|
2016-12-18 20:58:44 +00:00
|
|
|
files_getattr_rootfs(kernel_t)
|
|
|
|
files_manage_root_dir(kernel_t)
|
|
|
|
files_delete_root_files(kernel_t)
|
|
|
|
files_exec_root_files(kernel_t)
|
|
|
|
files_delete_root_symlinks(kernel_t)
|
|
|
|
files_delete_root_chr_files(kernel_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_list_root(kernel_t)
|
2005-09-12 15:17:39 +00:00
|
|
|
files_list_etc(kernel_t)
|
2016-12-18 20:58:44 +00:00
|
|
|
files_getattr_etc_runtime_dirs(kernel_t)
|
|
|
|
files_mounton_etc_runtime_dirs(kernel_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_list_home(kernel_t)
|
|
|
|
files_read_usr_files(kernel_t)
|
2005-06-09 20:50:17 +00:00
|
|
|
|
2006-03-29 16:23:17 +00:00
|
|
|
mcs_process_set_categories(kernel_t)
|
|
|
|
|
2014-05-23 18:18:10 +00:00
|
|
|
mls_process_read_all_levels(kernel_t)
|
|
|
|
mls_process_write_all_levels(kernel_t)
|
2008-06-07 13:53:29 +00:00
|
|
|
mls_file_write_all_levels(kernel_t)
|
2009-11-19 14:25:38 +00:00
|
|
|
mls_file_read_all_levels(kernel_t)
|
2005-09-26 20:26:32 +00:00
|
|
|
|
2007-02-16 23:01:42 +00:00
|
|
|
ifdef(`distro_redhat',`
|
|
|
|
# Bugzilla 222337
|
|
|
|
fs_rw_tmpfs_chr_files(kernel_t)
|
|
|
|
')
|
|
|
|
|
2015-10-20 18:48:38 +00:00
|
|
|
ifdef(`init_systemd',`
|
|
|
|
optional_policy(`
|
|
|
|
dev_manage_input_dev(kernel_t)
|
|
|
|
dev_filetrans_input_dev(kernel_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
selinux_compute_create_context(kernel_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
storage_dev_filetrans_fixed_disk(kernel_t)
|
|
|
|
storage_setattr_fixed_disk_dev(kernel_t)
|
|
|
|
storage_create_fixed_disk_dev(kernel_t)
|
2015-12-22 20:26:02 +00:00
|
|
|
storage_delete_fixed_disk_dev(kernel_t)
|
2015-10-20 18:48:38 +00:00
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2014-08-11 22:24:15 +00:00
|
|
|
optional_policy(`
|
|
|
|
# loop devices
|
|
|
|
fstools_use_fds(kernel_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-01-30 18:22:24 +00:00
|
|
|
hotplug_search_config(kernel_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-01-30 18:22:24 +00:00
|
|
|
init_sigchld(kernel_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-01-30 18:22:24 +00:00
|
|
|
libs_use_ld_so(kernel_t)
|
|
|
|
libs_use_shared_libs(kernel_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2016-12-18 20:58:44 +00:00
|
|
|
logging_manage_generic_logs(kernel_t)
|
2006-01-30 18:22:24 +00:00
|
|
|
logging_send_syslog_msg(kernel_t)
|
|
|
|
')
|
|
|
|
|
2014-02-08 15:49:47 +00:00
|
|
|
optional_policy(`
|
|
|
|
mount_use_fds(kernel_t)
|
2014-02-08 16:35:57 +00:00
|
|
|
mount_read_loopback_files(kernel_t)
|
2014-02-08 15:49:47 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-10-24 14:15:29 +00:00
|
|
|
nis_use_ypbind(kernel_t)
|
|
|
|
')
|
|
|
|
|
2016-12-18 20:58:44 +00:00
|
|
|
optional_policy(`
|
|
|
|
plymouthd_read_lib_files(kernel_t)
|
2017-04-29 18:17:47 +00:00
|
|
|
plymouthd_read_pid_files(kernel_t)
|
2016-12-29 22:13:04 +00:00
|
|
|
plymouthd_read_spool_files(kernel_t)
|
|
|
|
|
2016-12-18 20:58:44 +00:00
|
|
|
term_use_ptmx(kernel_t)
|
|
|
|
term_use_unallocated_ttys(kernel_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2008-12-03 19:16:20 +00:00
|
|
|
# nfs kernel server needs kernel UDP access. It is less risky and painful
|
2005-10-24 01:53:13 +00:00
|
|
|
# to just give it everything.
|
|
|
|
allow kernel_t self:tcp_socket create_stream_socket_perms;
|
2006-04-24 14:52:01 +00:00
|
|
|
allow kernel_t self:udp_socket create_socket_perms;
|
2005-10-24 01:53:13 +00:00
|
|
|
|
2009-11-19 14:25:38 +00:00
|
|
|
# nfs kernel server needs kernel UDP access. It is less risky and painful
|
2005-10-24 01:53:13 +00:00
|
|
|
# to just give it everything.
|
2009-01-06 20:24:10 +00:00
|
|
|
corenet_udp_sendrecv_generic_if(kernel_t)
|
2009-01-09 19:48:02 +00:00
|
|
|
corenet_udp_sendrecv_generic_node(kernel_t)
|
2005-10-24 01:53:13 +00:00
|
|
|
corenet_udp_sendrecv_all_ports(kernel_t)
|
2009-01-09 19:48:02 +00:00
|
|
|
corenet_udp_bind_generic_node(kernel_t)
|
2006-05-26 20:29:51 +00:00
|
|
|
corenet_sendrecv_portmap_client_packets(kernel_t)
|
2006-05-29 15:04:49 +00:00
|
|
|
corenet_sendrecv_generic_server_packets(kernel_t)
|
2005-10-24 01:53:13 +00:00
|
|
|
|
2006-11-13 03:24:07 +00:00
|
|
|
fs_getattr_xattr_fs(kernel_t)
|
|
|
|
|
2005-10-24 01:53:13 +00:00
|
|
|
auth_dontaudit_getattr_shadow(kernel_t)
|
|
|
|
|
|
|
|
sysnet_read_config(kernel_t)
|
|
|
|
|
|
|
|
rpc_manage_nfs_ro_content(kernel_t)
|
|
|
|
rpc_manage_nfs_rw_content(kernel_t)
|
2011-07-20 21:12:52 +00:00
|
|
|
rpc_tcp_rw_nfs_sockets(kernel_t)
|
2009-11-19 14:25:38 +00:00
|
|
|
rpc_udp_rw_nfs_sockets(kernel_t)
|
2005-10-24 01:53:13 +00:00
|
|
|
|
|
|
|
tunable_policy(`nfs_export_all_ro',`
|
2006-11-13 03:24:07 +00:00
|
|
|
fs_getattr_noxattr_fs(kernel_t)
|
|
|
|
fs_list_noxattr_fs(kernel_t)
|
|
|
|
fs_read_noxattr_fs_files(kernel_t)
|
|
|
|
fs_read_noxattr_fs_symlinks(kernel_t)
|
|
|
|
|
2012-04-25 14:25:49 +00:00
|
|
|
files_list_non_auth_dirs(kernel_t)
|
|
|
|
files_read_non_auth_files(kernel_t)
|
|
|
|
files_read_non_auth_symlinks(kernel_t)
|
2005-10-24 01:53:13 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`nfs_export_all_rw',`
|
2006-11-13 03:24:07 +00:00
|
|
|
fs_getattr_noxattr_fs(kernel_t)
|
|
|
|
fs_list_noxattr_fs(kernel_t)
|
|
|
|
fs_read_noxattr_fs_files(kernel_t)
|
|
|
|
fs_read_noxattr_fs_symlinks(kernel_t)
|
2005-10-24 01:53:13 +00:00
|
|
|
|
2012-04-25 14:25:49 +00:00
|
|
|
files_manage_non_auth_files(kernel_t)
|
2005-10-24 01:53:13 +00:00
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-01-30 18:22:24 +00:00
|
|
|
seutil_read_config(kernel_t)
|
2006-02-02 21:08:12 +00:00
|
|
|
seutil_read_bin_policy(kernel_t)
|
2016-12-18 20:58:44 +00:00
|
|
|
seutil_domtrans_setfiles(kernel_t)
|
2006-01-30 18:22:24 +00:00
|
|
|
')
|
|
|
|
|
2007-10-02 16:04:50 +00:00
|
|
|
optional_policy(`
|
2009-11-19 14:25:38 +00:00
|
|
|
unconfined_domain_noaudit(kernel_t)
|
2007-10-02 16:04:50 +00:00
|
|
|
')
|
|
|
|
|
2005-06-09 20:50:17 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Unlabeled process local policy
|
|
|
|
#
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-01-30 18:22:24 +00:00
|
|
|
# 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.
|
|
|
|
init_sigchld(unlabeled_t)
|
|
|
|
')
|
2006-04-10 21:04:51 +00:00
|
|
|
|
2011-09-13 18:45:14 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Kernel module loading policy
|
|
|
|
#
|
|
|
|
|
|
|
|
if( ! secure_mode_insmod ) {
|
|
|
|
allow can_load_kernmodule self:capability sys_module;
|
2017-08-08 06:59:56 +00:00
|
|
|
allow can_load_kernmodule self:system module_load;
|
2011-09-13 18:45:14 +00:00
|
|
|
|
2016-08-19 13:27:32 +00:00
|
|
|
files_load_kernel_modules(can_load_kernmodule)
|
|
|
|
|
2011-09-13 18:45:14 +00:00
|
|
|
# load_module() calls stop_machine() which
|
|
|
|
# calls sched_setscheduler()
|
2016-08-19 13:27:32 +00:00
|
|
|
# gt: there seems to be no trace of the above, at
|
|
|
|
# least in kernel versions greater than 2.6.37...
|
2011-09-13 18:45:14 +00:00
|
|
|
allow can_load_kernmodule self:capability sys_nice;
|
|
|
|
kernel_setsched(can_load_kernmodule)
|
|
|
|
}
|
|
|
|
|
2006-04-10 21:04:51 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Rules for unconfined acccess to this module
|
|
|
|
#
|
|
|
|
|
2017-08-13 20:21:44 +00:00
|
|
|
allow kern_unconfined proc_type:dir { manage_dir_perms relabelfrom relabelto append map execute swapon quotaon mounton audit_access execmod };
|
|
|
|
allow kern_unconfined proc_type:lnk_file { manage_lnk_file_perms relabelfrom relabelto append map execute swapon quotaon mounton open audit_access execmod };
|
|
|
|
allow kern_unconfined proc_type:file { manage_file_perms relabelfrom relabelto map execute swapon quotaon mounton execute_no_trans audit_access };
|
|
|
|
|
|
|
|
allow kern_unconfined sysctl_type:dir { manage_dir_perms relabelfrom relabelto append map execute swapon quotaon mounton audit_access execmod };
|
|
|
|
allow kern_unconfined sysctl_type:file { manage_file_perms relabelfrom relabelto map execute swapon quotaon mounton execute_no_trans audit_access };
|
|
|
|
|
|
|
|
allow kern_unconfined kernel_t:system { ipc_info syslog_read syslog_mod syslog_console module_request module_load halt reboot status start stop enable disable reload };
|
|
|
|
|
|
|
|
allow kern_unconfined unlabeled_t:file { manage_file_perms relabelfrom relabelto map execute swapon quotaon mounton execute_no_trans audit_access };
|
|
|
|
allow kern_unconfined unlabeled_t:lnk_file { manage_lnk_file_perms relabelfrom relabelto append map execute swapon quotaon mounton open audit_access execmod };
|
|
|
|
allow kern_unconfined unlabeled_t:sock_file { manage_sock_file_perms relabelfrom relabelto map execute swapon quotaon mounton audit_access execmod };
|
|
|
|
allow kern_unconfined unlabeled_t:fifo_file { manage_fifo_file_perms relabelfrom relabelto map execute swapon quotaon mounton audit_access execmod };
|
|
|
|
allow kern_unconfined unlabeled_t:blk_file { manage_blk_file_perms relabelfrom relabelto map execute swapon quotaon mounton audit_access execmod };
|
|
|
|
allow kern_unconfined unlabeled_t:chr_file { manage_chr_file_perms relabelfrom relabelto map execute swapon quotaon mounton execute_no_trans audit_access };
|
|
|
|
allow kern_unconfined unlabeled_t:dir { manage_dir_perms relabelfrom relabelto append map execute swapon quotaon mounton add_name remove_name reparent search rmdir audit_access execmod };
|
|
|
|
allow kern_unconfined unlabeled_t:filesystem { mount remount unmount getattr relabelfrom relabelto transition associate quotamod quotaget };
|
|
|
|
allow kern_unconfined unlabeled_t:association { sendto recvfrom setcontext polmatch };
|
|
|
|
allow kern_unconfined unlabeled_t:packet { send recv relabelto flow_in flow_out forward_in forward_out };
|
|
|
|
allow kern_unconfined unlabeled_t:process { fork signal_perms ptrace getsched setsched getsession getpgid setpgid getcap setcap share getattr setexec setfscreate noatsecure siginh setrlimit rlimitinh setcurrent setkeycreate setsockcreate getrlimit };
|