Skip to contentSkip to conversation

latest policy patches

PATCH Russell Coker 1 participant 1 message Mar 29, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

Following the latest kernel change which results in kernel threads running as kernel_t instead of init_t more policy changes are required.

I have attached a patch that makes the necessary changes for kernel_t, for the modutils programs, and some minor changes for file_contexts as well.

Signature · 4 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page
domains/misc/kernel.te renamed from tmp/policy/domains/misc/kernel.te +7 -0
diff -ru /tmp/policy/domains/misc/kernel.te ./domains/misc/kernel.te
@@ -59,10 +59,17 @@
 # Reload the policy from the real root.
 allow kernel_t security_t:security load_policy;
 
+ifdef(`modutil.te', `
 # Run insmod (for kernel module loader).
 domain_auto_trans_read(kernel_t,insmod_exec_t,insmod_t)
+allow kernel_t insmod_exec_t:lnk_file read;
+')
 
 # /proc/sys/kernel/modprobe is set to /bin/true if not using modules.
 can_exec(kernel_t, bin_t)
 
+can_exec(kernel_t, shell_exec_t)
 
+# nfs kernel server needs kernel UDP access.  It is less risky and painful
+# to just give it everything.
+can_network(kernel_t)
domains/program/klogd.te renamed from tmp/policy/domains/program/klogd.te +3 -0
diff -ru /tmp/policy/domains/program/klogd.te ./domains/program/klogd.te
@@ -21,6 +21,7 @@
 file_type_auto_trans(klogd_t, var_run_t, klogd_var_run_t)
 allow klogd_t proc_t:dir r_dir_perms;
 allow klogd_t proc_t:lnk_file r_file_perms;
+allow klogd_t proc_t:file { getattr read };
 allow klogd_t self:dir r_dir_perms;
 allow klogd_t self:lnk_file r_file_perms;
 
@@ -29,6 +30,8 @@
 allow klogd_t etc_t:lnk_file read;
 allow klogd_t etc_t:file r_file_perms;
 
+allow klogd_t etc_runtime_t:file { getattr read };
+
 # Create unix sockets
 allow klogd_t self:unix_dgram_socket create_socket_perms;
 
domains/program/logrotate.te renamed from tmp/policy/domains/program/logrotate.te +7 -2
diff -ru /tmp/policy/domains/program/logrotate.te ./domains/program/logrotate.te
@@ -24,6 +24,7 @@
 
 # access files in /etc
 allow logrotate_t etc_t:file { getattr read };
+can_exec(logrotate_t, etc_t)
 allow logrotate_t etc_t:lnk_file read;
 allow logrotate_t etc_runtime_t:{ file lnk_file } r_file_perms;
 
@@ -39,8 +40,7 @@
 # Run helper programs.
 allow logrotate_t { bin_t sbin_t }:dir r_dir_perms;
 allow logrotate_t { bin_t sbin_t }:lnk_file read;
-can_exec(logrotate_t, bin_t);
-can_exec(logrotate_t, sbin_t);
+can_exec(logrotate_t, { bin_t sbin_t ls_exec_t });
 
 # Read PID files.
 allow logrotate_t pidfile:file r_file_perms;
@@ -48,6 +48,8 @@
 # Read /proc/PID directories for all domains.
 allow logrotate_t proc_t:dir r_dir_perms;
 allow logrotate_t proc_t:{ file lnk_file } r_file_perms;
+allow logrotate_t { sysctl_t sysctl_kernel_t }:dir search;
+allow logrotate_t sysctl_kernel_t:file { getattr read };
 allow logrotate_t domain:notdevfile_class_set r_file_perms;
 allow logrotate_t domain:dir r_dir_perms;
 
@@ -101,3 +103,6 @@
 ifdef(`backup.te', `
 rw_dir_create_file(logrotate_t, backup_store_t)
 ')
+
+allow logrotate_t fs_t:filesystem getattr;
+can_exec(logrotate_t, shell_exec_t)
domains/program/modutil.te renamed from tmp/policy/domains/program/modutil.te +26 -12
diff -ru /tmp/policy/domains/program/modutil.te ./domains/program/modutil.te
@@ -24,11 +24,18 @@
 
 type depmod_exec_t, file_type, exec_type, sysadmfile;
 domain_auto_trans(initrc_t, depmod_exec_t, depmod_t)
+allow depmod_t sbin_t:dir search;
+dontaudit depmod_t bin_t:dir search;
 can_exec(depmod_t, depmod_exec_t)
 domain_auto_trans(sysadm_t, depmod_exec_t, depmod_t)
 
-# Inherit and use descriptors from init.
-allow depmod_t init_t:fd use;
+# Inherit and use descriptors from init and login programs.
+allow depmod_t { init_t privfd }:fd use;
+
+allow depmod_t { etc_t etc_runtime_t }:file { getattr read };
+allow depmod_t { device_t proc_t }:dir search;
+allow depmod_t proc_t:file { getattr read };
+allow depmod_t fs_t:filesystem getattr;
 
 # Read conf.modules.
 allow depmod_t modules_conf_t:file r_file_perms;
@@ -52,29 +59,30 @@
 #
 # Rules for the insmod_t domain.
 #
-# Rules for /proc/sys/kernel/tainted
 
 type insmod_t, domain, privlog;
 role system_r types insmod_t;
 role sysadm_r types insmod_t;
 
 uses_shlib(insmod_t)
+allow insmod_t self:udp_socket create_socket_perms;
 
 type insmod_exec_t, file_type, exec_type, sysadmfile;
 domain_auto_trans({ initrc_t kernel_t }, insmod_exec_t, insmod_t)
 allow initrc_t insmod_exec_t:lnk_file read;
 can_exec(insmod_t, insmod_exec_t)
+allow insmod_t sbin_t:dir search;
+dontaudit insmod_t bin_t:dir search;
+allow insmod_t sbin_t:lnk_file read;
 allow insmod_t init_t:fd use;
 domain_auto_trans(sysadm_t, insmod_exec_t, insmod_t)
+allow insmod_t fs_t:filesystem getattr;
+allow insmod_t { modules_conf_t modules_dep_t }:file { getattr read };
 
 # Read module objects.
 allow insmod_t modules_object_t:dir r_dir_perms;
 allow insmod_t modules_object_t:{ file lnk_file } r_file_perms;
 
-# Read module config and dependency files.
-allow insmod_t modules_conf_t:file r_file_perms;
-allow insmod_t modules_dep_t:file r_file_perms;
-
 # Use the sys_module capability.
 allow insmod_t self:capability { sys_module kill };
 
@@ -87,29 +95,36 @@
 # I do not know why insmod sends signals or what signals it sends
 allow insmod_t domain:process signal;
 
+# Rules for /proc/sys/kernel/tainted
+allow insmod_t { proc_t sysctl_t sysctl_kernel_t }:dir search;
 allow insmod_t sysctl_kernel_t:file { setattr rw_file_perms };
 allow insmod_t sysctl_t:file write;
+allow insmod_t proc_t:file { getattr read };
 
 # /var/log/ksymoops/*
 allow insmod_t var_t:dir r_dir_perms;
 allow insmod_t var_log_t:dir r_dir_perms;
+allow insmod_t var_log_ksyms_t:file create_file_perms;
 allow insmod_t var_log_ksyms_t:dir create_dir_perms;
 
 ifdef(`crond.te', `
 rw_dir_create_file(system_crond_t, var_log_ksyms_t)
 ')
+
 ifdef(`ipsec.te',
 `# Rules for ipsec Domain 
 allow insmod_t ipsec_t:process signal;')
 
+allow insmod_t device_t:dir search;
+allow insmod_t etc_runtime_t:file { getattr read };
+allow insmod_t self:process { fork signal_perms };
+
 # Access terminals.
 allow insmod_t { initrc_devpts_t admin_tty_type }:chr_file rw_file_perms;
 ifdef(`gnome-pty-helper.te', `allow insmod_t sysadm_gph_t:fd use;')
 
 uses_shlib(insmod_t)
 
-allow insmod_t initctl_t:fifo_file rw_file_perms;
-
 #################################
 #
 # Rules for the update_modules_t domain.
@@ -134,14 +149,13 @@
 allow update_modules_t self:process { fork sigchld };
 allow update_modules_t self:fifo_file rw_file_perms;
 allow update_modules_t modules_dep_t:file rw_file_perms;
-
 file_type_auto_trans(update_modules_t, modules_object_t, modules_conf_t)
 domain_auto_trans_read(update_modules_t, depmod_exec_t, depmod_t)
-can_exec(update_modules_t, { shell_exec_t bin_t sbin_t update_modules_exec_t })
-
+can_exec(update_modules_t, { shell_exec_t bin_t sbin_t update_modules_exec_t etc_t })
 allow update_modules_t bin_t:lnk_file read;
 allow update_modules_t { sbin_t bin_t }:dir search;
 allow update_modules_t { etc_t etc_runtime_t }:file r_file_perms;
+allow update_modules_t etc_t:lnk_file read;
 allow update_modules_t fs_t:filesystem getattr;
 
 allow update_modules_t proc_t:dir search;
file_contexts/program/nsd.fc renamed from tmp/policy/file_contexts/program/nsd.fc +5 -0
diff -ru /tmp/policy/file_contexts/program/nsd.fc ./file_contexts/program/nsd.fc
@@ -1,4 +1,9 @@
 # nsd
 /etc/nsd(/.*)?       		system_u:object_r:nsd_conf_t
+/etc/nsd/primary(/.*)?		system_u:object_r:nsd_zone_t
+/etc/nsd/secondary(/.*)?	system_u:object_r:nsd_zone_t
+/etc/nsd/nsd.db			system_u:object_r:nsd_zone_t
 /usr/sbin/nsd      		system_u:object_r:nsd_exec_t
+/usr/sbin/nsdc      		system_u:object_r:nsd_exec_t
+/usr/sbin/nsd-notify		system_u:object_r:nsd_exec_t
 /var/run/nsd\.pid		system_u:object_r:var_run_nsd_t
file_contexts/program/ntpd.fc renamed from tmp/policy/file_contexts/program/ntpd.fc +1 -0
diff -ru /tmp/policy/file_contexts/program/ntpd.fc ./file_contexts/program/ntpd.fc
@@ -1,6 +1,7 @@
 /var/lib/ntp(/.*)?			system_u:object_r:var_lib_ntp_t
 /etc/ntp\.conf				system_u:object_r:etc_ntp_t
 /usr/sbin/ntpd				system_u:object_r:ntpd_exec_t
+/usr/sbin/ntpdate			system_u:object_r:ntpd_exec_t
 /var/log/ntpstats(/.*)?			system_u:object_r:var_log_ntp_t
 /var/log/ntpd.*				system_u:object_r:var_log_ntp_t
 /etc/cron\.(daily|weekly)/ntp-simple	system_u:object_r:ntpd_exec_t
file_contexts/program/sysstat.fc renamed from tmp/policy/file_contexts/program/sysstat.fc +1 -1
diff -ru /tmp/policy/file_contexts/program/sysstat.fc ./file_contexts/program/sysstat.fc
@@ -1,5 +1,5 @@
 # sysstat and other sar programs
-/usr/lib/atsar/atsadc		system_u:object_r:sysstat_exec_t
+/usr/lib/atsar/atsa.*		system_u:object_r:sysstat_exec_t
 /usr/lib/sysstat/sa.*		system_u:object_r:sysstat_exec_t
 /var/log/atsar(/.*)?		system_u:object_r:var_log_sysstat_t
 /var/log/sysstat(/.*)?		system_u:object_r:var_log_sysstat_t
fs_use renamed from tmp/policy/fs_use +1 -0
diff -ru /tmp/policy/fs_use ./fs_use
@@ -10,6 +10,7 @@
 fs_use_psid ext3;
 fs_use_psid reiserfs;
 fs_use_psid jfs;
+fs_use_psid jffs2;
 
 # Use the allocating task SID to label inodes in the following filesystem
 # types, and label the filesystem itself with the specified context.