Skip to contentSkip to conversation

root home directory and system cron jobs

DISCUSSION Erich Schubert 2 participants 5 messages Dec 3, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,
every now and then, system cron jobs will try to access /root (as this is the $HOME for the root user)

However since that dir usually is labeled sysadm_r, it will generate an audit error, and that is actually intended.

Does anyone have a good proposal on handling this issue? Maybe using something like HOME=/var/lib/system-cron-home in all system cron jobs? Any FHS information on that?

Apart from the SELinux issues, I believe that there are a couple of odd bugs that can be triggered by setting up weird dotfiles in /root on non-SELinux-systems. For example a cronjob using wget to download some files can probably be broken by setting up a non-working proxy in /root/.wgetrc

Also some cronjobs will try to use "su" to switch to a different userid. (e.g. the amavisd-new cronjob to do maintainance on the spamassassin bayes database); some might be able to be rewritten to use the other userid directly, but some might not...
(e.g. because they're installed in /etc/cron.daily, which doesn't use the cronjob syntax but is just a collection of shell scripts; they need to use su to switch to a different user)

best regards,
Erich Schubert

Signature · 9 lines
     erich@(vitavonni.de|debian.org)    --    GPG Key ID: 4B3A135C    (o_
 Why waste time learning, when ignorance is instantaneous? --- Calvin //\
          Humor sollte immmer dabeisein, auch bei Problemen.          V_/_


--
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.
#1 lore raw
Quoted 3 lines · Erich Schubert

Does anyone have a good proposal on handling this issue? Maybe using something like HOME=/var/lib/system-cron-home in all system cron jobs? Any FHS information on that?

Sounds reasonable to me.

I think it would be worth proposing on a more general mailing list with a rationale that doesn't involve SE Linux.

Quoted 5 lines

Apart from the SELinux issues, I believe that there are a couple of odd bugs that can be triggered by setting up weird dotfiles in /root on non-SELinux-systems. For example a cronjob using wget to download some files can probably be broken by setting up a non-working proxy in /root/.wgetrc

Yes, there's also other issues of system processes using /root. One example is that RHGB (the Red Hat Graphical Boot) program used to read and write (or try to under SE Linux) dot files. I expect that if the root user messed up their GNOME settings badly enough then the machine would fail to boot as a result. I'm not sure if that bug ever got resolved or was just closed as an upstream issue.

Quoted 7 lines

Also some cronjobs will try to use "su" to switch to a different userid. (e.g. the amavisd-new cronjob to do maintainance on the spamassassin bayes database); some might be able to be rewritten to use the other userid directly, but some might not...
(e.g. because they're installed in /etc/cron.daily, which doesn't use the cronjob syntax but is just a collection of shell scripts; they need to use su to switch to a different user)

There is no reason why they couldn't be installed in /etc/cron.d instead.

Signature · 9 lines
[email protected]
http://etbe.blogspot.com/          My Blog

http://www.coker.com.au/sponsorship.html Sponsoring Free Software development

--
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.
#2 lore raw

Hello Russel,

Quoted 9 lines
Quoted 7 lines

Also some cronjobs will try to use "su" to switch to a different userid. (e.g. the amavisd-new cronjob to do maintainance on the spamassassin bayes database); some might be able to be rewritten to use the other userid directly, but some might not...
(e.g. because they're installed in /etc/cron.daily, which doesn't use the cronjob syntax but is just a collection of shell scripts; they need to use su to switch to a different user)

There is no reason why they couldn't be installed in /etc/cron.d instead.

There is: the jobs in /etc/cron.daily are run in sequence once a day. If they were installed in /etc/cron.d they would each have to pick a time to run (and the admin to eventually change each of them). The cron.daily solution will execute them one-by-one (AFAIK) and thus create less load on the machine without extra configuration by the maintainers or the system administrator.

best regards,
Erich Schubert

Signature · 10 lines
    erich@(vitavonni.de|debian.org)    --    GPG Key ID: 4B3A135C    (o_
             Reality continues to ruin my life --- Calvin            //\
   Die kürzeste Verbindung zwischen zwei Menschen ist ein Lächeln.   V_/_



--
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.
#3 lore raw
Quoted 6 lines · Erich Schubert
Quoted 4 lines
Quoted 2 lines

Also some cronjobs will try to use "su" to switch to a different userid. (e.g. the amavisd-new cronjob to do maintainance on the

There is no reason why they couldn't be installed in /etc/cron.d instead.

There is: the jobs in /etc/cron.daily are run in sequence once a day.

Do you have some examples of jobs that need to be run in sequence?

Quoted 5 lines

If they were installed in /etc/cron.d they would each have to pick a time to run (and the admin to eventually change each of them). The cron.daily solution will execute them one-by-one (AFAIK) and thus create less load on the machine without extra configuration by the maintainers or the system administrator.

The cron daemon has code to monitor the system load and refrain from launching too many processes. The default value for this is high enough that most systems will never reach such a load, but it can be changed with the -l parameter (incidentally I have not tested this, just read the man page and read the source long ago).

Signature · 9 lines
[email protected]
http://etbe.blogspot.com/          My Blog

http://www.coker.com.au/sponsorship.html Sponsoring Free Software development

--
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.
#4 lore raw

Hi,

Quoted 1 line

Do you have some examples of jobs that need to be run in sequence?

No. It's just that I can imagine it to be nice to have them run in sequence on a high-load-system. OTOH, such systems can be adjusted by the admin as needed.

But it would require lots of changes to packages to deprecate /etc/cron.daily /etc/cron.weekly and /etc/cron.monthly Apart from the increased amount of work for the admin if he wants to reschedule maintainance cronjobs. Having a default time for all of the daily cronjobs is useful.
btw, it makes me wonder how many of the monthly cronjobs actually assume they'll be run on the first of each month, and not just once a month. Well, maybe it's specified somewhere that /etc/cron.monthly is to be run on the first of each month, I didn't check LSB on that.

Upstart, from Ubuntu, is to get some cron-like functionality IIRC. We should also talk to them about these problems.

best regards,
Erich Schubert

Signature · 11 lines
    erich@(vitavonni.de|debian.org)    --    GPG Key ID: 4B3A135C   (o_
       The best things in life are free: Friendship and Love.       //\
   Während das Glück dir lacht, wirst Freunde du zählen in Menge;   V_/_
     wenn sich der Himmel bewölkt, findest du dich bald allein.



--
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.