Gene Heskett wrote:
On Tuesday 21 July 2009, Bowie Bailey wrote:

First off, sa-learn and sa-update have absolutely nothing to do with
each other.  sa-update downloads new rules and sa-learn trains the Bayes
subsystem.  Just wanted to clarify this since your last message seemed
to imply that you thought they were connected somehow.

I knew that, and was just making a comment that it wasn't 'taking'. Sorry I wasn't clearer.

Are you getting BAYES_XX hits for the messages?  Bayes needs to learn
>from at least 200 ham and 200 spam before it will start scoring.  Also,
make sure that you are running sa-learn as the same user SA is running
as.  A classic mistake is to run SA as one user and then run sa-learn as
a different user.

Aha! sa-learn is running from the root crontab, and is training the bayes for the user gene, and kmail then suck /var/spool/mail/gene for the input I'm reading.
The script is a bit complex and designed to do its own msg haandling.
-----------------------
#!/bin/bash
PATH=/sbin:/root/bin:/usr/bin:/bin
# make sure the database is free
killall fetchmail
# wait for the spamd pipes to drain
sleep 60
# do this dastardly deed
cp /root/Mail/ham/cur/* /home/gene/Mail/ham/cur/
cp /root/Mail/spam/cur/* /home/gene/Mail/spam/cur/
chown gene:gene /home/gene/Mail/ham/cur/*
chown gene:gene /home/gene/Mail/spam/cur/*
runuser -l gene -c "sa-learn --ham  /home/gene/Mail/ham/cur/*"
runuser -l gene -c "sa-learn --spam /home/gene/Mail/spam/cur/*"
# now, this stuff is trash
rm -f /home/gene/Mail/ham/cur/*
rm -f /home/gene/Mail/spam/cur/*
rm -f /root/Mail/spam/cur/*
# Note, I leave the ham for moving where it really goes
# and restore fetchmail
# and for some reason, on wednesday morning 12/17/08, fetchmail.log
# was owned by root:root! WTF???
# That is a long time for logrotate to take effect, which is the only
# other thing that could do this
# So: (and put it in rc.local too just for good measure)
chown gene:gene /var/log/fetchmail.log
# to let the disks synch
sleep 6
runuser -l gene -c "fetchmail -d 90 --fetchmailrc /home/gene/.fetchmailrc"
------------------------
as can be seen, the mail delivery system all runs as the user gene.
So, in light of this, I should be running saupdate as gene, not as a separate user.

Thanks for the forehead slap Bowie, I needed that. :)

Well, like I said before, sa-update has no relation to sa-learn. As long as it is working properly, it does not matter what user you are using for sa-update.

The question is: What user is SpamAssassin running as? If you are running spamd as root, then it will switch itself to the user account who is receiving the mail. If you are running using amavisd-new, it will run as the amavis user. If you are calling spamassassin directly from procmail or some other delivery agent, it will run as whichever user procmail (or whatever) is running as. (Unless you have specified a global bayes database, in which case SA will always use that db.)

One option is to disable your learning script for a while and then once all the users have received some auto-learned mail, search the home directories for the "bayes_seen" file and see which one(s) are being updated.

--
Bowie

Reply via email to