Scalable Anti-Spam Using Spamassassin and MySQL

Revision as of 01:47, 11 July 2015 by Jorge de la Cruz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Spamassassin Bayes Database Options

   KB 5831        Last updated on 2015-07-11  

(0 votes)

By default, SpamAssassin in Zimbra ZCS utilizes a Berkeley DB format database for it's Bayes filtering data. The Berkeley DB format database implementation in SpamAssassin uses a sequential locking mechanism which can impede message processing for larger ZCS installations. Thus the default for SpamAssassin to use the Berkeley DB format database may not be ideal.

Alternatively, SpamAssassin can be configured to use a dedicated MySQL back-end database on an MTA node to store its Bayes filtering data. A MySQL database affords increased performance to SpamAssassin and message processing as it allows for concurrent access to the indexed database.

Although there is some overhead in running and maintaining an extra MySQL database instance, the performance gains may warrant this extra overhead.

Enabling MySQL Database

As the zimbra user, run the following commands:

zmlocalconfig -e antispam_mysql_enabled=TRUE
zmantispamctl restart

Reverting to (Default) Berkeley DB Format Database

As the zimbra user, run the following commands:

zmlocalconfig -e antispam_mysql_enabled=FALSE
zmantispamctl restart

Migrating to (Default) Berkeley DB Format Database

Migrating existing Bayes data (from Berkeley DB to MySQL DB) is currently not supported.

Accessing a Remote Spamassassin MySQL Database

Optionally in a multi-node environment, if a Spamassassin MySQL Database server is already running on another MTA node, Spamassassin can be configured to utilize that remote Spamassassin MySQL Database (instead of running an additional MySQL database instance).

To configure Spamassassin to utilize a remote Spamassassin MySQL Database server, the user name and password of the remote Spamassassin MySQL Database is required. This can be obtained by running the following commands as the zimbra user:

On remote server

zmlocalconfig -s antispam_mysql_user
zmlocalconfig -s antispam_mysql_password

To enable the local MTA server to access the remote Spamassassin MySQL Database, as the zimbra user, run the following commands on the local server:

On local server

zmlocalconfig -e antispam_mysql_user=<username>
zmlocalconfig -e antispam_mysql_password=<password>
zmlocalconfig -e antispam_mysql_host=<remote_host>
zmlocalconfig -e antispam_mysql_enabled=TRUE
zmantispamctl restart

where <username> is the name of the MySQL user and <password> is the password for the MySQL user account on the remote server; and where <remote_host> is the FQDN of the remote host already running the Spamassassin MySQL Database engine.

Verified Against: ZCS 7.0 Date Created: 5/5/2011
Article ID: Date Modified: 2015-07-11

Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search