patch: various stuff
Some stuff that got forgotten from my previous patches. A few comments:
* hostname.te: sysadm_t should run hostname directly, it has the necessary privs and makes many things easier (eg redirections in scripts). The can_resolve() was necessary because (at least on SuSE) hostname does some dns-lookups. If noone else sees this it could be put inside an ifdef(`distro_suse',).
* checkpolicy.fc: These labels are unnecessary and just cause unnecessary relabels.
* user_macros.te: This may need some discussion. netstat needs to access /proc/net in order to work. Not sure if we want to allow this. Maybe a boolean?
Thomas
--
http://www.cip.ifi.lmu.de/~bleher/selinux/ - my SELinux pages
GPG-Fingerprint: BC4F BB16 30D6 F253 E3EA D09E C562 2BAE B2F4 ABE7
domains/program/fsadm.te +1 -2
@@ -22,8 +22,7 @@ allow fsadm_t sysfs_t:dir { search getattr }; # Read system information files in /proc. -allow fsadm_t proc_t:dir r_dir_perms; -allow fsadm_t proc_t:notdevfile_class_set r_file_perms; +r_dir_file(fsadm_t, proc_t) # Read system variables in /proc/sys allow fsadm_t sysctl_kernel_t:file r_file_perms;
domains/program/hostname.te +1 -1
@@ -5,7 +5,6 @@ # for setting the hostname daemon_base_domain(hostname, , nosysadm) -domain_auto_trans(sysadm_t, hostname_exec_t, hostname_t) role sysadm_r types hostname_t; allow hostname_t self:capability sys_admin;
@@ -13,6 +12,7 @@ allow hostname_t { user_tty_type admin_tty_type }:chr_file { getattr read write }; read_locale(hostname_t) +can_resolve(hostname_t) allow hostname_t userdomain:fd use; dontaudit hostname_t kernel_t:fd use; allow hostname_t net_conf_t:file { getattr read };
domains/program/setfiles.te +2 -0
@@ -44,6 +44,8 @@ allow setfiles_t unlabeled_t:dir read; allow setfiles_t { device_type device_t }:{ chr_file blk_file } { getattr relabelfrom relabelto }; allow setfiles_t { ttyfile ptyfile }:chr_file getattr; +# dontaudit access to ttyfile - we do not want setfiles to relabel our terminal +dontaudit setfiles_t ttyfile:chr_file relabelfrom; allow setfiles_t fs_t:filesystem getattr; allow setfiles_t fs_type:dir r_dir_perms;
file_contexts/program/checkpolicy.fc +0 -2
@@ -1,4 +1,2 @@ # checkpolicy /usr/bin/checkpolicy -- system_u:object_r:checkpolicy_exec_t -/etc/selinux/policy/policy.* -- system_u:object_r:policy_config_t -/etc/selinux/.*/src/policy/policy.* -- system_u:object_r:policy_config_t
macros/program/cdrecord_macros.te +1 -1
@@ -21,7 +21,7 @@ allow $1_cdrecord_t $1_devpts_t:chr_file rw_file_perms; allow $1_cdrecord_t privfd:fd use; -allow $1_cdrecord_t $1_t:unix_stream_socket { getattr read write }; +allow $1_cdrecord_t $1_t:unix_stream_socket { getattr read write ioctl }; allow $1_cdrecord_t self:unix_dgram_socket create_socket_perms; allow $1_cdrecord_t self:unix_stream_socket create_stream_socket_perms;
macros/program/chkpwd_macros.te +2 -0
@@ -66,7 +66,9 @@ r_dir_file($1_chkpwd_t, selinux_config_t) # for nscd +ifdef(`nscd.te', `', ` dontaudit $1_chkpwd_t var_t:dir search; +') dontaudit $1_chkpwd_t fs_t:filesystem getattr; ')
macros/program/irc_macros.te +1 -6
@@ -21,12 +21,7 @@ # Derived domain based on the calling user domain and the program. type $1_irc_t, domain; type $1_home_irc_t, file_type, $1_file_type, sysadmfile; -type $1_irc_exec_t, file_type, sysadmfile; - -ifdef(`slocate.te', ` -allow $1_locate_t { $1_home_irc_t $1_irc_exec_t }:dir { getattr search }; -allow $1_locate_t { $1_home_irc_t $1_irc_exec_t }:file { getattr read }; -') +type $1_irc_exec_t, file_type, sysadmfile, $1_file_type; allow $1_t { $1_home_irc_t $1_irc_exec_t }:file { relabelfrom relabelto create_file_perms };
macros/program/mta_macros.te +1 -0
@@ -34,6 +34,7 @@ uses_shlib($1_mail_t) can_network_client_tcp($1_mail_t) +can_resolve($1_mail_t) can_ypbind($1_mail_t) allow $1_mail_t self:unix_dgram_socket create_socket_perms; allow $1_mail_t self:unix_stream_socket create_socket_perms;
macros/program/resmgrd_macros.te +1 -0
@@ -3,6 +3,7 @@ define(`can_resmgrd_connect', ` ifdef(`resmgrd.te', ` allow $1 resmgrd_t:unix_stream_socket connectto; +allow $1 { var_t var_run_t }:dir search; allow $1 resmgrd_var_run_t:sock_file write; allow $1 resmgrd_t:fd use; ')
macros/program/ssh_macros.te +7 -1
@@ -85,6 +85,12 @@ can_network_client_tcp($1_ssh_t) can_resolve($1_ssh_t) can_ypbind($1_ssh_t) +can_kerberos($1_ssh_t) + +# for port forwarding +if (user_tcp_server) { +allow $1_ssh_t port_t:tcp_socket name_bind; +} # Use capabilities. allow $1_ssh_t self:capability { setuid setgid dac_override dac_read_search };
@@ -152,7 +158,7 @@ allow $1_ssh_t xdm_xserver_t:shm r_shm_perms; allow $1_ssh_t xdm_xserver_t:fd use; allow $1_ssh_t xdm_xserver_tmpfs_t:file read; -can_kerberos($1_ssh_t) +allow $1_ssh_t xdm_t:fd use; ')dnl end if xdm.te ')dnl end macro definition
macros/user_macros.te +4 -0
@@ -75,6 +75,8 @@ if (user_tcp_server) { 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; # Allow system log read if (user_dmesg) {
@@ -134,6 +136,8 @@ attribute $1_file_type; # 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)
Merged.
Quoted 20 lines · Thomas Bleher
Some stuff that got forgotten from my previous patches. A few comments:
* hostname.te:
sysadm_tshould run hostname directly, it has the necessary privs and makes many things easier (eg redirections in scripts). Thecan_resolve()was necessary because (at least on SuSE) hostname does some dns-lookups. If noone else sees this it could be put inside an ifdef(`distro_suse',).* checkpolicy.fc: These labels are unnecessary and just cause unnecessary relabels.
* user_macros.te: This may need some discussion. netstat needs to access
/proc/netin order to work. Not sure if we want to allow this. Maybe a boolean?Thomas
--
http://www.cip.ifi.lmu.de/~bleher/selinux/ - my SELinux pages
GPG-Fingerprint: BC4F BB16 30D6 F253 E3EA D09E C562 2BAE B2F4 ABE7
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.