bayes on MySQL problem

Matt Kettler mkettler at evi-inc.com
Fri Mar 24 21:19:13 GMT 2006


Kosta Lekas wrote:
> I moved my local bayes to a remote mysql. When I lint the rule set as
> root on my MS gateway everything is good (output below):
> 
> spamassassin -D -p /etc/MailScanner/spam.assassin.prefs.conf --lint

What version of MailScanner are you on? You shouldn't need to pass -p to
spamassassin anymore. There should be a /etc/mail/spamassassin/mailscanner.cf
which is a symlink to spam.assassin.prefs.conf.


> 
> [11229] dbg: bayes: using username: root
> 
> [11229] dbg: bayes: database connection established
> 
> [11229] dbg: bayes: found bayes db version 3
> 
> [11229] dbg: bayes: Using userid: 1
> 
> [11229] dbg: bayes: corpus size: nspam = 2042, nham = 1857
> 
> [11229] dbg: bayes: tok_get_all: token count: 20
> 
> [11229] dbg: bayes: cannot use bayes on this message; not enough usable
> tokens found
> 
> [11229] dbg: bayes: not scoring message, returning undef
> 
>  
> 
>  
> 
> But with MailScanner debug on I see problems when running as postfix:
> 
> [11285] dbg: bayes: database connection established
> 
> [11285] dbg: bayes: found bayes db version 3
> 
> [11285] dbg: bayes: unable to initialize database for postfix user,
> aborting!
> 
> [11285] dbg: bayes: not scoring message, returning undef
> 
> [11285] dbg: bayes: opportunistic call attempt failed, DB not readable
> 
>  
> 
> I followed the wiki
> http://www.sng.ecs.soton.ac.uk/mailscanner/serve/cache/390.html
> 
>  
> 
> I have set in my spam.assassin .prefs.conf:
> 
> bayes_store_module      Mail::SpamAssassin::BayesStore::SQL
> bayes_sql_dsn           DBI:mysql:*sa_bayes:remoteMysqlBox*
> bayes_sql_username      *sa_user*
> bayes_sql_password      *sa_password*
> 


>  
> 
> Can someone please tell me what I am doing wrong.

You're using two different users.

To spamassassin, bayes databases are stored in SQL with a different table
per-user that EXECUTES spamassassin.

In your one test, you're running as root, thus it's going to look in root's
table. In the other test, you're running as postfix, so it is going to look in
the table for the postfix user.

I would suggest adding:
bayes_sql_override_username 	root

To your config. Note that "bayes_sql_username" sets the username that SA
authenticates to bayes with. This option sets what email "username" SA is going
to be using, thus which table it will use.



More information about the MailScanner mailing list