Colin Hogben wrote:
> I think it is a security risk because any user with access to
> the filesystem can get root access. E.g. if a security
> loophole compromises a daemon running as user nobody, the
> attacker can append or overwrite the file with naughty
> commands, which then get executed as root next time the cron
> job runs. I.e. a non-root compromise gets escalated to a
> root compromise.
>
> Having said that, I am not an expert on e-smith so maybe
> there is some other factor in play, such as everything else
> being chrooted or somesuch, so I stand to be corrected.
Colin, you're absolutely right. Files should never (or at least VERY seldom, and only if you know exactly what you're doing) be mode 777, and ESPECIALLY not when they're owned by root.
As Colin pointed out, anyone with access to the filesystem could write their own commands into the file, then they would be run the next hour and could destroy the system or something. The cron jobs in /etc/cron.hourly are not run chrooted or otherwise protected (wouldn't be able to do their jobs that way) so that won't save you.
In the interests of further promoting the e-smith architecture, I should probably also recommend that you put your script in /etc/e-smith/templates-custom/etc/cron.hourly rather than just in /etc/cron.hourly -- that will mean it gets backed up as a custom configuration, and keeps all your special additions to the server separate so you can find and manage them more easily.
K.