gentoo diffs
Hi,
here is the short version of the gentoo policy patches:
* named: changed one file label
* daemontools: policy cleanup, added support for 2 more services
* dante: policy tweaks needed for latest versions
* gnupg: support for gnupg-1.9.x
* kerberos: gentoo file locations
* postfix: gentoo file locations for 64bit systems
* ucspi-tcp: patch from Andy Dustman to support rblsmtp
bye,
peter
Signature · 4 lines
petre rodan <[email protected]> Developer, Hardened Gentoo Linux
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/bind/named.fc renamed from root/public_html/policy/nsa/file_contexts/program/named.fc +1 -1
@@ -43,7 +43,7 @@ ifdef(`distro_gentoo', ` /etc/bind(/.*)? system_u:object_r:named_zone_t /etc/bind/named\.conf -- system_u:object_r:named_conf_t -/etc/bind/rndc\.key -- system_u:object_r:named_conf_t +/etc/bind/rndc\.key -- system_u:object_r:dnssec_t /var/bind(/.*)? system_u:object_r:named_cache_t /var/bind/pri(/.*)? system_u:object_r:named_zone_t ') dnl distro_gentoo
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/daemontools/daemontools_macros.te renamed from root/public_html/policy/nsa/macros/program/daemontools_macros.te +4 -4
@@ -1,10 +1,10 @@ ifdef(`daemontools.te', ` define(`svc_ipc_domain',` -allow $1 svc_start_t:process { sigchld }; -allow $1 svc_start_t:fd { use }; -allow $1 svc_start_t:fifo_file { read write }; -allow svc_start_t $1:process { signal }; +allow $1 svc_start_t:process sigchld; +allow $1 svc_start_t:fd use; +allow $1 svc_start_t:fifo_file { read write getattr }; +allow svc_start_t $1:process signal; ') ') dnl ifdef daemontools
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/daemontools/daemontools.fc renamed from root/public_html/policy/nsa/file_contexts/program/daemontools.fc +0 -1
@@ -22,7 +22,6 @@ /usr/bin/svscan -- system_u:object_r:svc_start_exec_t /usr/bin/svscanboot -- system_u:object_r:svc_start_exec_t /usr/bin/svok -- system_u:object_r:svc_start_exec_t -#/usr/bin/svstat -- system_u:object_r:svc_start_exec_t /usr/bin/supervise -- system_u:object_r:svc_start_exec_t # starting scripts
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/daemontools/daemontools.te renamed from root/public_html/policy/nsa/domains/program/unused/daemontools.te +21 -7
@@ -27,18 +27,16 @@ file_type_auto_trans($1, svc_svc_t, svc_svc_t); ') -define(`svc_base_domain', ` -daemon_base_domain($1) -svc_filedir_domain(`$1_t') -') - ############################################################## # the domains +daemon_base_domain(svc_script) +svc_filedir_domain(svc_script_t) # part started by initrc_t -svc_base_domain(svc_start) +daemon_base_domain(svc_start) +domain_auto_trans(init_t, svc_start_exec_t, svc_start_t) +svc_filedir_domain(svc_start_t) -svc_base_domain(svc_script) # also get here from svc_script_t domain_auto_trans(svc_script_t, svc_start_exec_t, svc_start_t)
@@ -65,12 +63,18 @@ # svc_start_t allow svc_start_t self:fifo_file rw_file_perms; allow svc_start_t self:capability kill; +allow svc_start_t self:unix_stream_socket create_socket_perms; + allow svc_start_t { bin_t sbin_t etc_t }:dir r_dir_perms; allow svc_start_t { bin_t sbin_t etc_t }:lnk_file r_file_perms; +allow svc_start_t { etc_t etc_runtime_t }:file r_file_perms; allow svc_start_t { var_t var_run_t }:dir search; +can_exec(svc_start_t, bin_t) can_exec(svc_start_t, shell_exec_t) allow svc_start_t svc_start_exec_t:file { rx_file_perms execute_no_trans }; allow svc_start_t svc_run_t:process signal; +dontaudit svc_start_t proc_t:file r_file_perms; +dontaudit svc_start_t devtty_t:chr_file { read write }; # svc script allow svc_script_t self:capability sys_admin;
@@ -140,6 +144,11 @@ dontaudit httpd_t svc_svc_t:dir { search }; ') +ifdef(`clamav.te', ` +domain_auto_trans(svc_run_t, clamd_exec_t, clamd_t) +svc_ipc_domain(clamd_t) +') + ifdef(`clockspeed.te', ` domain_auto_trans( svc_run_t, clockspeed_exec_t, clockspeed_t) svc_ipc_domain(clockspeed_t)
@@ -171,6 +180,11 @@ svc_ipc_domain(rsyncd_t) ') +ifdef(`spamd.te', ` +domain_auto_trans(svc_run_t, spamd_exec_t, spamd_t) +svc_ipc_domain(spamd_t) +') + ifdef(`ssh.te', ` domain_auto_trans(svc_run_t, sshd_exec_t, sshd_t) svc_ipc_domain(sshd_t)
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/dante/dante.te renamed from root/public_html/policy/nsa/domains/program/unused/dante.te +5 -1
@@ -10,11 +10,16 @@ can_network_server(dante_t) allow dante_t self:fifo_file { read write }; -allow dante_t self:capability { setuid }; +allow dante_t self:capability { setuid setgid }; allow dante_t self:unix_dgram_socket { connect create write }; allow dante_t self:unix_stream_socket { connect create read setopt write }; +allow dante_t self:tcp_socket connect; allow dante_t socks_port_t:tcp_socket name_bind; allow dante_t { etc_t etc_runtime_t }:file r_file_perms; r_dir_file(dante_t, dante_conf_t) + +allow dante_t initrc_var_run_t:file { getattr write }; +
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/gnupg/gpg.fc renamed from root/public_html/policy/nsa/file_contexts/program/gpg.fc +4 -2
@@ -1,5 +1,7 @@ # gpg HOME_DIR/\.gnupg(/.+)? system_u:object_r:ROLE_gpg_secret_t -/usr/bin/gpg -- system_u:object_r:gpg_exec_t +/usr/bin/gpg(2)? -- system_u:object_r:gpg_exec_t /usr/bin/kgpg -- system_u:object_r:gpg_exec_t -/usr/lib/gnupg/gpgkeys.* -- system_u:object_r:gpg_helper_exec_t +/usr/lib/gnupg/.* -- system_u:object_r:gpg_exec_t +/usr/lib/gnupg/gpgkeys.* -- system_u:object_r:gpg_helper_exec_t +
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/kerberos/kerberos.fc renamed from root/public_html/policy/nsa/file_contexts/program/kerberos.fc +9 -0
@@ -9,3 +9,12 @@ /var/log/krb5kdc\.log system_u:object_r:krb5kdc_log_t /var/log/kadmind\.log system_u:object_r:kadmind_log_t /usr(/local)?/bin/ksu -- system_u:object_r:su_exec_t + +# gentoo file locations +/usr/sbin/krb5kdc -- system_u:object_r:krb5kdc_exec_t +/usr/sbin/kadmind -- system_u:object_r:kadmind_exec_t +/etc/krb5kdc(/.*)? system_u:object_r:krb5kdc_conf_t +/etc/krb5kdc/principal.* system_u:object_r:krb5kdc_principal_t +/etc/krb5kdc/kadm5.keytab -- system_u:object_r:krb5_keytab_t +/var/log/kadmin.log -- system_u:object_r:kadmind_log_t +
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/postfix/postfix.fc renamed from root/public_html/policy/nsa/file_contexts/program/postfix.fc +11 -11
@@ -5,17 +5,17 @@ ') /etc/postfix/postfix-script.* -- system_u:object_r:postfix_exec_t /etc/postfix/prng_exch -- system_u:object_r:postfix_prng_t -/usr/lib(exec)?/postfix/.* -- system_u:object_r:postfix_exec_t -/usr/lib(exec)?/postfix/cleanup -- system_u:object_r:postfix_cleanup_exec_t -/usr/lib(exec)?/postfix/local -- system_u:object_r:postfix_local_exec_t -/usr/lib(exec)?/postfix/master -- system_u:object_r:postfix_master_exec_t -/usr/lib(exec)?/postfix/pickup -- system_u:object_r:postfix_pickup_exec_t -/usr/lib(exec)?/postfix/(n)?qmgr -- system_u:object_r:postfix_qmgr_exec_t -/usr/lib(exec)?/postfix/showq -- system_u:object_r:postfix_showq_exec_t -/usr/lib(exec)?/postfix/smtp -- system_u:object_r:postfix_smtp_exec_t -/usr/lib(exec)?/postfix/smtpd -- system_u:object_r:postfix_smtpd_exec_t -/usr/lib(exec)?/postfix/bounce -- system_u:object_r:postfix_bounce_exec_t -/usr/lib(exec)?/postfix/pipe -- system_u:object_r:postfix_pipe_exec_t +/usr/lib(exec)?(64)?/postfix/.* -- system_u:object_r:postfix_exec_t +/usr/lib(exec)?(64)?/postfix/cleanup -- system_u:object_r:postfix_cleanup_exec_t +/usr/lib(exec)?(64)?/postfix/local -- system_u:object_r:postfix_local_exec_t +/usr/lib(exec)?(64)?/postfix/master -- system_u:object_r:postfix_master_exec_t +/usr/lib(exec)?(64)?/postfix/pickup -- system_u:object_r:postfix_pickup_exec_t +/usr/lib(exec)?(64)?/postfix/(n)?qmgr -- system_u:object_r:postfix_qmgr_exec_t +/usr/lib(exec)?(64)?/postfix/showq -- system_u:object_r:postfix_showq_exec_t +/usr/lib(exec)?(64)?/postfix/smtp -- system_u:object_r:postfix_smtp_exec_t +/usr/lib(exec)?(64)?/postfix/smtpd -- system_u:object_r:postfix_smtpd_exec_t +/usr/lib(exec)?(64)?/postfix/bounce -- system_u:object_r:postfix_bounce_exec_t +/usr/lib(exec)?(64)?/postfix/pipe -- system_u:object_r:postfix_pipe_exec_t /usr/sbin/postalias -- system_u:object_r:postfix_master_exec_t /usr/sbin/postcat -- system_u:object_r:postfix_master_exec_t /usr/sbin/postdrop -- system_u:object_r:postfix_postdrop_exec_t
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/ucspi-tcp/ucspi-tcp.fc renamed from root/public_html/policy/nsa/file_contexts/program/ucspi-tcp.fc +1 -0
@@ -1,2 +1,3 @@ #ucspi-tcp /usr/bin/tcpserver -- system_u:object_r:utcpserver_exec_t +/usr/bin/rblsmtpd -- system_u:object_r:rblsmtpd_exec_t
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/ucspi-tcp/ucspi-tcp.te renamed from root/public_html/policy/nsa/domains/program/unused/ucspi-tcp.te +26 -6
@@ -1,6 +1,7 @@ #DESC ucspi-tcp - TCP Server and Client Tools # # Author Petre Rodan <[email protected]> +# Andy Dustman (rblsmtp-related policy) # # http://cr.yp.to/ucspi-tcp.html
@@ -9,18 +10,16 @@ daemon_base_domain(utcpserver) can_network(utcpserver_t) -allow utcpserver_t port_type:tcp_socket name_connect; -#reads /etc/nsswitch.conf and resolv.conf -allow utcpserver_t etc_t:file { getattr read }; -allow utcpserver_t net_conf_t:file { read }; - -allow utcpserver_t { bin_t var_t }:dir { search }; +allow utcpserver_t etc_t:file r_file_perms; +allow utcpserver_t { bin_t sbin_t var_t }:dir search; allow utcpserver_t self:capability { net_bind_service setgid setuid }; allow utcpserver_t self:fifo_file { read write }; allow utcpserver_t self:process { fork sigchld }; +allow utcpserver_t port_t:udp_socket name_bind; + ifdef(`qmail.te', ` domain_auto_trans(utcpserver_t, qmail_smtpd_exec_t, qmail_smtpd_t) allow utcpserver_t smtp_port_t:tcp_socket name_bind;
@@ -29,3 +28,24 @@ allow utcpserver_t qmail_etc_t:file r_file_perms; ') +daemon_base_domain(rblsmtpd) +can_network(rblsmtpd_t) + +allow rblsmtpd_t self:process { fork sigchld }; + +allow rblsmtpd_t etc_t:file r_file_perms; +allow rblsmtpd_t { bin_t var_t }:dir search; +allow rblsmtpd_t port_t:udp_socket name_bind; +allow rblsmtpd_t utcpserver_t:tcp_socket { read write getattr }; + +ifdef(`qmail.te', ` +domain_auto_trans(rblsmtpd_t, qmail_smtpd_exec_t, qmail_smtpd_t) +allow qmail_queue_t rblsmtpd_t:fd use; +') + +ifdef(`daemontools.te', ` +svc_ipc_domain(rblsmtpd_t) +') + +domain_auto_trans(utcpserver_t, rblsmtpd_exec_t, rblsmtpd_t) +
Quoted 1 line · petre rodan
* named: changed one file label
I've attached a patch to apply after that one, it does the same thing for Debian and also changes a "." to "\.".
Quoted 1 line
* daemontools: policy cleanup, added support for 2 more services
+daemon_base_domain(svc_start) +domain_auto_trans(init_t, svc_start_exec_t, svc_start_t)
Is this for daemons that may be started either from /etc/inittab or /etc/init.d scripts?
Quoted 1 line
* kerberos: gentoo file locations
Those should have ifdef(distro_gentoo' around them. Ideally we want as many ifdef(distro_... rules in the file contexts as possible. The more stuff that can be removed because of being applicable to distributions other than the one you use the better. setfiles still has performance issues...
Quoted 1 line
* postfix: gentoo file locations for 64bit systems
Are you seriously planning to have both 32bit and 64bit versions of Postfix installed on the same system at the same time? If not then you shouldn't be using special names for 64bit versions. If you are then I suspect you are doing something vastly different from what everyone else is doing and ifdef(`distro_gentoo' would be appropriate.
We should probably have ifdef(distro_redhat' and ifdef(distro_debian' in any case.
Also I'm quite certain that you are not using all four combinations of /usr/lib(exec)?(64)?/postfix/.
I plan to extend the stem compression support in setfiles to two levels, taking full advantage of that means removing such conditionals from the policy.
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/named.fc renamed from program/named.fc.orig +2 -2
@@ -9,12 +9,12 @@ ifdef(`distro_debian', ` /etc/bind(/.*)? system_u:object_r:named_zone_t /etc/bind/named\.conf -- system_u:object_r:named_conf_t -/etc/bind/rndc\.key -- system_u:object_r:named_conf_t +/etc/bind/rndc\.key -- system_u:object_r:dnssec_t /var/cache/bind(/.*)? system_u:object_r:named_cache_t ') dnl distro_debian /etc/rndc.* -- system_u:object_r:named_conf_t -/etc/rndc.key -- system_u:object_r:dnssec_t +/etc/rndc\.key -- system_u:object_r:dnssec_t /usr/sbin/named -- system_u:object_r:named_exec_t /usr/sbin/named-checkconf -- system_u:object_r:named_checkconf_exec_t /usr/sbin/r?ndc -- system_u:object_r:ndc_exec_t
Hi,
Russell Coker wrote:
[snip]
Quoted 5 lines
(quoted diff) +2
-0+daemon_base_domain(svc_start) +domain_auto_trans(init_t, svc_start_exec_t, svc_start_t)Is this for daemons that may be started either from
/etc/inittabor/etc/init.dscripts?
yes, basicaly it's about svscanboot that acording to the documentation is started from inittab. gentoo's default is to start svscan from an init script, but some users asked for the other way arround. these two binaries are somewhat equivalent and both have a svc_start_exec_t label.
Quoted 6 lines
Quoted 1 line
* kerberos: gentoo file locations
Those should have ifdef(
distro_gentoo' around them. Ideally we want as many ifdef(distro_... rules in the file contexts as possible. The more stuff that can be removed because of being applicable to distributions other than the one you use the better. setfiles still has performance issues...
ok, I'll keep that in mind.
Quoted 9 lines
Quoted 1 line
* postfix: gentoo file locations for 64bit systems
Are you seriously planning to have both 32bit and 64bit versions of Postfix installed on the same system at the same time
If not then you shouldn't be using special names for 64bit versions.
If you are then I suspect you are
doing something vastly different from what everyone else is doing and ifdef(`distro_gentoo' would be appropriate.
Quoted 5 lines
We should probably have ifdef(
distro_redhat' and ifdef(distro_debian' in any case.Also I'm quite certain that you are not using all four combinations of /usr/lib(exec)?(64)?/postfix/.
http://bugs.gentoo.org/show_bug.cgi?id=89321
we have /usr/lib/postfix and /usr/lib64/postfix depending on the profile under which it was compiled. having it like lib(exec)?(64)? means that it's very easy to maintain, but if that's not possible, no problem.
Quoted 3 lines
I plan to extend the stem compression support in setfiles to two levels, taking full advantage of that means removing such conditionals from the policy.
thanks,
peter
Signature · 4 lines
petre rodan <[email protected]> Developer, Hardened Gentoo Linux
Quoted 8 lines · petre rodan
Quoted 2 lines
Also I'm quite certain that you are not using all four combinations of /usr/lib(exec)?(64)?/postfix/.
http://bugs.gentoo.org/show_bug.cgi?id=89321
we have
/usr/lib/postfixand/usr/lib64/postfixdepending on the profile under which it was compiled. having it like lib(exec)?(64)? means that it's very easy to maintain, but if that's not possible, no problem.
Why do you want /usr/lib64/postfix?
The point of /usr/lib64 is for files where you have both 32bit and 64bit versions installed at the same time. This is when you have shared objects which could be used by either 32bit or 64bit programs.
/usr/libexec/postfix on Red Hat systems contains no shared objects, only executables, on ia32_64 the same locations are used. I can't work out any reason for having both 32bit and 64bit versions of those executables (there is no good support for having Postfix call 32bit programs for some operations and 64bit for others so any attempt to make use of functionality that this would provide would be painful).
Debian uses /usr/lib/postfix for the same files but also has some shared object in the same directory. However those shared objects are only for the use of Postfix so they have not bothered using /usr/lib64/postfix for the amd64 packages.
In summary, /usr/lib64/postfix causes needless differences between 32bit and 64bit systems for no benefit. Incidentally this will prevent a main.cf file from Debian working on Gentoo AMD64. Not sure whether main.cf files can be shared between 32bit and 64bit Gentoo machines, this is something you probably want to investigate.
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
file_contexts/program/postfix.fc renamed from file_contexts/program/postfix.fc.orig +23 -11
@@ -2,20 +2,32 @@ /etc/postfix(/.*)? system_u:object_r:postfix_etc_t ifdef(`distro_redhat', ` /etc/postfix/aliases.* system_u:object_r:etc_aliases_t +/usr/libexec/postfix/.* -- system_u:object_r:postfix_exec_t +/usr/libexec/postfix/cleanup -- system_u:object_r:postfix_cleanup_exec_t +/usr/libexec/postfix/local -- system_u:object_r:postfix_local_exec_t +/usr/libexec/postfix/master -- system_u:object_r:postfix_master_exec_t +/usr/libexec/postfix/pickup -- system_u:object_r:postfix_pickup_exec_t +/usr/libexec/postfix/(n)?qmgr -- system_u:object_r:postfix_qmgr_exec_t +/usr/libexec/postfix/showq -- system_u:object_r:postfix_showq_exec_t +/usr/libexec/postfix/smtp -- system_u:object_r:postfix_smtp_exec_t +/usr/libexec/postfix/smtpd -- system_u:object_r:postfix_smtpd_exec_t +/usr/libexec/postfix/bounce -- system_u:object_r:postfix_bounce_exec_t +/usr/libexec/postfix/pipe -- system_u:object_r:postfix_pipe_exec_t +', ` +/usr/lib/postfix/.* -- system_u:object_r:postfix_exec_t +/usr/lib/postfix/cleanup -- system_u:object_r:postfix_cleanup_exec_t +/usr/lib/postfix/local -- system_u:object_r:postfix_local_exec_t +/usr/lib/postfix/master -- system_u:object_r:postfix_master_exec_t +/usr/lib/postfix/pickup -- system_u:object_r:postfix_pickup_exec_t +/usr/lib/postfix/(n)?qmgr -- system_u:object_r:postfix_qmgr_exec_t +/usr/lib/postfix/showq -- system_u:object_r:postfix_showq_exec_t +/usr/lib/postfix/smtp -- system_u:object_r:postfix_smtp_exec_t +/usr/lib/postfix/smtpd -- system_u:object_r:postfix_smtpd_exec_t +/usr/lib/postfix/bounce -- system_u:object_r:postfix_bounce_exec_t +/usr/lib/postfix/pipe -- system_u:object_r:postfix_pipe_exec_t ') /etc/postfix/postfix-script.* -- system_u:object_r:postfix_exec_t /etc/postfix/prng_exch -- system_u:object_r:postfix_prng_t -/usr/lib(exec)?/postfix/.* -- system_u:object_r:postfix_exec_t -/usr/lib(exec)?/postfix/cleanup -- system_u:object_r:postfix_cleanup_exec_t -/usr/lib(exec)?/postfix/local -- system_u:object_r:postfix_local_exec_t -/usr/lib(exec)?/postfix/master -- system_u:object_r:postfix_master_exec_t -/usr/lib(exec)?/postfix/pickup -- system_u:object_r:postfix_pickup_exec_t -/usr/lib(exec)?/postfix/(n)?qmgr -- system_u:object_r:postfix_qmgr_exec_t -/usr/lib(exec)?/postfix/showq -- system_u:object_r:postfix_showq_exec_t -/usr/lib(exec)?/postfix/smtp -- system_u:object_r:postfix_smtp_exec_t -/usr/lib(exec)?/postfix/smtpd -- system_u:object_r:postfix_smtpd_exec_t -/usr/lib(exec)?/postfix/bounce -- system_u:object_r:postfix_bounce_exec_t -/usr/lib(exec)?/postfix/pipe -- system_u:object_r:postfix_pipe_exec_t /usr/sbin/postalias -- system_u:object_r:postfix_master_exec_t /usr/sbin/postcat -- system_u:object_r:postfix_master_exec_t /usr/sbin/postdrop -- system_u:object_r:postfix_postdrop_exec_t