various policy fixes: suexec and user content, apache2 reload, mount and locales
Subsystems (2)
Hi, here's a set of some policy fixes that I hit while setting up a server, decreasing in importance.
First, I have a setup that looks like this:
(root):walters:sysadm_r:sysadm_t@monk> lc /var/www/verbum.org/autonet/
drwxr-xr-x walters walters walters:object_r:httpd_user_script_ro_t . drwxr-xr-x walters walters walters:object_r:httpd_user_content_t .. drwxr-xr-x walters walters walters:object_r:httpd_user_script_rw_t data -rwxr-xr-x walters walters walters:object_r:httpd_user_script_exec_t moin.cgi -rw-r--r-- walters walters walters:object_r:httpd_user_script_ro_t moin_config.py -rw-r--r-- walters walters walters:object_r:httpd_user_script_ro_t moin_config.pyc
moin.cgi is exec'ed by suexec, which in this case needs to be able to { search getattr } httpd_user_script_ro_t in order to access it. A patch to macros/program/apache_macros.te is attached.
Second, "/etc/init.d/apache2 reload" apparently talks to apache2 over HTTP, so I added the ability for httpd_t to connect to httpd_t. A patch to domains/program/apache.te is attached.
Thirdly, I have LANG=en_US.UTF-8 (as I do on all my machines), and I noticed mount was accessing stuff in locale_t. But since mount isn't i18n-ized, I just added some dontaudit rules for the locale bits. Patch to domains/program/mount.te is attached.
apache_macros.te renamed from usr/share/selinux/policy/default/macros/program/apache_macros.te +2 -0
@@ -57,6 +57,8 @@ allow httpd_suexec_t httpd_$1_content_t:dir { getattr search }; domain_auto_trans_read(httpd_suexec_t, httpd_$1_script_exec_t, httpd_$1_script_t) +allow httpd_suexec_t httpd_$1_script_ro_t:dir { search getattr }; +allow httpd_suexec_t httpd_$1_script_rw_t:dir { search getattr }; allow httpd_suexec_t httpd_$1_script_exec_t:dir { search getattr }; allow httpd_$1_script_t httpd_t:fifo_file { write };
apache.te renamed from usr/share/selinux/policy/default/domains/program/apache.te +2 -0
@@ -100,6 +100,8 @@ can_exec(httpd_t, bin_t) can_network(httpd_t) +# For /etc/init.d/apache2 reload +can_tcp_connect(httpd_t,httpd_t); ################### # Allow httpd to search users diretories
mount.te renamed from usr/share/selinux/policy/default/domains/program/mount.te +2 -0
@@ -42,4 +42,6 @@ ') allow mount_t root_t:filesystem unmount; +dontaudit mount_t locale_t:{file lnk_file} r_file_perms; +dontaudit mount_t locale_t:dir r_dir_perms;
Quoted 10 lines · Colin Walters
First, I have a setup that looks like this:
(root):walters:sysadm_r:sysadm_t@monk> lc
/var/www/verbum.org/autonet/drwxr-xr-x walters walters walters:object_r:httpd_user_script_ro_t . drwxr-xr-x walters walters walters:object_r:httpd_user_content_t .. drwxr-xr-x walters walters walters:object_r:httpd_user_script_rw_t data -rwxr-xr-x walters walters walters:object_r:httpd_user_script_exec_t moin.cgi -rw-r--r-- walters walterswalters:object_r:httpd_user_script_ro_t
moin_config.py-rw-r--r-- walters walters walters:object_r:httpd_user_script_ro_t moin_config.pyc
Seems reasonable.
Quoted 3 lines
moin.cgi is exec'ed by suexec, which in this case needs to be able to { search getattr }
httpd_user_script_ro_tin order to access it. A patch to macros/program/apache_macros.te is attached.
I've put an equivalent change into my tree.
Quoted 3 lines
Second, "
/etc/init.d/apache2reload" apparently talks to apache2 over HTTP, so I added the ability forhttpd_tto connect tohttpd_t. A patch to domains/program/apache.te is attached.
OK.
Quoted 4 lines
Thirdly, I have LANG=en_US.UTF-8 (as I do on all my machines), and I noticed mount was accessing stuff in
locale_t. But since mount isn't i18n-ized, I just added some dontaudit rules for the locale bits. Patch to domains/program/mount.te is attached.
I think it's best to permit those. If an administrator wants to see mount messages in a foreign language then we should support it. So I have put in allow rules in the macro file.
NB It will probably be quite some time before my Apache policy gets accepted by the NSA. I've made a lot of changes, some of which make upgrades difficult. I think it's the right thing to do however, and it seems that you are happy with the result too.
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 think it's best to permit those. If an administrator wants to see mount messages in a foreign language then we should support it. So I have put in allow rules in the macro file.
Ok, that's fine too, but as I said it doesn't seem mount has any translations right now so it doesn't matter.
Quoted 4 lines
NB It will probably be quite some time before my Apache policy gets accepted by the NSA. I've made a lot of changes, some of which make upgrades difficult. I think it's the right thing to do however, and it seems that you are happy with the result too.
Yeah, I like the policy a lot, it works quite well. Hopefully the NSA maintainers can make a backwards-incompatible release at some point and merge your changes.
--
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 8 lines · Colin Walters
Quoted 4 lines
NB It will probably be quite some time before my Apache policy gets accepted by the NSA. I've made a lot of changes, some of which make upgrades difficult. I think it's the right thing to do however, and it seems that you are happy with the result too.
Yeah, I like the policy a lot, it works quite well. Hopefully the NSA maintainers can make a backwards-incompatible release at some point and merge your changes.
Just to clarify, the only significant change in my policy that will cause any problems with an upgrade is the Apache policy. Apart from that you should be able to upgrade a running server from the NSA policy to my policy, and apart from needing to relabel some files it should be all fine.
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.