I don't think that the -u option of sa-learn quite cuts it. According to the
man page, that's (simply) used for sql. You need to run in vpopmail's entire
environment (shell), so you should always run sa-learn using sudo:
sudo -u vpopmail -H sa-learn ...
Be sure to include the -H option, as that sets the home directory properly,
which is where the bayes databases reside. You need to do this in all 3
places where sa-learn is executed.
Also, in some instances (when sa-learn does a --force-expire at least), for
some odd reason sa-learn doesn't honor sudo entirely, and the bayes_toks
file ends up being owned by root. To keep this from being a problem, I'd add
the following to the end of your script:
chown vpopmail:vchkpw /home/vpopmail/.spamassassin/bayes_*
That should fix you up.
BTW, you might want to consider doing a --force-expire nightly as well, and
turn off auto-expire in the local.cf file. On some older hosts the
auto-expire can take long enough for an smtp session to time out, resulting
in a duplicate message being sent.
Kent Busbee wrote:
> Something is wrong with my Spam Assassin Bayes. Every message seems to be
> coming in at bayes_00:
>
> X-Spam-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_00, ...
>
> I have Spam Buttons setup in Squirrel Mail, and they seem to work. It may
> be that I am somehow running SA as the wrong user. It seems that I have
> the Spam buttons pointing to root. Then changed them to correctly use
> vpopmail. I think SA or something is running (incorrectly) as root. How
> can I tell?
>
> Here is my setup:
>
> from /var/html/pluggins/spam_buttons/config.conf
> <snip>
> $is_spam_shell_command = 'cat > /usr/share/sa-learn/spam/`date
> +%Y%m%d%M%S`###USERNAME######DOMAIN###';
> $is_not_spam_shell_command = 'cat > /usr/share/sa-learn/ham/`date
> +%Y%m%d%M%S`###USERNAME######DOMAIN###';
> </snip>
>
> from crontab (root):
> <snip>
> # update the bayes in spamassasin every 30 min
> 30 * * * * /bin/su - -c /usr/bin/ncs_spam_learn.sh
> </snip>
>
> cat /usr/bin/ncs_spam_learn.sh
>
> #!/bin/bash
> # Spam Assassin Bayes Training
> # Learn spam!
> cd /usr/share/sa-learn/spam
> /usr/bin/sa-learn -u vpopmail --spam ./2*
> /usr/bin/ncs_whitelist.sh -r ./2*
> mv ./2* ./done
> # Learn ham!
> cd /usr/share/sa-learn/ham
> /usr/bin/sa-learn -u vpopmail --ham ./2*
> /usr/bin/ncs_whitelist.sh ./2*
> mv ./2* ./done
> # Update the Bayes DB
> /usr/bin/sa-learn --sync
>
> Finally, who is running what:
> ps aux | grep spam
> vpopmail 2962 0.0 0.0 3428 488 ? S May25 0:17
> /usr/bin/tcpserver -v -R -H -l mail.northlakechristian.org -x
> /etc/tcprules.d/tcp.smtp.cdb -c 100 -u 89 -g 89 0 smtp
> /usr/local/bin/spamdyke --config-file /etc/spamdyke/spamdyke.conf
> /var/qmail/bin/qmail-smtpd /home/vpopmail/bin/vchkpw /bin/true
> root 2966 0.0 0.0 1428 216 ? S May25 0:00 supervise
> spamd
> qmaill 9339 0.9 0.0 2688 316 ? S 04:02 6:47
> /usr/bin/multilog t s1000000 n100 /var/log/qmail/spamd
> root 9340 0.0 2.4 56504 51140 ? S 04:02 0:08
> /usr/bin/perl -T -w /usr/bin/spamd -x -u vpopmail -s stderr
> vpopmail 9397 2.7 4.9 109312 103404 ? S 04:03 20:36 spamd child
> vpopmail 10338 0.0 0.0 3892 1824 ? S May28 0:00
> /usr/local/bin/spamdyke --config-file /etc/spamdyke/spamdyke.conf
> /var/qmail/bin/qmail-smtpd /home/vpopmail/bin/vchkpw /bin/true
> vpopmail 10613 0.7 3.8 85800 80104 ? S 05:13 4:46 spamd child
> root 29246 0.0 0.0 4364 652 pts/0 S+ 16:23 0:00 grep spam
> ps aux | grep scan
> root 2915 0.0 0.0 1672 300 ? S May25 0:05 svscan
> root 2945 0.0 0.0 2856 300 ? S May25 0:07 svscan
> root 29343 0.0 0.0 4796 656 pts/0 S+ 16:25 0:00 grep scan
>
> I know this is a tangent, but any help would be appreciated.
>
>
>
> Kent Busbee
> Director of Technology
> Northlake Christian School
>
--
-Eric 'shubes'
---------------------------------------------------------------------
QmailToaster hosted by: VR Hosted <http://www.vr.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]