Skip to contentSkip to conversation

More fixes for nscd in targeted policy

PATCH Daniel J Walsh 5 participants 8 messages Sep 14, 2004 – Sep 23, 2004 SELinux security module

lore
Share & tools
lore
#0 lore raw
appconfig/media +3 -0
diff --exclude-from=exclude -N -u -r nsapolicy/appconfig/media policy-1.17.15/appconfig/media
@@ -0,0 +1,3 @@
+cdrom system_u:object_r:removable_device_t
+floppy system_u:object_r:removable_device_t
+disk system_u:object_r:fixed_disk_device_t
domains/program/unused/named.te +7 -2
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/named.te policy-1.17.15/domains/program/unused/named.te
@@ -12,10 +12,10 @@
 #
 type rndc_port_t, port_type;
 
-daemon_domain(named)
+daemon_domain(named, `, nscd_shmem_domain')
 tmp_domain(named)
 
-# for /var/run/ndc used in BIND 8
+# For /var/run/ndc used in BIND 8
 file_type_auto_trans(named_t, var_run_t, named_var_run_t, sock_file)
 
 # ndc_t is the domain for the ndc program
@@ -23,6 +23,11 @@
 role sysadm_r types ndc_t;
 role system_r types ndc_t;
 
+ifdef(`targeted_policy', `
+dontaudit ndc_t root_t:file { getattr read };
+dontaudit ndc_t unlabeled_t:file { getattr read };	
+')
+
 can_exec(named_t, named_exec_t)
 allow named_t sbin_t:dir search;
 
domains/program/unused/nscd.te +5 -0
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/nscd.te policy-1.17.15/domains/program/unused/nscd.te
@@ -24,6 +24,7 @@
 ifdef(`nscd_all_connect', `
 can_unix_connect(domain, nscd_t)
 allow domain nscd_var_run_t:sock_file rw_file_perms;
+allow domain nscd_var_run_t:file r_file_perms;
 allow domain { var_run_t var_t }:dir search;
 allow domain nscd_t:nscd { getpwd getgrp gethost };
 dontaudit domain nscd_t:nscd { shmempwd shmemgrp shmemhost };
@@ -60,3 +61,7 @@
 allow nscd_t shadow_t:file getattr;
 
 dontaudit nscd_t sysadm_home_dir_t:dir search;
+#
+# Handle winbind for samba, Might only be needed for targeted policy
+#
+dontaudit nscd_t var_run_t:sock_file rw_file_perms;
domains/program/unused/ntpd.te +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/ntpd.te policy-1.17.15/domains/program/unused/ntpd.te
@@ -8,7 +8,7 @@
 #
 # Rules for the ntpd_t domain.
 #
-daemon_domain(ntpd)
+daemon_domain(ntpd, `, nscd_shmem_domain')
 type ntp_drift_t, file_type, sysadmfile;
 type ntp_port_t, port_type;
 
domains/program/unused/portmap.te +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/portmap.te policy-1.17.15/domains/program/unused/portmap.te
@@ -11,7 +11,7 @@
 #
 # Rules for the portmap_t domain.
 #
-daemon_domain(portmap)
+daemon_domain(portmap, `, nscd_shmem_domain')
 
 can_network(portmap_t)
 can_ypbind(portmap_t)
domains/program/unused/squid.te +2 -1
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/squid.te policy-1.17.15/domains/program/unused/squid.te
@@ -13,7 +13,7 @@
 can_tcp_connect(squid_t, httpd_t)
 ')
 
-daemon_domain(squid, `, web_client_domain')
+daemon_domain(squid, `, web_client_domain, nscd_client_domain')
 type squid_conf_t, file_type, sysadmfile;
 
 allow { squid_t initrc_t } squid_conf_t:file r_file_perms;
@@ -66,3 +66,4 @@
 allow squid_t { bin_t sbin_t }:dir search;
 
 dontaudit squid_t { home_root_t security_t devpts_t }:dir getattr;
+dontaudit squid_t tty_device_t:chr_file { read write };
macros/global_macros.te +1 -0
diff --exclude-from=exclude -N -u -r nsapolicy/macros/global_macros.te policy-1.17.15/macros/global_macros.te
@@ -545,6 +545,7 @@
 # Create/access any file in a labeled filesystem;
 allow $1 file_type:dir_file_class_set *;
 allow $1 sysctl_t:{ dir file } *;
+allow $1 proc_mdstat_t:file *;
 allow $1 device_type:devfile_class_set *;
 allow $1 mtrr_device_t:file *;
 
macros/program/mozilla_macros.te +2 -0
diff --exclude-from=exclude -N -u -r nsapolicy/macros/program/mozilla_macros.te policy-1.17.15/macros/program/mozilla_macros.te
@@ -71,6 +71,8 @@
 allow $1_lpr_t $1_mozilla_rw_t:file rw_file_perms;
 ')
 
+dontaudit $1_mozilla_t tmp_t:lnk_file read;
+
 #
 # This is another place where I sould like to allow system customization.
 # We need to allow the admin to select whether then want to allow mozilla
macros/program/ypbind_macros.te +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/macros/program/ypbind_macros.te policy-1.17.15/macros/program/ypbind_macros.te
@@ -10,8 +10,8 @@
 define(`can_ypbind', `
 r_dir_file($1,var_yp_t)
 can_network($1)
+dontaudit $1 reserved_port_t:{ tcp_socket udp_socket } name_bind;
 allow $1 port_t:{ tcp_socket udp_socket } name_bind;
-allow $1 $1:capability { net_bind_service };
 ') dnl can_ypbind
 ') dnl allow_ypbind
 ') dnl ypbind.te
tunables/distro.tun +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/tunables/distro.tun policy-1.17.15/tunables/distro.tun
@@ -5,7 +5,7 @@
 # appropriate ifdefs.
 
 
-dnl define(`distro_redhat')
+define(`distro_redhat')
 
 dnl define(`distro_suse')
 
tunables/tunable.tun +11 -14
diff --exclude-from=exclude -N -u -r nsapolicy/tunables/tunable.tun policy-1.17.15/tunables/tunable.tun
@@ -1,54 +1,51 @@
 # Allow all domains to connect to nscd
-dnl define(`nscd_all_connect')
+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')
+define(`unlimitedUtils')
 
 # Support NFS home directories
-dnl define(`nfs_home_dirs')
+define(`nfs_home_dirs')
 
 # Allow users to run games
-dnl define(`use_games')
+define(`use_games')
 
 # Allow ypbind to run with NIS
-dnl define(`allow_ypbind')
+define(`allow_ypbind')
 
 # 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 sysadm_t to do almost everything
 dnl define(`unrestricted_admin')
 
 # Allow the read/write/create on any NFS file system
-dnl define(`nfs_export_all_rw')
-
-# Allow users to unrestricted access
-dnl define(`unlimitedUsers')
+define(`nfs_export_all_rw')
 
 # Allow the reading on any NFS file system
 dnl define(`nfs_export_all_ro')
 
 # 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

macros/global_macros.te line 550

Quoted 10 lines · Daniel J Walsh

diff --exclude-from=exclude -N -u -r nsapolicy/macros/global_macros.te policy-1.17.15/macros/global_macros.te

macros/global_macros.te +1 -0
@@ -545,6 +545,7 @@
 # Create/access any file in a labeled filesystem;
 allow $1 file_type:dir_file_class_set *;
 allow $1 sysctl_t:{ dir file } *;
+allow $1 proc_mdstat_t:file *;
 allow $1 device_type:devfile_class_set *;
 allow $1 mtrr_device_t:file *;

This particular one should be fixed a bit more cleanly with my proc_fs attribute patch; that way when we give more files in /proc their own types, we won't have to remember to update unconfined_t.

#2 lore raw
In reply to Daniel J Walsh

domains/program/unused/named.te line 16

Quoted 10 lines · Daniel J Walsh

diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/named.te policy-1.17.15/domains/program/unused/named.te

domains/program/unused/named.te +1 -1
@@ -12,10 +12,10 @@
 #
 type rndc_port_t, port_type;
 
-daemon_domain(named)
+daemon_domain(named, `, nscd_shmem_domain')
 tmp_domain(named)

nscd_shmem_domain should only be given to domains that you trust to have access to the entire cached mapping. Otherwise, use nscd_client_domain to let them use the socket interface.

domains/program/unused/nscd.te line 27

Quoted 8 lines

diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/nscd.te policy-1.17.15/domains/program/unused/nscd.te

domains/program/unused/nscd.te +1 -0
@@ -24,6 +24,7 @@
 ifdef(`nscd_all_connect', `
 can_unix_connect(domain, nscd_t)
 allow domain nscd_var_run_t:sock_file rw_file_perms;
+allow domain nscd_var_run_t:file r_file_perms;

I don't think you want to allow this for clients that are using the socket interface, only those that are using the shmem interface (which should be limited to a small set).

domains/program/unused/nscd.te line 67

Quoted 4 lines
domains/program/unused/nscd.te +4 -0
+#
+# Handle winbind for samba, Might only be needed for targeted policy
+#
+dontaudit nscd_t var_run_t:sock_file rw_file_perms;

This doesn't make sense; nscd_t has these permissions as a consequence of having nscd_client_domain attribute in the policy (since it is used for both the client and the daemon).

domains/program/unused/ntpd.te line 13

Quoted 11 lines

diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/ntpd.te policy-1.17.15/domains/program/unused/ntpd.te

domains/program/unused/ntpd.te +1 -1
@@ -8,7 +8,7 @@
 #
 # Rules for the ntpd_t domain.
 #
-daemon_domain(ntpd)
+daemon_domain(ntpd, `, nscd_shmem_domain')
 type ntp_drift_t, file_type, sysadmfile;
 type ntp_port_t, port_type;

nscd_client_domain only, I'd say.

domains/program/unused/portmap.te line 17

Quoted 12 lines

diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/portmap.te policy-1.17.15/domains/program/unused/portmap.te

domains/program/unused/portmap.te +1 -1
@@ -11,7 +11,7 @@
 #
 # Rules for the portmap_t domain.
 #
-daemon_domain(portmap)
+daemon_domain(portmap, `, nscd_shmem_domain')
 
 can_network(portmap_t)
 can_ypbind(portmap_t)

Ditto.

Signature · 8 lines
Stephen Smalley <[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.
#3 lore raw
Quoted 10 lines · Stephen Smalley
Quoted 7 lines · Daniel J Walsh

diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/named.te policy-1.17.15/domains/program/unused/named.te

domains/program/unused/named.te +0 -0
@@ -12,10 +12,10 @@
 #
 type rndc_port_t, port_type;
 
Quoted 5 lines

domains/program/unused/named.te line 18

Quoted 5 lines
domains/program/unused/named.te +1 -1
-daemon_domain(named)
+daemon_domain(named, `, nscd_shmem_domain')
 tmp_domain(named)
 
 

Ok changed all th client_domain

Quoted 7 lines

nscd_shmem_domain should only be given to domains that you trust to have access to the entire cached mapping. Otherwise, use nscd_client_domain to let them use the socket interface.

Quoted 17 lines
Quoted 10 lines

diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/nscd.te policy-1.17.15/domains/program/unused/nscd.te

domains/program/unused/nscd.te +0 -0
@@ -24,6 +24,7 @@

ifdef(nscd_all_connect', can_unix_connect(domain, nscd_t)
allow domain nscd_var_run_t:sock_file rw_file_perms; +allow domain nscd_var_run_t:file r_file_perms;

I don't think you want to allow this for clients that are using the socket interface, only those that are using the shmem interface (which should be limited to a small set).

Ok then we need some dontaudit rules added, which I have attached.

Quoted 12 lines

domains/program/unused/nscd.te

Quoted 6 lines
domains/program/unused/nscd.te +4 -0
+#
+# Handle winbind for samba, Might only be needed for targeted policy
+#
+dontaudit nscd_t var_run_t:sock_file rw_file_perms;

This doesn't make sense; nscd_t has these permissions as a consequence of having nscd_client_domain attribute in the policy (since it is used for both the client and the daemon).

I don't believ nscd_t has access to var_run_t. It can do this to nscd_var_run_t. It is
trying to communicate with a socket created by winbind.

Quoted 19 lines
Quoted 7 lines

diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/ntpd.te policy-1.17.15/domains/program/unused/ntpd.te

domains/program/unused/ntpd.te line 14

Quoted 8 lines
domains/program/unused/ntpd.te +1 -1
@@ -8,7 +8,7 @@
 #
 # Rules for the ntpd_t domain.
 #
-daemon_domain(ntpd)
+daemon_domain(ntpd, `, nscd_shmem_domain')
 type ntp_drift_t, file_type, sysadmfile;
 type ntp_port_t, port_type;
 

nscd_client_domain only, I'd say.

done

Quoted 12 lines
Quoted 12 lines

diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/portmap.te policy-1.17.15/domains/program/unused/portmap.te

domains/program/unused/portmap.te +1 -1
@@ -11,7 +11,7 @@
 #
 # Rules for the portmap_t domain.
 #
-daemon_domain(portmap)
+daemon_domain(portmap, `, nscd_shmem_domain')
 
Quoted 9 lines

domains/program/unused/portmap.te line 17

Quoted 4 lines
domains/program/unused/portmap.te +0 -0
 can_network(portmap_t)
 can_ypbind(portmap_t)

Ditto.

done

attrib.te +4 -0
diff --exclude-from=exclude -N -u -r nsapolicy/attrib.te policy-1.17.16/attrib.te
@@ -205,6 +205,10 @@
 # The device_type attribute identifies all types assigned to device nodes
 attribute device_type;
 
+# The proc_fs attribute identifies all types that may be assigned to
+# files under /proc.
+attribute proc_fs;
+
 # The dev_fs attribute identifies all types that may be assigned to
 # files, sockets, or pipes under /dev.
 attribute dev_fs;
domains/program/unused/hald.te +1 -0
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/hald.te policy-1.17.16/domains/program/unused/hald.te
@@ -48,6 +48,7 @@
 ifdef(`udev.te', `
 domain_auto_trans(hald_t, udev_exec_t, udev_t)
 allow udev_t hald_t:unix_dgram_socket sendto;
+allow hald_t udev_tbl_t:file { getattr read };
 ')
 
 allow hald_t usbdevfs_t:dir search;
domains/program/unused/named.te +7 -2
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/named.te policy-1.17.16/domains/program/unused/named.te
@@ -12,10 +12,10 @@
 #
 type rndc_port_t, port_type;
 
-daemon_domain(named)
+daemon_domain(named, `, nscd_client_domain')
 tmp_domain(named)
 
-# for /var/run/ndc used in BIND 8
+# For /var/run/ndc used in BIND 8
 file_type_auto_trans(named_t, var_run_t, named_var_run_t, sock_file)
 
 # ndc_t is the domain for the ndc program
@@ -23,6 +23,11 @@
 role sysadm_r types ndc_t;
 role system_r types ndc_t;
 
+ifdef(`targeted_policy', `
+dontaudit ndc_t root_t:file { getattr read };
+dontaudit ndc_t unlabeled_t:file { getattr read };	
+')
+
 can_exec(named_t, named_exec_t)
 allow named_t sbin_t:dir search;
 
domains/program/unused/nscd.te +14 -3
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/nscd.te policy-1.17.16/domains/program/unused/nscd.te
@@ -26,23 +26,27 @@
 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 };
+allow domain nscd_t:fd { use };
+dontaudit domain nscd_var_run_t:file { getattr read };
 dontaudit domain nscd_t:nscd { shmempwd shmemgrp shmemhost };
 ', `
 can_unix_connect(nscd_client_domain, nscd_t)
-allow nscd_client_domain var_run_nscd_t:sock_file rw_file_perms;
+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 };
+allow 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 };
 ')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 var_run_nscd_t:sock_file rw_file_perms;
+allow nscd_shmem_domain nscd_var_run_t:sock_file rw_file_perms;
 allow nscd_shmem_domain { var_run_t var_t }:dir search;
 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 var_run_nscd_t:file read;
+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. 
@@ -60,3 +64,10 @@
 allow nscd_t shadow_t:file getattr;
 
 dontaudit nscd_t sysadm_home_dir_t:dir search;
+
+#
+# Handle winbind for samba, Might only be needed for targeted policy
+#
+dontaudit nscd_t var_run_t:sock_file rw_file_perms;
+
+
domains/program/unused/ntpd.te +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/ntpd.te policy-1.17.16/domains/program/unused/ntpd.te
@@ -8,7 +8,7 @@
 #
 # Rules for the ntpd_t domain.
 #
-daemon_domain(ntpd)
+daemon_domain(ntpd, `, nscd_client_domain')
 type ntp_drift_t, file_type, sysadmfile;
 type ntp_port_t, port_type;
 
domains/program/unused/portmap.te +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/portmap.te policy-1.17.16/domains/program/unused/portmap.te
@@ -11,7 +11,7 @@
 #
 # Rules for the portmap_t domain.
 #
-daemon_domain(portmap)
+daemon_domain(portmap, `, nscd_client_domain')
 
 can_network(portmap_t)
 can_ypbind(portmap_t)
domains/program/unused/squid.te +2 -1
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/squid.te policy-1.17.16/domains/program/unused/squid.te
@@ -13,7 +13,7 @@
 can_tcp_connect(squid_t, httpd_t)
 ')
 
-daemon_domain(squid, `, web_client_domain')
+daemon_domain(squid, `, web_client_domain, nscd_client_domain')
 type squid_conf_t, file_type, sysadmfile;
 
 allow { squid_t initrc_t } squid_conf_t:file r_file_perms;
@@ -66,3 +66,4 @@
 allow squid_t { bin_t sbin_t }:dir search;
 
 dontaudit squid_t { home_root_t security_t devpts_t }:dir getattr;
+dontaudit squid_t tty_device_t:chr_file { read write };
domains/program/unused/udev.te +2 -6
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/udev.te policy-1.17.16/domains/program/unused/udev.te
@@ -16,7 +16,7 @@
 etc_domain(udev)
 typealias udev_etc_t alias etc_udev_t;
 type udev_helper_exec_t, file_type, sysadmfile, exec_type;
-can_exec(udev_t, udev_helper_exec_t)
+can_exec_any(udev_t)
 
 #
 # Rules used for udev
@@ -42,8 +42,6 @@
 allow udev_t { bin_t sbin_t }:dir r_dir_perms;
 allow udev_t { sbin_t bin_t }:lnk_file read;
 allow udev_t bin_t:lnk_file read;
-can_exec(udev_t, { shell_exec_t bin_t sbin_t etc_t } )
-can_exec(udev_t, udev_exec_t)
 r_dir_file(udev_t, sysfs_t)
 allow udev_t sysadm_tty_device_t:chr_file { read write };
 
@@ -84,11 +82,9 @@
 ')
 allow udev_t var_log_t:dir { search };
 
-ifdef(`consoletype.te', `
-can_exec(udev_t, consoletype_exec_t)
-')
 ifdef(`pamconsole.te', `
 allow udev_t pam_var_console_t:dir search;
+allow udev_t pam_var_console_t:file { getattr read };
 ')
 allow udev_t var_lock_t:dir search;
 allow udev_t var_lock_t:file getattr;
macros/global_macros.te +2 -3
diff --exclude-from=exclude -N -u -r nsapolicy/macros/global_macros.te policy-1.17.16/macros/global_macros.te
@@ -217,8 +217,7 @@
 allow $1 proc_mdstat_t:file r_file_perms;
 
 # Stat /proc/kmsg and /proc/kcore.
-allow $1 proc_kmsg_t:file stat_file_perms;
-allow $1 proc_kcore_t:file stat_file_perms;
+allow $1 proc_fs:file stat_file_perms;
 
 # Read system variables in /proc/sys.
 read_sysctl($1)
@@ -552,7 +551,7 @@
 # pseudo filesystem types that are applied to both the filesystem
 # and its files.
 allow $1 { unlabeled_t fs_type }:dir_file_class_set *;
-allow $1 { proc_kmsg_t proc_kcore_t }: file *;
+allow $1 proc_fs: file *;
 
 # For /proc/pid
 r_dir_file($1,domain)
macros/program/mozilla_macros.te +2 -0
diff --exclude-from=exclude -N -u -r nsapolicy/macros/program/mozilla_macros.te policy-1.17.16/macros/program/mozilla_macros.te
@@ -71,6 +71,8 @@
 allow $1_lpr_t $1_mozilla_rw_t:file rw_file_perms;
 ')
 
+dontaudit $1_mozilla_t tmp_t:lnk_file read;
+
 #
 # This is another place where I sould like to allow system customization.
 # We need to allow the admin to select whether then want to allow mozilla
macros/program/ypbind_macros.te +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/macros/program/ypbind_macros.te policy-1.17.16/macros/program/ypbind_macros.te
@@ -10,8 +10,8 @@
 define(`can_ypbind', `
 r_dir_file($1,var_yp_t)
 can_network($1)
+dontaudit $1 reserved_port_t:{ tcp_socket udp_socket } name_bind;
 allow $1 port_t:{ tcp_socket udp_socket } name_bind;
-allow $1 $1:capability { net_bind_service };
 ') dnl can_ypbind
 ') dnl allow_ypbind
 ') dnl ypbind.te
tunables/distro.tun +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/tunables/distro.tun policy-1.17.16/tunables/distro.tun
@@ -5,7 +5,7 @@
 # appropriate ifdefs.
 
 
-dnl define(`distro_redhat')
+define(`distro_redhat')
 
 dnl define(`distro_suse')
 
tunables/tunable.tun +11 -11
diff --exclude-from=exclude -N -u -r nsapolicy/tunables/tunable.tun policy-1.17.16/tunables/tunable.tun
@@ -1,51 +1,51 @@
 # Allow all domains to connect to nscd
-dnl define(`nscd_all_connect')
+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')
+define(`unlimitedUtils')
 
 # Support NFS home directories
-dnl define(`nfs_home_dirs')
+define(`nfs_home_dirs')
 
 # Allow users to run games
-dnl define(`use_games')
+define(`use_games')
 
 # Allow ypbind to run with NIS
-dnl define(`allow_ypbind')
+define(`allow_ypbind')
 
 # 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 sysadm_t to do almost everything
 dnl define(`unrestricted_admin')
 
 # Allow the read/write/create on any NFS file system
-dnl define(`nfs_export_all_rw')
+define(`nfs_export_all_rw')
 
 # Allow the reading on any NFS file system
 dnl define(`nfs_export_all_ro')
 
 # 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.
types/procfs.te +5 -4
diff --exclude-from=exclude -N -u -r nsapolicy/types/procfs.te policy-1.17.16/types/procfs.te
@@ -11,11 +11,12 @@
 # proc_t is the type of /proc.
 # proc_kmsg_t is the type of /proc/kmsg.
 # proc_kcore_t is the type of /proc/kcore.
+# proc_mdtat_t is the type of /proc/mdstat.
 #
-type proc_t, fs_type, root_dir_type;
-type proc_kmsg_t;
-type proc_kcore_t;
-type proc_mdstat_t;
+type proc_t, fs_type, proc_fs, root_dir_type;
+type proc_kmsg_t, proc_fs;
+type proc_kcore_t, proc_fs;
+type proc_mdstat_t, proc_fs;
 
 #
 # sysctl_t is the type of /proc/sys.
#4 lore raw

domains/program/unused/nscd.te line 31

Quoted 10 lines · Daniel J Walsh

diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/nscd.te policy-1.17.16/domains/program/unused/nscd.te

domains/program/unused/nscd.te +2 -0
@@ -26,23 +26,27 @@
 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 };
+allow domain nscd_t:fd { use };
+dontaudit domain nscd_var_run_t:file { getattr read };
 dontaudit domain nscd_t:nscd { shmempwd shmemgrp shmemhost };

No, the nscd_t:fd use should also be dontaudit'd for that case; only domains with nscd_shmem_domain need to accept fds from nscd for mapping the cache. And I don't understand why you need the dontaudit rule, as the lack of shmempwd/shmemgrp/shmemhost permissions should prevent it from ever reaching that point at all - bug report on nscd, I'd suggest.

domains/program/unused/nscd.te line 40

Quoted 10 lines
domains/program/unused/nscd.te +3 -1
 ', `
 can_unix_connect(nscd_client_domain, nscd_t)
-allow nscd_client_domain var_run_nscd_t:sock_file rw_file_perms;
+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 };
+allow 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 };
 ')dnl nscd_all_connect

ditto.

Signature · 8 lines
Stephen Smalley <[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.
#5 lore raw

Merged the patch with dontaudit rules as Steve suggests below.

Quoted 30 lines · Stephen Smalley

domains/program/unused/nscd.te line 31

Quoted 10 lines · Daniel J Walsh

diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/nscd.te policy-1.17.16/domains/program/unused/nscd.te

domains/program/unused/nscd.te +2 -0
@@ -26,23 +26,27 @@
 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 };
+allow domain nscd_t:fd { use };
+dontaudit domain nscd_var_run_t:file { getattr read };
 dontaudit domain nscd_t:nscd { shmempwd shmemgrp shmemhost };

No, the nscd_t:fd use should also be dontaudit'd for that case; only domains with nscd_shmem_domain need to accept fds from nscd for mapping the cache. And I don't understand why you need the dontaudit rule, as the lack of shmempwd/shmemgrp/shmemhost permissions should prevent it from ever reaching that point at all - bug report on nscd, I'd suggest.

domains/program/unused/nscd.te line 40

Quoted 10 lines
domains/program/unused/nscd.te +3 -1
 ', `
 can_unix_connect(nscd_client_domain, nscd_t)
-allow nscd_client_domain var_run_nscd_t:sock_file rw_file_perms;
+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 };
+allow 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 };
 ')dnl nscd_all_connect

ditto.

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.
#6 lore raw

Small fixes for Firefox/Mozilla

In reply to Daniel J Walsh

Allow reading of /etc/mozpluggetrc

Also fix shlib problem in tls directories.

domains/program/unused/mozilla.te +1 -0
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/mozilla.te policy-1.17.16/domains/program/unused/mozilla.te
@@ -6,6 +6,7 @@
 
 # Type for the netscape, mozilla or other browser executables.
 type mozilla_exec_t, file_type, sysadmfile, exec_type;
+type mozilla_conf_t, file_type, sysadmfile, exec_type;
 
 # Allow mozilla to read files in the user home directory
 bool mozilla_readhome false;
file_contexts/program/mozilla.fc +1 -0
diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/program/mozilla.fc policy-1.17.16/file_contexts/program/mozilla.fc
@@ -17,3 +17,4 @@
 /usr/lib(64)?/mozilla[^/]*/mozilla-.* --	system_u:object_r:mozilla_exec_t
 /usr/lib(64)?/firefox[^/]*/mozilla-.* --	system_u:object_r:mozilla_exec_t
 /usr/lib(64)?/[^/]*firefox[^/]*/firefox-bin --	system_u:object_r:mozilla_exec_t
+/etc/mozpluggerrc system_u:object_r:mozilla_conf_t
file_contexts/types.fc +1 -0
diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/types.fc policy-1.17.16/file_contexts/types.fc
@@ -298,6 +298,7 @@
 /lib(64)?/[^/]*/lib[^/]*\.so(\.[^/]*)*	--	system_u:object_r:shlib_t
 /lib(64)?/security/[^/]*\.so(\.[^/]*)*	--	system_u:object_r:shlib_t
 /lib(64)?/tls/i686/cmov/[^/]*\.so(\.[^/]*)* --	system_u:object_r:shlib_t
+/lib(64)?/tls/i486/[^/]*\.so(\.[^/]*)* --	system_u:object_r:shlib_t
 
 #
 # /sbin
macros/program/mozilla_macros.te +2 -0
diff --exclude-from=exclude -N -u -r nsapolicy/macros/program/mozilla_macros.te policy-1.17.16/macros/program/mozilla_macros.te
@@ -111,6 +111,8 @@
 ')
 allow $1_mozilla_t $1_t:tcp_socket { read write };
 
+allow $1_mozilla_t mozilla_conf_t:file r_file_perms;
+dontaudit $1_mozilla_t bin_t:dir { getattr };
 dontaudit $1_mozilla_t port_type:tcp_socket { name_bind };
 dontaudit $1_mozilla_t dri_device_t:chr_file rw_file_perms;
 
tunables/distro.tun +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/tunables/distro.tun policy-1.17.16/tunables/distro.tun
@@ -5,7 +5,7 @@
 # appropriate ifdefs.
 
 
-dnl define(`distro_redhat')
+define(`distro_redhat')
 
 dnl define(`distro_suse')
 
tunables/tunable.tun +11 -11
diff --exclude-from=exclude -N -u -r nsapolicy/tunables/tunable.tun policy-1.17.16/tunables/tunable.tun
@@ -1,51 +1,51 @@
 # Allow all domains to connect to nscd
-dnl define(`nscd_all_connect')
+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')
+define(`unlimitedUtils')
 
 # Support NFS home directories
-dnl define(`nfs_home_dirs')
+define(`nfs_home_dirs')
 
 # Allow users to run games
-dnl define(`use_games')
+define(`use_games')
 
 # Allow ypbind to run with NIS
-dnl define(`allow_ypbind')
+define(`allow_ypbind')
 
 # 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 sysadm_t to do almost everything
 dnl define(`unrestricted_admin')
 
 # Allow the read/write/create on any NFS file system
-dnl define(`nfs_export_all_rw')
+define(`nfs_export_all_rw')
 
 # Allow the reading on any NFS file system
 dnl define(`nfs_export_all_ro')
 
 # 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.
types/file.te +1 -0
diff --exclude-from=exclude -N -u -r nsapolicy/types/file.te policy-1.17.16/types/file.te
@@ -264,6 +264,7 @@
 
 # Allow the pty to be associated with the file system.
 allow devpts_t devpts_t:filesystem associate;
+allow ttyfile tmpfs_t:filesystem { associate };
 
 type tmpfs_t, file_type, sysadmfile, fs_type, root_dir_type;
 allow { tmpfs_t tmp_t } tmpfs_t:filesystem associate;
#7 lore raw
In reply to Daniel J Walsh
Quoted 9 lines · Daniel J Walsh
Quoted 8 lines

domains/program/unused/nscd.te line 71

Quoted 4 lines
domains/program/unused/nscd.te +4 -0
+#
+# Handle winbind for samba, Might only be needed for targeted policy
+#
+dontaudit nscd_t var_run_t:sock_file rw_file_perms;

This doesn't make sense; nscd_t has these permissions as a consequence of having nscd_client_domain attribute in the policy (since it is used for both the client and the daemon).

Quoted 3 lines

I don't believ nscd_t has access to var_run_t. It can do this to
nscd_var_run_t. It is
trying to communicate with a socket created by winbind.

Any reference to var_run_t:sock_file should have ifdef(`targetted' around it.

In strict policy there will be no var_run_t:sock_file.

Signature · 9 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

--
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.