Fix incorrect username used by SA bayes.

This commit is contained in:
Zhang Huangbin 2016-12-09 20:15:44 +08:00
parent 6c7dcf603a
commit f7833d2f40
2 changed files with 28 additions and 17 deletions

View File

@ -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:
```

View File

@ -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
</code></pre>
<p>Make sure SpamAssassin will load bayes modules:</p>
@ -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, ...
</code></pre>
<p>Looks fine. Now press <code>Ctrl-C</code> to terminate above command.</p>
<p>Start Amavisd service:</p>
<p>Looks fine, now press <code>Ctrl-C</code> to terminate above command, and start Amavisd
service again normally:</p>
<pre><code># /etc/init.d/amavisd restart
</code></pre>
<p>It is required we initialize the database by learning a message. We use the
<p>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:</p>
<pre><code># rpm -ql spamassassin | grep 'sample-spam'
/usr/share/doc/spamassassin-3.3.1/sample-spam.txt