Scalable Anti-Spam Using Spamassassin and MySQL
Article Information |
---|
This article applies to the following ZCS versions. |
Spamassassin Bayes Database Options
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 MySQL back-end database 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 a 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
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.