wrong context for ntpd.pid
Hi:
I posted this to the Gentoo mailing list, but thought I might benefit from a wider audience.
I'm trying to install ntpd on an selinux-enabled gentoo system, and one of the stranger problems I'm having is with /var/run/ntpd.pid. The file is being created with a context of initrc_var_run_t, but the ntpd.te policy expects this file to have a context of ntpd_var_run_t. Poking around, I see that the /etc/init.d/ntpd script creates an empty ntpd.pid because it wants to chown ntp:ntp before it starts the daemon (with a "-u ntp:ntp" option), ergo the initrc_var_run_t context.
The startup script is the obvious culprit, but I'm not sure how to fix it. What is the proper selinux way to run a process as a non-root user:group?
Thanks,
Richard Simpson
--
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 7 lines · Richard Simpson
I'm trying to install ntpd on an selinux-enabled gentoo system, and one of the stranger problems I'm having is with
/var/run/ntpd.pid. The file is being created with a context ofinitrc_var_run_t, but the ntpd.te policy expects this file to have a context ofntpd_var_run_t. Poking around, I see that the/etc/init.d/ntpdscript creates an empty ntpd.pid because it wants tochown ntp:ntpbefore it starts the daemon (with a "-u ntp:ntp" option), ergo theinitrc_var_run_tcontext.
Add the following line to /etc/init.d/ntpd directly after the chown:
[ -e /sbin/restorecon ] && /sbin/restorecon /var/run/ntpd.pid
This should be all that is needed.
Thomas
Signature · 7 lines
http://www.cip.ifi.lmu.de/~bleher/selinux/ - my SELinux pages GPG-Fingerprint: BC4F BB16 30D6 F253 E3EA D09E C562 2BAE B2F4 ABE7 -- 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 2 lines
-----Original Message-----
From: Thomas Bleher [mailto:[email protected]]
...
Quoted 5 lines
Add the following line to
/etc/init.d/ntpddirectly after the chown:[ -e /sbin/restorecon ] && /sbin/restorecon /var/run/ntpd.pidThis should be all that is needed.
I filed a bug report on this problem:
http://bugs.gentoo.org/show_bug.cgi?id=69288
They chose to fix it by revising the init script to not create the pid file in the first place. If the daemon creates the file it should be in the correct context. I will test it tonight.
Thanks for the help,
Richard.
--
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.