small passwd.te zsh fixes
Subsystems (2)
Hi,
I use zsh, and on my Debian system the setup looks like:
monk:/home/walters# lc /bin/zsh* lrwxrwxrwx root root system_u:object_r:shell_exec_t /bin/zsh -> /etc/alternatives/zsh -rwxr-xr-x root root system_u:object_r:shell_exec_t /bin/zsh-4.0.4 -rwxr-xr-x root root system_u:object_r:shell_exec_t /bin/zsh4 monk:/home/walters# lc /etc/alternatives/zsh lrwxrwxrwx root root system_u:object_r:etc_t /etc/alternatives/zsh -> /bin/zsh4
So in order to use schsh to change my shell to /bin/zsh (which is what's listed in /etc/shells), I need passwd_t to be able to read both shell_exec_t lnk_files, as well as read etc_t lnk_files. Maybe for a higher level of security /etc/alternatives entries could have their own type, but that kind of seems like overkill to me.
A patch to passwd.te is attached; this is against the policy distributed in the Debian woody packages.
passwd.te renamed from usr/share/selinux/policy/default/domains/program/passwd.te +4 -1
@@ -26,13 +26,16 @@ # Execute /usr/bin/{passwd,chfn,chsh} and /usr/sbin/{useradd,vipw}. allow $1_t { bin_t sbin_t }:dir r_dir_perms; can_exec($1_t, { bin_t sbin_t shell_exec_t passwd_real_exec_t }) +allow $1_t shell_exec_t:lnk_file read; +# Allow etc_t symlinks for /etc/alternatives on Debian. +allow $1_t etc_t:lnk_file read; allow $1_t bin_t:lnk_file read; r_dir_file($1_t, locale_t) allow $1_t fs_t:filesystem getattr; # allow checking if a shell is executable -allow $1_t shell_exec_t:file execute; +allow $1_t shell_exec_t:{file lnk_file} execute; # Obtain contexts allow $1_t security_t:security { sid_to_context context_to_sid };
Quoted 11 lines · Colin Walters
Hi,
I use zsh, and on my Debian system the setup looks like:
monk:/home/walters# lc /bin/zsh* lrwxrwxrwx root root system_u:object_r:shell_exec_t /bin/zsh -> /etc/alternatives/zsh -rwxr-xr-x root root system_u:object_r:shell_exec_t /bin/zsh-4.0.4 -rwxr-xr-x root root system_u:object_r:shell_exec_t /bin/zsh4 monk:/home/walters# lc /etc/alternatives/zsh lrwxrwxrwx root root system_u:object_r:etc_t /etc/alternatives/zsh -> /bin/zsh4
I recently changed my policy to not label such symlinks as shell_exec_t, the current version in Debian does this so if you have the latest policy installed and relabel /bin it should be fine.
I have just added a change to my policy to allow reading etc_t:lnk_file.
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.
Quoted 3 lines · Russell Coker
I recently changed my policy to not label such symlinks as
shell_exec_t, the current version in Debian does this so if you have the latest policy installed and relabel /bin it should be fine.
Ok, that works too. I just did that, thanks.
Quoted 1 line
I have just added a change to my policy to allow reading etc_t:lnk_file.
Cool. I noticed afterwards that newrole needs this too; a patch is attached.
etc/selinux/domains/program/newrole.te renamed from usr/share/selinux/policy/default/domains/program/newrole.te +2 -0
@@ -39,6 +39,8 @@ allow newrole_t bin_t:dir r_dir_perms; allow newrole_t bin_t:lnk_file read; allow newrole_t shell_exec_t:file r_file_perms; +# For reading /etc/alternatives links. +allow newrole_t etc_t:lnk_file read; # Allow newrole_t to transition to user domains. domain_trans(newrole_t, shell_exec_t, userdomain)