You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by John Hall <jo...@cambridgetechgroup.com> on 2006/01/30 17:56:09 UTC

Bayes DB username

Hi,

I'm using Exim 4.60 and SpamAssassin 3.1 and scanning at SMTP time. My bayes
data is stored in a Mysql database. I've configured exim to submit spam to
spamd as the user 'mail'. I've recently discovered that it has been storing
all the bayes data against the user 'root', whereas everything I've manually
learnt with sa-learn is being stored against the user 'mail'. The quick
solution is just to run sa-learn as 'root' rather than 'mail', but I wanted
to understand what was going on.

I ran spamd with -D, and saw the following in the logs:

Jan 25 15:27:49 dave spamd[7388]: prefork: ordered 7396 to accept
Jan 25 15:27:49 dave spamd[7388]: prefork: child 7396: entering state 2
Jan 25 15:27:49 dave spamd[7396]: spamd: got connection over
/var/run/spamd.sock
Jan 25 15:27:49 dave spamd[7388]: prefork: new lowest idle kid: 7397
Jan 25 15:27:49 dave spamd[7396]: spamd: checking message (unknown) for
mail:8
Jan 25 15:27:49 dave spamd[7396]: bayes: database connection established
Jan 25 15:27:49 dave spamd[7396]: bayes: found bayes db version 3
Jan 25 15:27:49 dave spamd[7396]: bayes: Using userid: 2

Userid 2 is root in the bayes database:
mysql> select id, username from bayes_vars;
+----+----------+
| id | username |
+----+----------+
|  1 | mail     |
|  2 | root     |
+----+----------+

Mail is being submitted as the user 'mail', but SA is using 'root' as the
user to store the data against. How does SA decide what username to use in
the bayes database?

Some more background:

The relevant bit of Exim config is as follows:

  # put headers in all messages (no matter if spam or not)
 warn  spam    = mail:true/defer_ok
       message = X-Scanned-By: SpamAssassin on
mail.cambridgetechgroup.com\n\
                 X-Spam-Score: $spam_score\n\
                 X-Spam-Bar: $spam_bar\n

 # reject spam at high scores (> 10)
 deny  message = This message appears to be spam (score: $spam_score,
subject: \"$h_Subject:\")
       condition = ${if >{$spam_score_int}{100}{1}{0}}

Spamd is invoked with the following arguments:

  --nouser-config --username=mail -C
/etc/mail/spamassassin --max-children=3 --socketpath=/var/run/spamd.sock

Thanks,