Skip to contentSkip to conversation

Small policy cleanups

PATCH Thomas Bleher 2 participants 2 messages Oct 18, 2005 – Oct 20, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

Some cleanups:
* Use 'self' in a few places where it was missing
* Remove kerberos_master_port_t as it is not used anywhere
* Assign attribute proc_fs to type mtrr_device_t as it is used both for /dev/cpu/mtrr and /proc/mtrr
* add reserved_port_t to dontaudit for userdomain name_bind, as it is not part of reserved_port_type
* check for xdm.te inside can_pipe_xdm() and remove redundant checks
* Fix a bug in user_macros.te

Please apply.

Thomas

Signature · 2 lines
http://www.cip.ifi.lmu.de/~bleher/selinux/ - my SELinux pages
GPG-Fingerprint: BC4F BB16 30D6 F253 E3EA  D09E C562 2BAE B2F4 ABE7
macros/program/bonobo_macros.te +0 -2
diff -ur orig/macros/program/bonobo_macros.te mod/macros/program/bonobo_macros.te
@@ -72,9 +72,7 @@
 # here temporarily, since bonobo runs as ROLE_t by default anyway
 domain_auto_trans($1_bonobo_t, bin_t, $1_t) 
 
-ifdef(`xdm.te', `
 can_pipe_xdm($1_bonobo_t)
-')
   
 ') dnl ifdef bonobo_domain_args
 ') dnl bonobo_domain
macros/program/crontab_macros.te +1 -1
diff -ur orig/macros/program/crontab_macros.te mod/macros/program/crontab_macros.te
@@ -40,7 +40,7 @@
 
 # Use capabilities dac_override is to create the file in the directory
 # under /tmp
-allow $1_crontab_t $1_crontab_t:capability { setuid setgid chown dac_override };
+allow $1_crontab_t self:capability { setuid setgid chown dac_override };
 
 # Type for temporary files.
 file_type_auto_trans($1_crontab_t, tmp_t, $1_tmp_t, { dir file })
macros/program/dbusd_macros.te +1 -3
diff -ur orig/macros/program/dbusd_macros.te mod/macros/program/dbusd_macros.te
@@ -29,9 +29,7 @@
 r_dir_file($1_dbusd_t, etc_dbusd_t)
 tmp_domain($1_dbusd) 
 allow $1_dbusd_t self:process fork;
-ifdef(`xdm.te', `
 can_pipe_xdm($1_dbusd_t)
-')
 
 allow $1_dbusd_t self:unix_stream_socket create_stream_socket_perms;
 allow $1_dbusd_t self:unix_dgram_socket create_socket_perms;
@@ -71,11 +69,11 @@
 # For connecting to the bus
 allow $2_t $1_dbusd_t:unix_stream_socket connectto;
 
-') dnl endif dbusd.te
 ifelse(`system', `$1', `
 allow { $2_t } { var_run_t system_dbusd_var_run_t }:dir search;
 allow { $2_t } system_dbusd_var_run_t:sock_file write;
 ',`') dnl endif system
+') dnl endif dbusd.te
 ')
 
 # can_dbusd_converse(dbus_type, domain_prefix_a, domain_prefix_b)
macros/program/gconf_macros.te +1 -1
diff -ur orig/macros/program/gconf_macros.te mod/macros/program/gconf_macros.te
@@ -31,8 +31,8 @@
 # /tmp/gconfd-USER
 tmp_domain($1_gconfd)
 
-ifdef(`xdm.te', `
 can_pipe_xdm($1_gconfd_t)
+ifdef(`xdm.te', `
 allow xdm_t $1_gconfd_t:process signal;
 ')
 
macros/program/gift_macros.te +0 -2
diff -ur orig/macros/program/gift_macros.te mod/macros/program/gift_macros.te
@@ -90,9 +90,7 @@
 r_dir_file($1_giftd_t, usr_t)
 
 # Connect to xdm
-ifdef(`xdm.te', `
 can_pipe_xdm($1_giftd_t)
-') 
 
 ') dnl giftd_domain
 
macros/program/gpg_macros.te +0 -2
diff -ur orig/macros/program/gpg_macros.te mod/macros/program/gpg_macros.te
@@ -108,8 +108,6 @@
 # for nscd
 dontaudit $1_gpg_helper_t var_t:dir search;
 
-ifdef(`xdm.te', `
 can_pipe_xdm($1_gpg_t)
-')
 
 ')dnl end gpg_domain definition
macros/program/lpr_macros.te +1 -1
diff -ur orig/macros/program/lpr_macros.te mod/macros/program/lpr_macros.te
@@ -39,7 +39,7 @@
 can_ypbind($1_lpr_t)
 
 # Use capabilities.
-allow $1_lpr_t $1_lpr_t:capability { setuid dac_override net_bind_service chown };
+allow $1_lpr_t self:capability { setuid dac_override net_bind_service chown };
 
 allow $1_lpr_t self:unix_stream_socket create_stream_socket_perms;
 
macros/program/xdm_macros.te +2 -0
diff -ur orig/macros/program/xdm_macros.te mod/macros/program/xdm_macros.te
@@ -6,6 +6,8 @@
 #
 
 define(`can_pipe_xdm', `
+ifdef(`xdm.te', `
 allow $1 xdm_t:fd use;
 allow $1 xdm_t:fifo_file { getattr read write ioctl };
+')
 ') dnl can_pipe_xdm
macros/user_macros.te +3 -2
diff -ur orig/macros/user_macros.te mod/macros/user_macros.te
@@ -143,7 +143,7 @@
 allow $1_t port_t:tcp_socket name_bind;
 }
 # port access is audited even if dac would not have allowed it, so dontaudit it here
-dontaudit $1_t reserved_port_type:tcp_socket name_bind;
+dontaudit $1_t { reserved_port_type reserved_port_t }:tcp_socket name_bind;
 
 # Allow system log read
 if (user_dmesg) {
@@ -203,6 +203,7 @@
 
 # Grant read/search permissions to some of /proc.
 r_dir_file($1_t, proc_t)
+# netstat needs to access proc_net_t; if you want to hide this info use dontaudit here instead
 r_dir_file($1_t, proc_net_t)
 
 base_file_read_access($1_t)
@@ -225,7 +226,7 @@
 
 allow $1_t self:dir search;
 allow $1_t self:file { getattr read };
-allow secadm_t self:fifo_file rw_file_perms;
+allow $1_t self:fifo_file rw_file_perms;
 
 allow $1_t self:lnk_file read;
 allow $1_t self:unix_stream_socket create_socket_perms;

Nur in mod/macros: user_macros.te.orig.

net_contexts +0 -2
diff -ur orig/net_contexts mod/net_contexts
@@ -111,8 +111,6 @@
 portcon tcp 749 system_u:object_r:kerberos_admin_port_t
 portcon tcp 750 system_u:object_r:kerberos_port_t
 portcon udp 750 system_u:object_r:kerberos_port_t
-portcon tcp 4444 system_u:object_r:kerberos_master_port_t
-portcon udp 4444 system_u:object_r:kerberos_master_port_t
 portcon tcp 783 system_u:object_r:spamd_port_t
 portcon tcp 540 system_u:object_r:uucpd_port_t
 portcon tcp 2401 system_u:object_r:cvs_port_t
types/device.te +2 -2
diff -ur orig/types/device.te mod/types/device.te
@@ -131,8 +131,8 @@
 # Type for /dev/.devfsd
 type devfs_control_t, device_type, dev_fs;
 
-# Type for /dev/cpu/mtrr
-type mtrr_device_t, device_type, dev_fs;
+# Type for /dev/cpu/mtrr and /proc/mtrr
+type mtrr_device_t, device_type, dev_fs, proc_fs;
 
 # Type for /dev/pmu 
 type power_device_t, device_type, dev_fs;
types/network.te +0 -1
diff -ur orig/types/network.te mod/types/network.te
@@ -45,7 +45,6 @@
 #
 type kerberos_port_t, port_type, reserved_port_type;
 type kerberos_admin_port_t, port_type, reserved_port_type;
-type kerberos_master_port_t, port_type;
 
 #
 # Ports used to communicate with portmap server
#1 lore raw

Merged.

Quoted 14 lines · Thomas Bleher

Some cleanups:
* Use 'self' in a few places where it was missing
* Remove kerberos_master_port_t as it is not used anywhere
* Assign attribute proc_fs to type mtrr_device_t as it is used both for /dev/cpu/mtrr and /proc/mtrr
* add reserved_port_t to dontaudit for userdomain name_bind, as it is not part of reserved_port_type
* check for xdm.te inside can_pipe_xdm() and remove redundant checks
* Fix a bug in user_macros.te

Please apply.

Thomas

Signature · 8 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.