crontab policy
The attached patch is needed to allow the "crontab -u" checks to operate correctly. Without this the check always returns 0 and crontab will allow root to create crontabs for anyone regardless of SE Linux context.
Note that it may be necessary to go further. I am operating under the assumption that if you want to grant a particular crontab domain the access to create crontab files for other users then you will grant extra access to the crontab domain as well as the "passwd crontab" access to the parent domain in the policy. Maybe we should allow all $1_crontab_t domains to perform the security checks?
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
program/crontab_macros.te renamed from program/crontab_macros.te.orig +5 -2
@@ -41,8 +41,6 @@ # 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 }; -dontaudit $1_crontab_t proc_t:dir search; -dontaudit $1_crontab_t selinux_config_t:dir search; # Type for temporary files. file_type_auto_trans($1_crontab_t, tmp_t, $1_tmp_t, { dir file })
@@ -65,6 +63,11 @@ # for the checks used by crontab -u dontaudit $1_crontab_t security_t:dir search; +allow $1_crontab_t proc_t:dir search; +allow $1_crontab_t proc_t:{ file lnk_file } { getattr read }; +allow $1_crontab_t selinux_config_t:dir search; +allow $1_crontab_t selinux_config_t:file { getattr read }; +dontaudit $1_crontab_t self:dir search; # crontab signals crond by updating the mtime on the spooldir allow $1_crontab_t cron_spool_t:dir setattr;
Quoted 10 lines · Russell Coker
The attached patch is needed to allow the "crontab -u" checks to operate correctly. Without this the check always returns 0 and crontab will allow root to create crontabs for anyone regardless of SE Linux context.
Note that it may be necessary to go further. I am operating under the assumption that if you want to grant a particular crontab domain the access to create crontab files for other users then you will grant extra access to the crontab domain as well as the "passwd crontab" access to the parent domain in the policy. Maybe we should allow all $1_crontab_t domains to perform the security checks?
This should be done via macros, e.g. can_getsecurity() provides the necessary permissions to get security decisions via selinuxfs. Not sure that the ability to read /etc/selinux/config is truly necessary, as you only need that to find out the paths to the policy files, which aren't required for using selinuxfs. userspace_objmgr defines a broader set of permissions including the ability to get security decisions, read /etc/selinux/config and /etc/selinux/$SELINUXTYPE/contexts, and get notifications of policy reloads and changes to the enforcing flag via netlink.
Signature · 8 lines
Stephen Smalley 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.