Skip to contentSkip to conversation

latest diffs.

PATCH Daniel J Walsh 2 participants 2 messages Oct 25, 2004 – Oct 27, 2004 SELinux security module

lore
Share & tools
lore
#0 lore raw

Removed more tunables
use_games not needed, if you do not want games, don't include games.te Added boolean disable_games to disable games transition.

Change nfs_home_dirs to a boolean.

Change user_net_control to a boolean.

Turn off nscd_all_connect (Hopefully eliminate).

Cleanup nscd.

Dan

attrib.te +2 -0
diff --exclude-from=exclude -N -u -r nsapolicy/attrib.te policy-1.17.34/attrib.te
@@ -400,4 +400,6 @@
 # For clients of nscd that can use shmem interface.
 attribute nscd_shmem_domain;
 
+# For labeling of content for httpd
+attribute httpdcontent;
 
domains/program/ssh.te +2 -2
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/ssh.te policy-1.17.34/domains/program/ssh.te
@@ -73,13 +73,13 @@
 allow $1_t self:capability { sys_chroot sys_resource chown dac_override fowner fsetid setgid setuid sys_tty_config };
 allow $1_t { home_root_t home_dir_type }:dir { search getattr };
 can_ypbind($1_t)
-ifdef(`nfs_home_dirs', `
+if (nfs_home_dirs) {
 ifdef(`automount.te', `
 allow $1_t autofs_t:dir { search getattr };
 ')
 allow $1_t nfs_t:dir { search getattr };
 allow $1_t nfs_t:file { getattr read };
-')dnl end if nfs_home_dirs
+} dnl end if nfs_home_dirs
 
 ifdef(`single_userdomain', `
 if (ssh_sysadm_login) {
domains/program/syslogd.te +1 -0
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/syslogd.te policy-1.17.34/domains/program/syslogd.te
@@ -96,3 +96,4 @@
 dontaudit syslogd_t file_t:dir search;
 allow syslogd_t { tmpfs_t devpts_t }:dir { search };
 dontaudit syslogd_t unlabeled_t:file read;
+dontaudit syslogd_t devpts_t:chr_file getattr;
domains/program/unused/apache.te +5 -4
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/apache.te policy-1.17.34/domains/program/unused/apache.te
@@ -21,6 +21,8 @@
 ###############################################################################
 type http_port_t, port_type, reserved_port_type;
 
+bool httpd_unified false;
+
 # Allow httpd cgi support
 bool httpd_enable_cgi false;
 
@@ -130,7 +132,7 @@
 
 # execute perl
 allow httpd_t { bin_t sbin_t }:dir r_dir_perms;
-can_exec(httpd_t, bin_t)
+can_exec(httpd_t, { bin_t sbin_t })
 
 can_network(httpd_t)
 can_ypbind(httpd_t)
@@ -247,13 +249,12 @@
 allow httpd_t autofs_t:dir { search getattr };
 allow httpd_suexec_t autofs_t:dir { search getattr };
 ')
-ifdef(`nfs_home_dirs', `
-if (httpd_enable_homedirs) {
+if (nfs_home_dirs && httpd_enable_homedirs) {
 r_dir_file(httpd_t, nfs_t)
 r_dir_file(httpd_suexec_t, nfs_t)
 can_exec(httpd_suexec_t, nfs_t)
 }
-')dnl end if nfs_home_dirs
+
 
 #
 # Allow users to mount additional directories as http_source
domains/program/unused/ftpd.te +2 -3
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/ftpd.te policy-1.17.34/domains/program/unused/ftpd.te
@@ -96,13 +96,12 @@
 
 # Allow ftp to read/write files in the user home directories.
 bool ftp_home_dir false;
-if (ftp_home_dir) {
-ifdef(`nfs_home_dirs', `
+
+if (ftp_home_dir && nfs_home_dirs) {
 allow ftpd_t nfs_t:dir r_dir_perms;
 allow ftpd_t nfs_t:file r_file_perms;
 # dont allow access to /home
 dontaudit ftpd_t home_root_t:dir { getattr search };
-')dnl end if nfs_home_dirs
 } 
 else 
 {
domains/program/unused/nscd.te +14 -19
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/nscd.te policy-1.17.34/domains/program/unused/nscd.te
@@ -3,7 +3,16 @@
 # Author:  Russell Coker <[email protected]>
 # X-Debian-Packages: nscd
 #
-
+define(`nscd_socket_domain', `
+can_unix_connect($1, nscd_t)
+allow nscd_client_domain nscd_var_run_t:sock_file rw_file_perms;
+allow $1 { var_run_t var_t }:dir search;
+allow $1 nscd_t:nscd { getpwd getgrp gethost };
+dontaudit $1 nscd_t:fd { use };
+dontaudit $1 nscd_var_run_t:dir { search getattr };
+dontaudit $1 nscd_var_run_t:file { getattr read };
+dontaudit $1 nscd_t:nscd { shmempwd shmemgrp shmemhost };
+')
 #################################
 #
 # Rules for the nscd_t domain.
@@ -22,31 +31,17 @@
 
 # Clients that can get information via the socket interface.
 ifdef(`nscd_all_connect', `
-can_unix_connect(domain, nscd_t)
-allow domain nscd_var_run_t:sock_file rw_file_perms;
-allow domain { var_run_t var_t }:dir search;
-allow domain nscd_t:nscd { getpwd getgrp gethost };
-dontaudit domain nscd_t:fd { use };
-dontaudit domain nscd_var_run_t:file { getattr read };
-dontaudit domain nscd_t:nscd { shmempwd shmemgrp shmemhost };
+nscd_socket_domain(domain)
 ', `
-can_unix_connect(nscd_client_domain, nscd_t)
-allow nscd_client_domain nscd_var_run_t:sock_file rw_file_perms;
-allow nscd_client_domain { var_run_t var_t }:dir search;
-allow nscd_client_domain nscd_t:nscd { getpwd getgrp gethost };
-dontaudit nscd_client_domain nscd_t:fd { use };
-dontaudit nscd_client_domain nscd_var_run_t:file { getattr read };
-dontaudit nscd_client_domain nscd_t:nscd { shmempwd  shmemgrp shmemhost };
+nscd_socket_domain(nscd_client_domain)
 ')dnl nscd_all_connect
 
 # Clients that are allowed to map the database via a fd obtained from nscd.
-can_unix_connect(nscd_shmem_domain, nscd_t)
-allow nscd_shmem_domain nscd_var_run_t:sock_file rw_file_perms;
-allow nscd_shmem_domain { var_run_t var_t }:dir search;
+nscd_socket_domain(nscd_shmem_domain)
+allow nscd_shmem_domain nscd_var_run_t:dir r_dir_perms;
 allow nscd_shmem_domain nscd_t:nscd { shmempwd shmemgrp shmemhost };
 # Receive fd from nscd and map the backing file with read access.
 allow nscd_shmem_domain nscd_t:fd use;
-allow nscd_shmem_domain nscd_var_run_t:file r_file_perms;
 
 # For client program operation, invoked from sysadm_t.
 # Transition occurs to nscd_t due to direct_sysadm_daemon. 
domains/program/unused/spamd.te +3 -2
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/spamd.te policy-1.17.34/domains/program/unused/spamd.te
@@ -58,10 +58,11 @@
 ifdef(`automount.te', `
 allow spamd_t autofs_t:dir { search getattr };
 ')
-ifdef(`nfs_home_dirs', `
+
+if (nfs_home_dirs) {
 allow spamd_t nfs_t:dir rw_dir_perms;
 allow spamd_t nfs_t:file create_file_perms;
-')dnl end if nfs_home_dirs
+}
 
 allow spamd_t home_root_t:dir { getattr };
 
domains/program/unused/squid.te +2 -1
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/squid.te policy-1.17.34/domains/program/unused/squid.te
@@ -18,6 +18,7 @@
 
 allow { squid_t initrc_t } squid_conf_t:file r_file_perms;
 allow squid_t squid_conf_t:dir r_dir_perms;
+allow squid_t squid_conf_t:lnk_file read;
 
 logdir_domain(squid)
 typealias squid_log_t alias var_log_squid_t;
@@ -27,7 +28,7 @@
 # type for /var/cache/squid
 type squid_cache_t, file_type, sysadmfile;
 
-allow squid_t self:capability { setgid setuid };
+allow squid_t self:capability { setgid setuid net_bind_service };
 allow squid_t { etc_t etc_runtime_t }:file r_file_perms;
 allow squid_t etc_t:lnk_file read;
 allow squid_t self:unix_stream_socket create_socket_perms;
domains/program/unused/usernetctl.te +4 -4
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/usernetctl.te policy-1.17.34/domains/program/unused/usernetctl.te
@@ -4,10 +4,13 @@
 
 type usernetctl_exec_t, file_type, sysadmfile, exec_type;
 
-ifdef(`user_net_control',`
 type usernetctl_t, domain, privfd;
 
+if (user_net_control) {
 domain_auto_trans(userdomain, usernetctl_exec_t, usernetctl_t)
+} else {
+can_exec(userdomain, usernetctl_exec_t)
+}
 in_user_role(usernetctl_t)
 role sysadm_r types usernetctl_t;
 
@@ -58,7 +61,4 @@
 allow usernetctl_t { var_t var_run_t }:dir { getattr read search };
 allow usernetctl_t etc_runtime_t:file r_file_perms;
 allow usernetctl_t net_conf_t:file r_file_perms;
-',`
-can_exec(userdomain, usernetctl_exec_t)
-')
 
domains/program/unused/xdm.te +2 -2
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/xdm.te policy-1.17.34/domains/program/unused/xdm.te
@@ -276,14 +276,14 @@
 allow xdm_xserver_t user_home_type:dir search;
 allow xdm_xserver_t user_home_type:file { getattr read };
 
-ifdef(`nfs_home_dirs', `
+if (nfs_home_dirs) {
 ifdef(`automount.te', `
 allow { xdm_t xdm_xserver_t } autofs_t:dir { search getattr };
 ')
 allow { xdm_t xdm_xserver_t } nfs_t:dir create_dir_perms;
 allow { xdm_t xdm_xserver_t } nfs_t:{file lnk_file} create_file_perms;
 can_exec(xdm_t, nfs_t)
-')dnl end if nfs_home_dirs
+}
 
 # for .dmrc
 allow xdm_t user_home_dir_type:dir search;
domains/user.te +9 -0
diff --exclude-from=exclude -N -u -r nsapolicy/domains/user.te policy-1.17.34/domains/user.te
@@ -7,6 +7,9 @@
 # Allow users to read system messages.
 bool user_dmesg false;
 
+# Support NFS home directories
+bool nfs_home_dirs false;
+
 # Allow users to run TCP servers (bind to ports and accept connection from
 # the same domain and outside users)  disabling this forces FTP passive mode
 # and may change other protocols 
@@ -15,6 +18,12 @@
 # Allow users to rw usb devices
 bool user_rw_usb false;
 
+# Allow users to control network interfaces (also needs USERCTL=true)
+bool user_net_control false;
+
+# Disable games transitions
+bool disable_games false;
+
 # Allow regular users direct mouse access 
 bool user_direct_mouse false;
 
file_contexts/program/named.fc +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/program/named.fc policy-1.17.34/file_contexts/program/named.fc
@@ -18,7 +18,7 @@
 /usr/sbin/r?ndc		--	system_u:object_r:ndc_exec_t
 /var/run/ndc		-s	system_u:object_r:named_var_run_t
 /var/run/bind(/.*)?		system_u:object_r:named_var_run_t
-/var/run/named.*		system_u:object_r:named_var_run_t
+/var/run/named(/.*)?		system_u:object_r:named_var_run_t
 /usr/sbin/lwresd	--	system_u:object_r:named_exec_t
 ifdef(`distro_redhat', `
 /var/named/named\.ca	--	system_u:object_r:named_conf_t
file_contexts/program/nscd.fc +2 -0
diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/program/nscd.fc policy-1.17.34/file_contexts/program/nscd.fc
@@ -2,3 +2,5 @@
 /usr/sbin/nscd		--	system_u:object_r:nscd_exec_t
 /var/run/\.nscd_socket	-s	system_u:object_r:nscd_var_run_t
 /var/run/nscd\.pid	--	system_u:object_r:nscd_var_run_t
+/var/db/nscd(/.*)?		system_u:object_r:nscd_var_run_t
+/var/run/nscd(/.*)?		system_u:object_r:nscd_var_run_t
file_contexts/program/pppd.fc +1 -0
diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/program/pppd.fc policy-1.17.34/file_contexts/program/pppd.fc
@@ -5,6 +5,7 @@
 /dev/pppox.*		-c	system_u:object_r:ppp_device_t
 /dev/ippp.*		-c	system_u:object_r:ppp_device_t
 /var/run/pppd\.tdb	--	system_u:object_r:pppd_var_run_t
+/var/run/ppp(/.*)?		system_u:object_r:pppd_var_run_t
 /etc/ppp		-d	system_u:object_r:pppd_etc_t
 /etc/ppp/.*		--	system_u:object_r:pppd_etc_rw_t
 /etc/ppp/.*secrets	--	system_u:object_r:pppd_secret_t
file_contexts/types.fc +2 -0
diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/types.fc policy-1.17.34/file_contexts/types.fc
@@ -266,11 +266,13 @@
 # /etc
 #
 /etc(/.*)?			system_u:object_r:etc_t
+/var/db/.*\.db		--	system_u:object_r:etc_t
 /etc/\.pwd\.lock	--	system_u:object_r:shadow_t
 /etc/passwd\.lock	--	system_u:object_r:shadow_t
 /etc/group\.lock	--	system_u:object_r:shadow_t
 /etc/shadow.*		--	system_u:object_r:shadow_t
 /etc/gshadow.*		--	system_u:object_r:shadow_t
+/var/db/shadow.*	--	system_u:object_r:shadow_t
 /etc/blkid\.tab		--	system_u:object_r:etc_runtime_t
 /etc/fstab\.REVOKE	--	system_u:object_r:etc_runtime_t
 /etc/HOSTNAME		--	system_u:object_r:etc_runtime_t
macros/base_user_macros.te +2 -2
diff --exclude-from=exclude -N -u -r nsapolicy/macros/base_user_macros.te policy-1.17.34/macros/base_user_macros.te
@@ -58,10 +58,10 @@
 allow $1_t $1_home_t:notdevfile_class_set { relabelfrom relabelto };
 can_setfscreate($1_t)
 
-ifdef(`nfs_home_dirs', `
 ifdef(`automount.te', `
 allow $1_t autofs_t:dir { search getattr };
 ')dnl end if automount.te
+ifdef(`nfs_home_dirs', `
 create_dir_file($1_t, nfs_t)
 can_exec($1_t, nfs_t)
 allow $1_t nfs_t:{ sock_file fifo_file } create_file_perms;
@@ -158,7 +158,7 @@
 ifdef(`screen.te', `screen_domain($1)')
 ifdef(`tvtime.te', `tvtime_domain($1)')
 ifdef(`mozilla.te', `mozilla_domain($1)')
-ifdef(`use_games', `ifdef(`games.te', `games_domain($1)')')
+ifdef(`games.te', `games_domain($1)')
 ifdef(`gpg.te', `gpg_domain($1)')
 ifdef(`xauth.te', `xauth_domain($1)')
 ifdef(`startx.te', `xserver_domain($1)')
macros/program/apache_macros.te +19 -24

92 lines not on this page · raw message

macros/program/x_client_macros.te +7 -0
diff --exclude-from=exclude -N -u -r nsapolicy/macros/program/x_client_macros.te policy-1.17.34/macros/program/x_client_macros.te
@@ -36,8 +36,15 @@
 ')
 
 # Transition from the user domain to the derived domain.
+ifelse($2, games, `
+if (! disable_games) {
 domain_auto_trans($1_t, $2_exec_t, $1_$2_t)
 can_exec($1_$2_t, $2_exec_t)
+}
+', `
+domain_auto_trans($1_t, $2_exec_t, $1_$2_t)
+can_exec($1_$2_t, $2_exec_t)
+')
 
 # The user role is authorized for this domain.
 role $1_r types $1_$2_t;
targeted/domains/unconfined.te +4 -0
diff --exclude-from=exclude -N -u -r nsapolicy/targeted/domains/unconfined.te policy-1.17.34/targeted/domains/unconfined.te
@@ -38,3 +38,7 @@
 
 allow unconfined_t unlabeled_t:filesystem *;
 allow unlabeled_t self:filesystem { associate };
+
+# Support NFS home directories
+bool nfs_home_dirs false;
+
tunables/distro.tun +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/tunables/distro.tun policy-1.17.34/tunables/distro.tun
@@ -5,7 +5,7 @@
 # appropriate ifdefs.
 
 
-dnl define(`distro_redhat')
+define(`distro_redhat')
 
 dnl define(`distro_suse')
 
tunables/tunable.tun +6 -15
diff --exclude-from=exclude -N -u -r nsapolicy/tunables/tunable.tun policy-1.17.34/tunables/tunable.tun
@@ -1,39 +1,30 @@
 # Allow all domains to connect to nscd
 dnl define(`nscd_all_connect')
 
-# Allow users to control network interfaces (also needs USERCTL=true)
-dnl define(`user_net_control')
-
 # Allow users to execute the mount command
-dnl define(`user_can_mount')
+define(`user_can_mount')
 
 # Allow rpm to run unconfined.
-dnl define(`unlimitedRPM')
+define(`unlimitedRPM')
 
 # Allow privileged utilities like hotplug and insmod to run unconfined.
-dnl define(`unlimitedUtils')
-
-# Support NFS home directories
-dnl define(`nfs_home_dirs')
-
-# Allow users to run games
-dnl define(`use_games')
+define(`unlimitedUtils')
 
 # Allow rc scripts to run unconfined, including any daemon
 # started by an rc script that does not have a domain transition
 # explicitly defined.
-dnl define(`unlimitedRC')
+define(`unlimitedRC')
 
 # Allow sysadm_t to directly start daemons
 define(`direct_sysadm_daemon')
 
 # Do not audit things that we know to be broken but which
 # are not security risks
-dnl define(`hide_broken_symptoms')
+define(`hide_broken_symptoms')
 
 # Allow user_r to reach sysadm_r via su, sudo, or userhelper.
 # Otherwise, only staff_r can do so.
-dnl define(`user_canbe_sysadm')
+define(`user_canbe_sysadm')
 
 # Allow xinetd to run unconfined, including any services it starts
 # that do not have a domain transition explicitly defined.
#1 lore raw

Merged.

Changed the "ifdef(nfs_home_dirs', " in base_user_macros.te to "if (nfs_home_dirs)" which is obviously what you meant.

Quoted 13 lines · Daniel J Walsh

Removed more tunables
use_games not needed, if you do not want games, don't include games.te Added boolean disable_games to disable games transition.

Change nfs_home_dirs to a boolean.

Change user_net_control to a boolean.

Turn off nscd_all_connect (Hopefully eliminate).

Cleanup nscd.

Dan

Signature · 7 lines
James Carter <[email protected]>
National Security Agency

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.