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_username sa_user
bayes_sql_password sa_user_password bayes_sql_password sa_user_password
# Override the username used for storing # Override the username used for storing data in the database.
# data in the database. This could be used to group users together to # This could be used to group users together to share bayesian filter data.
# share bayesian filter data. You can also use this config option to # You can also use this config option to trick sa-learn to learn data as a
# trick sa-learn to learn data as a specific user. # specific user.
bayes_sql_override_username vmail #
# 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: 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: May 16 10:27:38 ... extra modules loaded after daemonizing/chrooting:
Mail/SpamAssassin/BayesStore/MySQL.pm, Mail/SpamAssassin/BayesStore/SQL.pm, ... Mail/SpamAssassin/BayesStore/MySQL.pm, Mail/SpamAssassin/BayesStore/SQL.pm, ...
``` ```
Looks fine. Now press `Ctrl-C` to terminate above command. Looks fine, now press `Ctrl-C` to terminate above command, and start Amavisd
service again normally:
Start Amavisd service:
``` ```
# /etc/init.d/amavisd restart # /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: 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_username sa_user
bayes_sql_password sa_user_password bayes_sql_password sa_user_password
# Override the username used for storing # Override the username used for storing data in the database.
# data in the database. This could be used to group users together to # This could be used to group users together to share bayesian filter data.
# share bayesian filter data. You can also use this config option to # You can also use this config option to trick sa-learn to learn data as a
# trick sa-learn to learn data as a specific user. # specific user.
bayes_sql_override_username vmail #
# 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> </code></pre>
<p>Make sure SpamAssassin will load bayes modules:</p> <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, ... Mail/SpamAssassin/BayesStore/MySQL.pm, Mail/SpamAssassin/BayesStore/SQL.pm, ...
</code></pre> </code></pre>
<p>Looks fine. Now press <code>Ctrl-C</code> to terminate above command.</p> <p>Looks fine, now press <code>Ctrl-C</code> to terminate above command, and start Amavisd
<p>Start Amavisd service:</p> service again normally:</p>
<pre><code># /etc/init.d/amavisd restart <pre><code># /etc/init.d/amavisd restart
</code></pre> </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> sample spam email shipped in the RPM package provided by CentOS 6:</p>
<pre><code># rpm -ql spamassassin | grep 'sample-spam' <pre><code># rpm -ql spamassassin | grep 'sample-spam'
/usr/share/doc/spamassassin-3.3.1/sample-spam.txt /usr/share/doc/spamassassin-3.3.1/sample-spam.txt