gentoo diff for ntpd
Subsystems (2)
Hi!
This is a very small diff that would make the gentoo community happy :)
reference:
http://bugs.gentoo.org/show_bug.cgi?id=59633
many thanks,
peter
Signature · 4 lines
petre rodan <[email protected]> Developer, Hardened Gentoo Linux
etc/security/selinux/src/policy/file_contexts/program/ntpd.fc renamed from root/public_html/policy/nsa/file_contexts/program/ntpd.fc +8 -0
@@ -10,3 +10,11 @@ /var/run/ntpd.pid -- system_u:object_r:ntpd_var_run_t /etc/cron\.(daily|weekly)/ntp-simple -- system_u:object_r:ntpd_exec_t /etc/cron\.(daily|weekly)/ntp-server -- system_u:object_r:ntpd_exec_t + +ifdef(`distro_gentoo', ` +/usr/bin/ntpd -- system_u:object_r:ntpd_exec_t +/usr/bin/ntpdate -- system_u:object_r:ntpd_exec_t + +# for net-misc/openntpd +/etc/ntpd\.conf -- system_u:object_r:net_conf_t +')
etc/security/selinux/src/policy/domains/program/ntpd.te renamed from root/public_html/policy/nsa/domains/program/unused/ntpd.te +5 -0
@@ -69,3 +69,8 @@ ifdef(`firstboot.te', ` dontaudit ntpd_t firstboot_t:fd { use }; ') + +ifdef(`distro_gentoo', ` +allow ntpd_t self:capability { sys_chroot kill }; +') +
Since peter forgot to introduce himself :) he just started with gentoo to give us some badly needed policy help which will hopefully allow us to start sending more policy upstream. Thanks peter
Also, this diff is to make openntpd work with the current ntp policy, so
a tunable other than distro_gentoo might be appropriate, or none at all.
Joshua Brindle
Quoted 30 lines · petre rodan
Hi!
This is a very small diff that would make the gentoo community happy :)
reference:
http://bugs.gentoo.org/show_bug.cgi?id=59633many thanks,
peter------------------------------------------------------------------------
etc/security/selinux/src/policy/file_contexts/program/ntpd.fc renamed from root/public_html/policy/nsa/file_contexts/program/ntpd.fc +8
-0@@ -10,3 +10,11 @@ /var/run/ntpd.pid -- system_u:object_r:ntpd_var_run_t /etc/cron\.(daily|weekly)/ntp-simple -- system_u:object_r:ntpd_exec_t /etc/cron\.(daily|weekly)/ntp-server -- system_u:object_r:ntpd_exec_t + +ifdef(`distro_gentoo', ` +/usr/bin/ntpd -- system_u:object_r:ntpd_exec_t +/usr/bin/ntpdate -- system_u:object_r:ntpd_exec_t + +# for net-misc/openntpd +/etc/ntpd\.conf -- system_u:object_r:net_conf_t +')
etc/security/selinux/src/policy/domains/program/ntpd.te line 76
Quoted 8 lines
etc/security/selinux/src/policy/domains/program/ntpd.te renamed from root/public_html/policy/nsa/domains/program/unused/ntpd.te +5
-0@@ -69,3 +69,8 @@ ifdef(`firstboot.te', ` dontaudit ntpd_t firstboot_t:fd { use }; ') + +ifdef(`distro_gentoo', ` +allow ntpd_t self:capability { sys_chroot kill }; +') +
--
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.
Hi!
Quoted 6 lines · Joshua Brindle
Since peter forgot to introduce himself :) he just started with gentoo to give us some badly needed policy help which will hopefully allow us to start sending more policy upstream. Thanks peter
Also, this diff is to make openntpd work with the current ntp policy, so
a tunable other thandistro_gentoomight be appropriate, or none at all.Joshua Brindle
this is a new diff with distro_gentoo ifdefs dropped.
also, logrotate is not part of the gentoo base-policy and it shouldn't be a dependency for ntpd, so I'm also ifdef-ing that.
bye,
peter
Signature · 4 lines
petre rodan <[email protected]> Developer, Hardened Gentoo Linux
etc/security/selinux/src/policy/domains/program/ntpd.te renamed from root/public_html/policy/nsa/domains/program/unused/ntpd.te +3 -2
@@ -22,7 +22,7 @@ # for SSP allow ntpd_t urandom_device_t:chr_file read; -allow ntpd_t self:capability { setgid setuid sys_time net_bind_service ipc_lock }; +allow ntpd_t self:capability { setgid setuid sys_time net_bind_service ipc_lock sys_chroot kill }; allow ntpd_t self:process { setcap setsched }; # ntpdate wants sys_nice dontaudit ntpd_t self:capability { fsetid sys_nice };
@@ -50,7 +50,7 @@ can_exec(ntpd_t, initrc_exec_t) allow ntpd_t self:fifo_file { read write getattr }; allow ntpd_t etc_runtime_t:file r_file_perms; -can_exec(ntpd_t, { bin_t shell_exec_t sbin_t ls_exec_t logrotate_exec_t ntpd_exec_t }) +can_exec(ntpd_t, { bin_t shell_exec_t sbin_t ls_exec_t ntpd_exec_t }) allow ntpd_t { sbin_t bin_t }:dir search; allow ntpd_t bin_t:lnk_file read; allow ntpd_t sysctl_kernel_t:dir search;
@@ -59,6 +59,7 @@ allow ntpd_t sysadm_home_dir_t:dir r_dir_perms; allow ntpd_t self:file { getattr read }; dontaudit ntpd_t domain:dir search; +ifdef(`logrotate.te', `can_exec(ntpd_t,logrotate_exec_t)') ') allow ntpd_t devtty_t:chr_file rw_file_perms;
etc/security/selinux/src/policy/file_contexts/program/ntpd.fc renamed from root/public_html/policy/nsa/file_contexts/program/ntpd.fc +3 -3
@@ -1,9 +1,9 @@ /var/lib/ntp(/.*)? system_u:object_r:ntp_drift_t /etc/ntp/data(/.*)? system_u:object_r:ntp_drift_t -/etc/ntp\.conf -- system_u:object_r:net_conf_t +/etc/ntp(d)?\.conf -- system_u:object_r:net_conf_t /etc/ntp/step-tickers -- system_u:object_r:net_conf_t -/usr/sbin/ntpd -- system_u:object_r:ntpd_exec_t -/usr/sbin/ntpdate -- system_u:object_r:ntpd_exec_t +/usr/(s)?bin/ntpd -- system_u:object_r:ntpd_exec_t +/usr/(s)?bin/ntpdate -- system_u:object_r:ntpd_exec_t /var/log/ntpstats(/.*)? system_u:object_r:ntpd_log_t /var/log/ntpd.* -- system_u:object_r:ntpd_log_t /var/log/xntpd.* -- system_u:object_r:ntpd_log_t
Quoted 3 lines · petre rodan
this is a new diff with
distro_gentooifdefs dropped.
also, logrotate is not part of the gentoo base-policy and it shouldn't be a dependency for ntpd, so I'm also ifdef-ing that.
Having daemon binaries in /usr/bin instead of /usr/sbin is a bug.
ntpd and ntpdate can not be used by regular users, they can only be used by the administrator. Therefore any distribution that follows the LSB (or the FHS which the LSB is based on) will put them in /usr/sbin. Here is the relevant section of the FHS:
4.6 /usr/sbin : Non-essential standard system binaries
This directory contains any non-essential binaries used exclusively by the system administrator. System administration programs that are required for system repair, system recovery, mounting /usr, or other essential functions should be placed in /sbin instead.
Those .fc entries for /usr/bin can go in under ifdef(`distro_gentoo' if Gentoo does not follow the FHS. Otherwise it's best to file a bug in the Gentoo bug system requesting that the files be moved.
I've attached a patch which has the changes I think belong in the CVS at this time. Note that I changed the order of the capabilities so that they match the order of capability.h .
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/unused/ntpd.te renamed from usr/src/se/policy/domains/program/unused/ntpd.te +3 -2
@@ -22,7 +22,7 @@ # for SSP allow ntpd_t urandom_device_t:chr_file read; -allow ntpd_t self:capability { setgid setuid sys_time net_bind_service ipc_lock }; +allow ntpd_t self:capability { kill setgid setuid sys_time net_bind_service ipc_lock sys_chroot }; allow ntpd_t self:process { setcap setsched }; # ntpdate wants sys_nice dontaudit ntpd_t self:capability { fsetid sys_nice };
@@ -50,7 +50,7 @@ can_exec(ntpd_t, initrc_exec_t) allow ntpd_t self:fifo_file { read write getattr }; allow ntpd_t etc_runtime_t:file r_file_perms; -can_exec(ntpd_t, { bin_t shell_exec_t sbin_t ls_exec_t logrotate_exec_t ntpd_exec_t }) +can_exec(ntpd_t, { bin_t shell_exec_t sbin_t ls_exec_t ntpd_exec_t }) allow ntpd_t { sbin_t bin_t }:dir search; allow ntpd_t bin_t:lnk_file read; allow ntpd_t sysctl_kernel_t:dir search;
@@ -59,6 +59,7 @@ allow ntpd_t sysadm_home_dir_t:dir r_dir_perms; allow ntpd_t self:file { getattr read }; dontaudit ntpd_t domain:dir search; +ifdef(`logrotate.te', `can_exec(ntpd_t, logrotate_exec_t)') ') allow ntpd_t devtty_t:chr_file rw_file_perms;
program/ntpd.fc renamed from usr/src/se/policy/file_contexts/program/ntpd.fc +1 -1
@@ -1,6 +1,6 @@ /var/lib/ntp(/.*)? system_u:object_r:ntp_drift_t /etc/ntp/data(/.*)? system_u:object_r:ntp_drift_t -/etc/ntp\.conf -- system_u:object_r:net_conf_t +/etc/ntp(d)?\.conf -- system_u:object_r:net_conf_t /etc/ntp/step-tickers -- system_u:object_r:net_conf_t /usr/sbin/ntpd -- system_u:object_r:ntpd_exec_t /usr/sbin/ntpdate -- system_u:object_r:ntpd_exec_t
Hi Russell,
Quoted 10 lines · Russell Coker
Quoted 3 lines · petre rodan
this is a new diff with
distro_gentooifdefs dropped.
also, logrotate is not part of the gentoo base-policy and it shouldn't be a dependency for ntpd, so I'm also ifdef-ing that.Having daemon binaries in
/usr/bininstead of/usr/sbinis a bug.ntpd and ntpdate can not be used by regular users, they can only be used by the administrator. Therefore any distribution that follows the LSB (or the FHS which the LSB is based on) will put them in
/usr/sbin.
You are correct. I have sent patches to gentoo bugzilla and upstream. Let's hope at least one of those will like the idea.
bye,
peter
Signature · 4 lines
petre rodan <[email protected]> Developer, Hardened Gentoo Linux
Merged.
Quoted 27 lines · Russell Coker
Quoted 3 lines · petre rodan
this is a new diff with
distro_gentooifdefs dropped.
also, logrotate is not part of the gentoo base-policy and it shouldn't be a dependency for ntpd, so I'm also ifdef-ing that.Having daemon binaries in
/usr/bininstead of/usr/sbinis a bug.ntpd and ntpdate can not be used by regular users, they can only be used by the administrator. Therefore any distribution that follows the LSB (or the FHS which the LSB is based on) will put them in
/usr/sbin. Here is the relevant section of the FHS:4.6
/usr/sbin: Non-essential standard system binariesThis directory contains any non-essential binaries used exclusively by the system administrator. System administration programs that are required for system repair, system recovery, mounting /usr, or other essential functions should be placed in /sbin instead.
Those .fc entries for
/usr/bincan go in under ifdef(`distro_gentoo' if Gentoo does not follow the FHS. Otherwise it's best to file a bug in the Gentoo bug system requesting that the files be moved.I've attached a patch which has the changes I think belong in the CVS at this time. Note that I changed the order of the capabilities so that they match the order of
capability.h.
Signature · 7 lines
James Carter <[email protected]> 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.