2005-04-20 19:07:16 +00:00
|
|
|
|
2005-04-26 17:00:25 +00:00
|
|
|
policy_module(kernel,1.0)
|
|
|
|
|
2005-06-14 20:40:09 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
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;
|
|
|
|
|
2005-09-12 15:17:39 +00:00
|
|
|
neverallow ~can_load_kernmodule self:capability sys_module;
|
|
|
|
|
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-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.
|
|
|
|
#
|
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;
|
2005-10-21 22:56:41 +00:00
|
|
|
sid kernel gen_context(system_u:system_r:kernel_t,s0 - s9:c0.c127)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-09-19 21:17:45 +00:00
|
|
|
#
|
|
|
|
# DebugFS
|
|
|
|
#
|
|
|
|
|
|
|
|
type debugfs_t;
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
|
|
# kernel message interface
|
2005-07-20 17:06:10 +00:00
|
|
|
type proc_kmsg_t, proc_type;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /kmsg gen_context(system_u:object_r:proc_kmsg_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
neverallow ~can_receive_kernel_messages proc_kmsg_t:file ~getattr;
|
|
|
|
|
|
|
|
# /proc kcore: inaccessible
|
2005-07-20 17:06:10 +00:00
|
|
|
type proc_kcore_t, proc_type;
|
|
|
|
neverallow { domain -kern_unconfined } proc_kcore_t:file ~getattr;
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /kcore gen_context(system_u:object_r:proc_kcore_t,s0)
|
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
|
|
|
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
|
|
# /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
|
|
|
|
|
|
|
# /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.
|
|
|
|
#
|
|
|
|
type unlabeled_t;
|
2005-10-06 19:33:06 +00:00
|
|
|
sid unlabeled gen_context(system_u:object_r:unlabeled_t,s0)
|
2005-07-20 17:06:10 +00:00
|
|
|
|
|
|
|
# These initial sids are no longer used, and can be removed:
|
2005-10-06 19:33:06 +00:00
|
|
|
sid any_socket gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid file_labels gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid icmp_socket gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid igmp_packet gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid init gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid kmod gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid netmsg gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid policy gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
sid scmp_packet gen_context(system_u:object_r:unlabeled_t,s0)
|
|
|
|
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)
|
|
|
|
sid tcp_socket gen_context(system_u:object_r:unlabeled_t,s0)
|
2005-07-20 17:06:10 +00:00
|
|
|
|
2005-04-25 16:11:21 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# kernel local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
# Use capabilities. need to investigate which capabilities are actually used
|
|
|
|
allow kernel_t self:capability *;
|
|
|
|
|
|
|
|
# Other possible mount points for the root fs are in files
|
|
|
|
allow kernel_t unlabeled_t:dir mounton;
|
|
|
|
|
|
|
|
# old general_domain_access()
|
2005-10-18 15:07:11 +00:00
|
|
|
allow kernel_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
|
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;
|
2005-06-08 20:28:45 +00:00
|
|
|
allow kernel_t self:fifo_file rw_file_perms;
|
2005-04-25 16:11:21 +00:00
|
|
|
allow kernel_t self:fd use;
|
|
|
|
|
|
|
|
# old general_proc_read_access():
|
2005-06-08 20:28:45 +00:00
|
|
|
allow kernel_t proc_t:dir r_dir_perms;
|
|
|
|
allow kernel_t proc_t:{ lnk_file file } r_file_perms;
|
|
|
|
allow kernel_t proc_net_t:dir r_dir_perms;
|
|
|
|
allow kernel_t proc_net_t:file r_file_perms;
|
|
|
|
allow kernel_t proc_mdstat_t:file r_file_perms;
|
2005-04-25 16:11:21 +00:00
|
|
|
allow kernel_t proc_kcore_t:file getattr;
|
|
|
|
allow kernel_t proc_kmsg_t:file getattr;
|
2005-06-08 20:28:45 +00:00
|
|
|
allow kernel_t sysctl_t:dir r_dir_perms;
|
|
|
|
allow kernel_t sysctl_kernel_t:dir r_dir_perms;
|
|
|
|
allow kernel_t sysctl_kernel_t:file r_file_perms;
|
2005-04-25 16:11:21 +00:00
|
|
|
|
2005-09-15 15:34:31 +00:00
|
|
|
# cjp: this seems questionable
|
|
|
|
allow kernel_t unlabeled_t:fifo_file rw_file_perms;
|
|
|
|
|
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)
|
|
|
|
# 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)
|
2005-06-09 21:07:58 +00:00
|
|
|
|
2005-09-15 15:34:31 +00:00
|
|
|
dev_read_sysfs(kernel_t)
|
|
|
|
dev_search_usbfs(kernel_t)
|
2005-06-09 21:07:58 +00:00
|
|
|
|
|
|
|
# Mount root file system. Used when loading a policy
|
|
|
|
# from initrd, then mounting the root filesystem
|
|
|
|
fs_mount_all_fs(kernel_t)
|
|
|
|
|
2005-09-15 15:34:31 +00:00
|
|
|
selinux_load_policy(kernel_t)
|
|
|
|
|
|
|
|
term_use_console(kernel_t)
|
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
corecmd_exec_shell(kernel_t)
|
|
|
|
corecmd_list_sbin(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
|
|
|
|
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)
|
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
|
|
|
|
2005-09-26 20:26:32 +00:00
|
|
|
mls_process_read_up(kernel_t)
|
|
|
|
mls_process_write_down(kernel_t)
|
|
|
|
|
2005-10-24 00:54:39 +00:00
|
|
|
ifdef(`targeted_policy',`
|
|
|
|
unconfined_domain_template(kernel_t)
|
2005-09-16 21:20:37 +00:00
|
|
|
')
|
|
|
|
|
2005-10-24 14:15:29 +00:00
|
|
|
optional_policy(`nis.te',`
|
|
|
|
nis_use_ypbind(kernel_t)
|
|
|
|
')
|
|
|
|
|
2005-10-24 01:53:13 +00:00
|
|
|
optional_policy(`rpc.te',`
|
|
|
|
# nfs kernel server needs kernel UDP access. It is less risky and painful
|
|
|
|
# to just give it everything.
|
|
|
|
allow kernel_t self:tcp_socket create_stream_socket_perms;
|
|
|
|
allow kernel_t self:udp_socket { connect };
|
|
|
|
allow kernel_t self:tcp_socket connected_socket_perms;
|
|
|
|
allow kernel_t self:udp_socket connected_socket_perms;
|
|
|
|
|
|
|
|
# nfs kernel server needs kernel UDP access. It is less risky and painful
|
|
|
|
# to just give it everything.
|
|
|
|
corenet_udp_sendrecv_all_if(kernel_t)
|
|
|
|
corenet_udp_sendrecv_all_nodes(kernel_t)
|
|
|
|
corenet_tcp_bind_all_nodes(kernel_t)
|
|
|
|
corenet_udp_bind_all_nodes(kernel_t)
|
|
|
|
corenet_tcp_sendrecv_all_ports(kernel_t)
|
|
|
|
corenet_udp_sendrecv_all_ports(kernel_t)
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
rpc_udp_rw_nfs_sockets(kernel_t)
|
|
|
|
#rpc_udp_sendto_sockets(kernel_t)
|
|
|
|
rpc_udp_sendto_nfs(kernel_t)
|
|
|
|
|
|
|
|
tunable_policy(`nfs_export_all_ro',`
|
|
|
|
fs_list_noxattr_fs(kernel_t)
|
|
|
|
fs_read_noxattr_fs_files(kernel_t)
|
|
|
|
fs_read_noxattr_fs_symlinks(kernel_t)
|
|
|
|
|
2005-10-24 03:21:26 +00:00
|
|
|
# auth_read_all_dirs_except_shadow(kernel_t)
|
|
|
|
# auth_read_all_files_except_shadow(kernel_t)
|
|
|
|
# auth_read_all_symlinks_except_shadow(kernel_t)
|
2005-10-24 01:53:13 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`nfs_export_all_rw',`
|
|
|
|
fs_list_noxattr_fs(kernel_t)
|
|
|
|
fs_read_noxattr_fs_files(kernel_t)
|
|
|
|
fs_read_noxattr_fs_symlinks(kernel_t)
|
|
|
|
|
2005-10-24 03:21:26 +00:00
|
|
|
# auth_manage_all_files_except_shadow(kernel_t)
|
2005-10-24 01:53:13 +00:00
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2005-06-09 20:50:17 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Unlabeled process local policy
|
|
|
|
#
|
|
|
|
|
2005-07-06 20:28:29 +00:00
|
|
|
ifdef(`targeted_policy',`
|
|
|
|
allow unlabeled_t self:filesystem associate;
|
|
|
|
')
|