I got one server that as far as I know has the same config as others, where sa-update (spamassassin) does not seems to work with the cron. I see it is in /etc/cron.daily/spamassassin (user root, active yes).
But when I check the dir: /var/lib/spamassassin/3.004006/updates_spamassassin_org/ the update date is stuck. While other servers, I see the date of this folder change every day.
I expected to see an error in the cron mail if something was wrong, but there is no error email. Also when running it from command line, sa-update works fine.
Where should I look to find the possible cause of this?
Update: Strange, found the problem. Somehow the dir and it files: /var/lib/spamassassin/3.004006/ had root as owned, instead of debian-spamd. Did a chown and now it works. Crazy Maybe it helps someone running into this some day.
Update2: I checked again, but latest update was 3 days ago. Stopped working again or the fix was never the solution.
You misunderstand the problem and solution, I think. The files should have always been owned by debian-spamd, because it would be a stupidly dangerous idea to run every process, particularly ones that interact with data from the internet, like sa-update, as root.
Ok I have to give a little update: is does not work again. Now I’m even more confused
Let’s see how to fix this.
But Joe you say:
because it would be a stupidly dangerous idea to run every process, particularly ones that interact with data from the internet, like sa-update , as root .
But the daily cron that is created on installation, for Spamassassin is assigned to the root user?
Ok I found the real reason. When I look at the /etc/cron.daily/spamassassin script I see:
CRON=0
test -f /etc/default/spamassassin && . /etc/default/spamassassin
test -x /usr/bin/sa-update || exit 0
test -x /etc/init.d/spamassassin || exit 0
command -v gpg > /dev/null || exit 0
if [ "$CRON" = "0" ] ; then
exit 0
fi
And the CRON = 1 value is the result from this line: test -f /etc/default/spamassassin && . /etc/default/spamassassin
Now I thought this was enabled by default, but looking at /etc/default/spamassassin it was off. I have no idea why, maybe I missed something during install? Anyway the content was:
It might be distro specific? If you enable SA I’d think this should get toggled at the same time?
That said, I’m on 11. I had to install 10, upgrade to 11, and then installed VM. That was close to a year and a half ago now. I suppose something in the scripts could have changed.