Skip to contentSkip to conversation

patch for home_root_t

PATCH Russell Coker 2 participants 4 messages Sep 27, 2002 – Oct 1, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The attached patch makes home_root_t work.

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
usr/share/selinux/policy/current/domains/admin.te renamed from usr/share/selinux/policy/default/domains/admin.te +1 -0
diff -ru /usr/share/selinux/policy/default/domains/admin.te /usr/share/selinux/policy/current/domains/admin.te
@@ -4,6 +4,7 @@
 
 # sysadm_t is the system administrator domain.
 type sysadm_t, domain, privlog, privowner, admin, userdomain, privhome;
+allow privhome home_root_t:dir search;
 
 # system_r is authorized for sysadm_t for single-user mode.
 role system_r types sysadm_t; 
usr/share/selinux/policy/current/domains/program/apache.te renamed from usr/share/selinux/policy/default/domains/program/apache.te +3 -1
diff -ru /usr/share/selinux/policy/default/domains/program/apache.te /usr/share/selinux/policy/current/domains/program/apache.te
@@ -241,6 +241,7 @@
 # Allow the script process to search the cgi directory, and users directory
 ##############################################################################
 allow httpd_user_script_process_t httpd_user_script_t:dir {search add_name};
+allow httpd_user_script_process_t home_root_t:dir { getattr search };
 allow httpd_user_script_process_t user_home_dir_type:dir {getattr search};
 allow httpd_user_script_process_t httpd_user_content_t:dir {search};
 allow httpd_user_script_process_t httpd_sys_script_t:dir {search};
@@ -383,7 +384,8 @@
 ###################
 # Allow httpd to search users diretories
 ######################
-allow httpd_t { user_home_dir_type user_home_type }:dir { getattr search };
+allow httpd_t home_root_t:dir { getattr search };
+allow httpd_t user_home_dir_type:dir { getattr search };
 allow httpd_t user_home_type:dir { getattr search read };
 # need ioctl for php3
 allow httpd_t user_home_type:{ file lnk_file } { getattr read ioctl };
usr/share/selinux/policy/current/domains/program/crond.te renamed from usr/share/selinux/policy/default/domains/program/crond.te +1 -0
diff -ru /usr/share/selinux/policy/default/domains/program/crond.te /usr/share/selinux/policy/current/domains/program/crond.te
@@ -83,6 +83,7 @@
 allow crond_t sysadm_home_dir_t:dir r_dir_perms;
 
 # to search /home
+allow crond_t home_root_t:dir { getattr search };
 allow crond_t user_home_dir_type:dir r_dir_perms;
 
 # Run a shell.
usr/share/selinux/policy/current/domains/program/fcron.te renamed from usr/share/selinux/policy/default/domains/program/fcron.te +1 -1
diff -ru /usr/share/selinux/policy/default/domains/program/fcron.te /usr/share/selinux/policy/current/domains/program/fcron.te
@@ -44,7 +44,7 @@
 allow fcron_t etc_t:lnk_file read;
 allow fcron_t { etc_t resolv_conf_t }:file { read getattr };
 
-allow fcron_t { sysadm_home_dir_t user_home_dir_type }:dir search;
+allow fcron_t { home_root_t sysadm_home_dir_t user_home_dir_type }:dir search;
 
 # Permit fcron_t to transition to this domain.
 # The transition is requested explicitly by the modified crond
usr/share/selinux/policy/current/domains/program/fingerd.te renamed from usr/share/selinux/policy/default/domains/program/fingerd.te +1 -1
diff -ru /usr/share/selinux/policy/default/domains/program/fingerd.te /usr/share/selinux/policy/current/domains/program/fingerd.te
@@ -55,7 +55,7 @@
 can_tcp_connect(userdomain, fingerd_t)
 
 # for .finger, .plan. etc
-allow fingerd_t user_home_dir_type:dir search;
+allow fingerd_t { home_root_t user_home_dir_type }:dir search;
 # should really have a different type for .plan etc
 allow fingerd_t user_home_type:file { getattr read };
 # stop it accessing sub-directories, prevents checking a Maildir for new mail,
usr/share/selinux/policy/current/domains/program/gpg.te renamed from usr/share/selinux/policy/default/domains/program/gpg.te +1 -2
diff -ru /usr/share/selinux/policy/default/domains/program/gpg.te /usr/share/selinux/policy/current/domains/program/gpg.te
@@ -6,8 +6,7 @@
 # Type for gpg or pgp executables.
 type gpg_exec_t, file_type, sysadmfile, exec_type;
 
-allow sysadm_gpg_t user_home_dir_t:dir search;
-allow sysadm_gpg_t newrole_t:fd use;
+allow sysadm_gpg_t { home_root_t user_home_dir_t }:dir search;
 allow sysadm_gpg_t ptyfile:chr_file rw_file_perms;
 
 # Everything else is in the gpg_domain macro in
usr/share/selinux/policy/current/domains/program/initrc.te renamed from usr/share/selinux/policy/default/domains/program/initrc.te +1 -1
diff -ru /usr/share/selinux/policy/default/domains/program/initrc.te /usr/share/selinux/policy/current/domains/program/initrc.te
@@ -213,7 +213,7 @@
 allow initrc_t file_t:file { unlink getattr };
 
 # Read user home directories.
-allow initrc_t home_type:dir r_dir_perms;
+allow initrc_t { home_root_t home_type }:dir r_dir_perms;
 allow initrc_t home_type:file r_file_perms;
 
 # for system start scripts
usr/share/selinux/policy/current/domains/program/login.te renamed from usr/share/selinux/policy/default/domains/program/login.te +2 -0
diff -ru /usr/share/selinux/policy/default/domains/program/login.te /usr/share/selinux/policy/current/domains/program/login.te
@@ -39,6 +39,7 @@
 domain_trans(local_login_t, shell_exec_t, userdomain)
 
 # Permit login to search the user home directories.
+allow local_login_t home_root_t:dir search;
 allow local_login_t home_dir_type:dir search;
 
 # Do not audit denied attempts to access devices.
@@ -122,6 +123,7 @@
 # Only permit unprivileged user domains to be entered via rlogin,
 # since very weak authentication is used.
 domain_trans(remote_login_t, shell_exec_t, unpriv_userdomain)
+allow remote_login_t home_root_t:dir search;
 allow remote_login_t home_dir_type:dir search;
 
 # Use the pty created by rlogind.
usr/share/selinux/policy/current/domains/program/modutil.te renamed from usr/share/selinux/policy/default/domains/program/modutil.te +1 -1
diff -ru /usr/share/selinux/policy/default/domains/program/modutil.te /usr/share/selinux/policy/current/domains/program/modutil.te
@@ -43,7 +43,7 @@
 ifdef(`gnome-pty-helper.te', `allow depmod_t sysadm_gph_t:fd use;')
 
 # Read System.map from home directories.
-allow depmod_t { user_home_dir_type sysadm_home_dir_t }:dir r_dir_perms;
+allow depmod_t { home_root_t user_home_dir_type sysadm_home_dir_t }:dir r_dir_perms;
 r_dir_file(depmod_t, { user_home_type sysadm_home_t })
 
 # Rules for /proc/sys/kernel/tainted
usr/share/selinux/policy/current/domains/program/portslave.te renamed from usr/share/selinux/policy/default/domains/program/portslave.te +1 -1
diff -ru /usr/share/selinux/policy/default/domains/program/portslave.te /usr/share/selinux/policy/current/domains/program/portslave.te
@@ -49,7 +49,7 @@
 allow portslave_t ppp_device_t:chr_file rw_file_perms;
 
 # for ~/.ppprc - if it actually exists then you need some policy to read it
-allow portslave_t { sysadm_home_dir_t user_home_dir_type }:dir search;
+allow portslave_t { sysadm_home_dir_t home_root_t user_home_dir_type }:dir search;
 
 file_type_auto_trans(portslave_t, var_run_t, var_run_pppd_t)
 can_exec(portslave_t, { etc_t shell_exec_t })
usr/share/selinux/policy/current/domains/program/pppd.te renamed from usr/share/selinux/policy/default/domains/program/pppd.te +1 -1
diff -ru /usr/share/selinux/policy/default/domains/program/pppd.te /usr/share/selinux/policy/current/domains/program/pppd.te
@@ -66,7 +66,7 @@
 allow pppd_t etc_t:lnk_file read;
 
 # for ~/.ppprc - if it actually exists then you need some policy to read it
-allow pppd_t { sysadm_home_dir_t user_home_dir_type }:dir search;
+allow pppd_t { sysadm_home_dir_t home_root_t user_home_dir_type }:dir search;
 
 ifdef(`pppd_for_user', `
 # Run pppd in pppd_t by default for user
usr/share/selinux/policy/current/domains/program/ssh.te renamed from usr/share/selinux/policy/default/domains/program/ssh.te +1 -1
diff -ru /usr/share/selinux/policy/default/domains/program/ssh.te /usr/share/selinux/policy/current/domains/program/ssh.te
@@ -12,7 +12,7 @@
 allow $1 self:capability { chown dac_override fowner fsetid setgid setuid net_bind_service sys_tty_config };
 can_network($1)
 allow $1 shadow_t:file { read getattr };
-allow $1 { user_home_dir_type sysadm_home_dir_t }:dir { search getattr };
+allow $1 { home_root_t user_home_dir_type sysadm_home_dir_t }:dir { search getattr };
 
 # Run shells in user_t by default
 domain_auto_trans($1, shell_exec_t, user_t)
usr/share/selinux/policy/current/domains/program/xdm.te renamed from usr/share/selinux/policy/default/domains/program/xdm.te +1 -0
diff -ru /usr/share/selinux/policy/default/domains/program/xdm.te /usr/share/selinux/policy/current/domains/program/xdm.te
@@ -111,6 +111,7 @@
 allow xdm_t userdomain:{ file lnk_file } r_file_perms;
 
 # Allow xdm access to the user domains
+allow xdm_t home_root_t:dir search;
 allow xdm_t home_type:dir { write search add_name remove_name create setattr };
 allow xdm_t home_type:file { create link read append  write setattr unlink };
 allow xdm_t userdomain:shm { unix_read unix_write read write getattr associate  };
usr/share/selinux/policy/current/macros/program/crontab_macros.te renamed from usr/share/selinux/policy/default/macros/program/crontab_macros.te +1 -0
diff -ru /usr/share/selinux/policy/default/macros/program/crontab_macros.te /usr/share/selinux/policy/current/macros/program/crontab_macros.te
@@ -65,6 +65,7 @@
 can_network($1_crontab_t)
 
 # Read user crontabs 
+allow $1_crontab_t home_root_t:dir search;
 allow $1_crontab_t { $1_home_t $1_home_dir_t }:dir r_dir_perms;  
 allow $1_crontab_t $1_home_t:file r_file_perms;  
 
usr/share/selinux/policy/current/macros/program/gpg_macros.te renamed from usr/share/selinux/policy/default/macros/program/gpg_macros.te +2 -0
diff -ru /usr/share/selinux/policy/default/macros/program/gpg_macros.te /usr/share/selinux/policy/current/macros/program/gpg_macros.te
@@ -57,6 +57,8 @@
 
 uses_shlib($1_gpg_t)
 
+allow $1_gpg_t home_root_t:dir search;
+
 # use $1_gpg_secret_t for files it creates
 # NB we are doing the type transition for directory creation only!
 # so ~/.gnupg will be of $1_gpg_secret_t, then files created under it such as
usr/share/selinux/policy/current/macros/program/gph_macros.te renamed from usr/share/selinux/policy/default/macros/program/gph_macros.te +1 -0
diff -ru /usr/share/selinux/policy/default/macros/program/gph_macros.te /usr/share/selinux/policy/current/macros/program/gph_macros.te
@@ -66,6 +66,7 @@
 allow $1_gph_t lastlog_t:file rw_file_perms;
 
 # Allow gnome-pty-helper to write the .xsession-errors file.
+allow $1_gph_t home_root_t:dir search;
 allow $1_gph_t $1_home_t:dir { search add_name };
 allow $1_gph_t $1_home_t:file { create write };
 ')
usr/share/selinux/policy/current/macros/program/lpr_macros.te renamed from usr/share/selinux/policy/default/macros/program/lpr_macros.te +1 -0
diff -ru /usr/share/selinux/policy/default/macros/program/lpr_macros.te /usr/share/selinux/policy/current/macros/program/lpr_macros.te
@@ -56,6 +56,7 @@
 ifdef(`gnome-pty-helper.te', `allow $1_lpr_t $1_gph_t:fd use;')
 
 # Read user files. 
+allow $1_lpr_t home_root_t:dir search;
 allow $1_lpr_t { $1_home_t $1_home_dir_t }:dir search;  
 allow $1_lpr_t $1_home_t:{ file lnk_file } r_file_perms;  
 
usr/share/selinux/policy/current/macros/program/mta_macros.te renamed from usr/share/selinux/policy/default/macros/program/mta_macros.te +1 -0
diff -ru /usr/share/selinux/policy/default/macros/program/mta_macros.te /usr/share/selinux/policy/current/macros/program/mta_macros.te
@@ -72,6 +72,7 @@
 ifdef(`gnome-pty-helper.te', `allow $1_mail_t $1_gph_t:fd use;')
 
 # Create dead.letter in user home directories.
+allow $1_mail_t home_root_t:dir search;
 file_type_auto_trans($1_mail_t, $1_home_dir_t, $1_home_t)
 
 # if you do not want to allow dead.letter then use the following instead
usr/share/selinux/policy/current/macros/program/netscape_macros.te renamed from usr/share/selinux/policy/default/macros/program/netscape_macros.te +1 -0
diff -ru /usr/share/selinux/policy/default/macros/program/netscape_macros.te /usr/share/selinux/policy/current/macros/program/netscape_macros.te
@@ -100,6 +100,7 @@
 allow $1_netscape_t $1_devpts_t:chr_file rw_file_perms;
 
 # Read the home directory, e.g. for .Xauthority and to get to .netscape.
+allow $1_netscape_t home_root_t:dir search;
 file_type_auto_trans($1_netscape_t, $1_home_dir_t, $1_netscape_rw_t)
 # for .Xauthority - need different perms for this
 allow $1_netscape_t $1_home_t:file { read getattr };
usr/share/selinux/policy/current/macros/program/xserver_macros.te renamed from usr/share/selinux/policy/default/macros/program/xserver_macros.te +2 -0
diff -ru /usr/share/selinux/policy/default/macros/program/xserver_macros.te /usr/share/selinux/policy/current/macros/program/xserver_macros.te
@@ -123,6 +123,8 @@
 # Use the mouse.
 allow $1_xserver_t mouse_device_t:chr_file rw_file_perms;
 
+allow $1_xserver_t home_root_t:dir search;
+
 ifelse($1, xdm, `
 dontaudit xdm_xserver_t sysadm_home_dir_t:dir { read search };
 ', `
#1 lore raw
Quoted 1 line · Russell Coker

The attached patch makes home_root_t work.

Most of this should already be covered by the rule in base_file_read_access.

--
Stephen D. Smalley, NAI Labs
[email protected]

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

#2 lore raw
Quoted 5 lines · Stephen Smalley
Quoted 1 line · Russell Coker

The attached patch makes home_root_t work.

Most of this should already be covered by the rule in base_file_read_access.

I've gone back and removed some duplicate references to home_root_t from my tree.

After you've merged those of my current patches that you like I'll send you another patch for any further changes.

NB Many of the home_root_t (and almost all of them in .te files I wrote) are actually needed. Most things broke when I initially changed the type of /home...

Signature · 10 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.
#3 lore raw
In reply to Russell Coker
Quoted 1 line · Russell Coker

The attached patch makes home_root_t work.

I merged this patch, although some of the rules are redundant with the corresponding rule in base_file_read_access, which is included by every_domain.

--
Stephen D. Smalley, NAI Labs
[email protected]

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