1

Topic: Setup Bayes

==== Required information ====
- iRedMail version: 0.8.7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: FreeBSD 10
- Related log if you're reporting an issue:
Jul 12 02:07:55.811 [1975] dbg: plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x80a2b89a8) implements 'learner_new', priority 0
Jul 12 02:07:55.811 [1975] dbg: bayes: learner_new self=Mail::SpamAssassin::Plugin::Bayes=HASH(0x80a2b89a8), bayes_store_module=Mail::SpamAssassin::BayesStore::MySQL
Jul 12 02:07:55.840 [1975] dbg: bayes: using username: vmail
Jul 12 02:07:55.841 [1975] dbg: bayes: learner_new: got store=Mail::SpamAssassin::BayesStore::MySQL=HASH(0x80b2edb88)
Jul 12 02:07:55.841 [1975] dbg: plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x80a2b89a8) implements 'learner_is_scan_available', priority 0
Jul 12 02:07:55.872 [1975] dbg: bayes: database connection established
Jul 12 02:07:55.873 [1975] dbg: bayes: found bayes db version 3
Jul 12 02:07:55.873 [1975] dbg: bayes: unable to initialize database for vmail user, aborting!
====

I'm trying to setup Bayes following the article: http://www.iredmail.org/wiki/index.php? … yes.In.SQL

Created the database using /usr/local/share/doc/spamassassin/sql/bayes_mysql.sql instead of the one from apache.org.

But I'm confused for the settings for Spamassasin local.cf:
bayes_sql_username sa_user
bayes_sql_password sa_user_password
Do I create a new database user and password, or reuse an existing one?
When I run spamassassin --lint -D the output pasted above shows that Bayes is using 'vmail' instead of 'sa_user', because of 'bayes_sql_override_username vmail' in the Spamassassin local.cf?

Thanks!
Gerry

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Setup Bayes

*) As you can see in our wiki tutorial, we create a new SQL database "sa_bayes", create a new SQL user "sa_user" with password "sa_user_password".

*) Does it work if you comment out "bayes_sql_override_username"?

*) What's your settings in SpamAssassin config file?

3

Re: Setup Bayes

If I comment out 'bayes_sql_override_username vmail', then root is used and same error running 'spamassassin --lint -D':
Jul 13 01:34:01.900 [14811] dbg: bayes: unable to initialize database for root user, aborting!

Doesn't Bayes need to know the password for using vmail? How would that be specified?

My current spamassasin local.cf:
required_score      5.0
rewrite_header      subject [ SPAM ]
report_safe         0
lock_method         flock
use_bayes          1
bayes_auto_learn   1
bayes_auto_expire  1
bayes_store_module Mail::SpamAssassin::BayesStore::MySQL
bayes_sql_dsn      DBI:mysql:sa_bayes:127.0.0.1:3306
bayes_sql_username sa_user
bayes_sql_password (secret)
score ALL_TRUSTED -10.000
score DNS_FROM_AHBL_RHSBL 0
score URIBL_AB_SURBL 0 0.3306 0 0.3812
score URIBL_JP_SURBL 0 0.3360 0 0.4087
score URIBL_OB_SURBL 0 0.2617 0 0.3008
score URIBL_PH_SURBL 0 0.2240 0 0.2800
score URIBL_SBL 0 0.1094 0 0.1639
score URIBL_SC_SURBL 0 0.3600 0 0.4498
score URIBL_WS_SURBL 0 0.1533 0 0.2140
ok_locales          all

4

Re: Setup Bayes

Did you initialize the SQL database by learning a new message? It's mentioned in our wiki tutorial:

It is required we initialize the database by learning a message. We use the sample spam email shipped in the RPM package provided by CentOS 6:

# rpm -ql spamassassin | grep 'sample-spam'
/usr/share/doc/spamassassin-3.3.1/sample-spam.txt

# sa-learn --spam --username=vmail /usr/share/doc/spamassassin-3.3.1/sample-spam.txt
Learned tokens from 1 message(s) (1 message(s) examined)

I tried to reproduce your issue, got the same message if i didn't initialize the database with above steps. And no error if i initialize the database before executing 'spamassassin -lint -D'.

5

Re: Setup Bayes

Now I think I understand.  My error was because the database was unpopulated and a record could not be read.  I did not want to continue doing the tutorial until all my perceived errors were resolved.  (Side effect of my early programming experience where a single misplaced period could result in 300 COBOL compiler errors!:-)

After doing the sa-learn, I now get no errors from 'spamassassin -lint -D'.
I'll finish the rest and train Bayes with my ham and spam mailboxes from my other mailstore.

Thanks once again for your excellent assistance!

6 (edited by GerryM 2014-07-14 06:48:50)

Re: Setup Bayes

One more question- since plugin markasjunk is already in /usr/local/www/roundcube/plugins, it looks like I don't have to download it from roundcube web site.  But where is config.inc.php.dist located?  It is missing in my FreeBSD installation.  A version of the file is in other roundcube plugin directories.  And after searching the forums, I see that using RoundCube's plugin manager is not supported.

edit:
ok, 'markasjunk' is not 'markasjunk2'.  But the above reference FAQ is a work in progress based on Roundcubemail-0.7.2 and my current install uses version 1.0.1, any suggestion on how to proceed?

7

Re: Setup Bayes

GerryM wrote:

edit:
ok, 'markasjunk' is not 'markasjunk2'.  But the above reference FAQ is a work in progress based on Roundcubemail-0.7.2 and my current install uses version 1.0.1, any suggestion on how to proceed?

It's almost the same procedure.