From f7833d2f409d4e3586c4b9da7d48842da2a3d843 Mon Sep 17 00:00:00 2001 From: Zhang Huangbin Date: Fri, 9 Dec 2016 20:15:44 +0800 Subject: [PATCH] Fix incorrect username used by SA bayes. --- .../howto/store.spamassassin.bayes.in.sql.md | 23 +++++++++++-------- html/store.spamassassin.bayes.in.sql.html | 22 +++++++++++------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/en_US/howto/store.spamassassin.bayes.in.sql.md b/en_US/howto/store.spamassassin.bayes.in.sql.md index 32ebbc47..29fb9e5f 100644 --- a/en_US/howto/store.spamassassin.bayes.in.sql.md +++ b/en_US/howto/store.spamassassin.bayes.in.sql.md @@ -86,11 +86,17 @@ bayes_sql_dsn DBI:mysql:sa_bayes:127.0.0.1:3306 bayes_sql_username sa_user bayes_sql_password sa_user_password -# Override the username used for storing -# data in the database. This could be used to group users together to -# share bayesian filter data. You can also use this config option to -# trick sa-learn to learn data as a specific user. -bayes_sql_override_username vmail +# Override the username used for storing data in the database. +# This could be used to group users together to share bayesian filter data. +# You can also use this config option to trick sa-learn to learn data as a +# specific user. +# +# In iRedMail, SpamAssassin is called by Amavisd, so we must set it to be +# same as Amavisd daemon user: +# - on Linux, it's user `amavis`. +# - on FreeBSD, it's user `vscan`. +# - on OpenBSD, it's user `_vscan`. +bayes_sql_override_username amavis ``` Make sure SpamAssassin will load bayes modules: @@ -102,15 +108,14 @@ May 16 09:59:33 ... SpamAssassin loaded plugins: ..., Bayes, ... May 16 10:27:38 ... extra modules loaded after daemonizing/chrooting: Mail/SpamAssassin/BayesStore/MySQL.pm, Mail/SpamAssassin/BayesStore/SQL.pm, ... ``` -Looks fine. Now press `Ctrl-C` to terminate above command. - -Start Amavisd service: +Looks fine, now press `Ctrl-C` to terminate above command, and start Amavisd +service again normally: ``` # /etc/init.d/amavisd restart ``` -It is required we initialize the database by learning a message. We use the +It is required to initialize the database by learning a message. We use the sample spam email shipped in the RPM package provided by CentOS 6: ``` diff --git a/html/store.spamassassin.bayes.in.sql.html b/html/store.spamassassin.bayes.in.sql.html index 762274a8..a66a5623 100644 --- a/html/store.spamassassin.bayes.in.sql.html +++ b/html/store.spamassassin.bayes.in.sql.html @@ -99,11 +99,17 @@ bayes_sql_dsn DBI:mysql:sa_bayes:127.0.0.1:3306 bayes_sql_username sa_user bayes_sql_password sa_user_password -# Override the username used for storing -# data in the database. This could be used to group users together to -# share bayesian filter data. You can also use this config option to -# trick sa-learn to learn data as a specific user. -bayes_sql_override_username vmail +# Override the username used for storing data in the database. +# This could be used to group users together to share bayesian filter data. +# You can also use this config option to trick sa-learn to learn data as a +# specific user. +# +# In iRedMail, SpamAssassin is called by Amavisd, so we must set it to be +# same as Amavisd daemon user: +# - on Linux, it's user `amavis`. +# - on FreeBSD, it's user `vscan`. +# - on OpenBSD, it's user `_vscan`. +bayes_sql_override_username amavis

Make sure SpamAssassin will load bayes modules:

@@ -114,12 +120,12 @@ May 16 10:27:38 ... extra modules loaded after daemonizing/chrooting: Mail/SpamAssassin/BayesStore/MySQL.pm, Mail/SpamAssassin/BayesStore/SQL.pm, ... -

Looks fine. Now press Ctrl-C to terminate above command.

-

Start Amavisd service:

+

Looks fine, now press Ctrl-C to terminate above command, and start Amavisd +service again normally:

# /etc/init.d/amavisd restart
 
-

It is required we initialize the database by learning a message. We use the +

It is required to 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