Spamassassin: Difference between revisions
From wiki
Dovecot install |
Change user running spamassassin to vmail |
||
| Line 7: | Line 7: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Bayesian filter == | |||
To reach a good efficiency, SpamAssassin Bayesian filter need to be trained with both spam and ham messages. You can use your actual mailbox for that but note the following points: | |||
* Be sure that the folders you use for training contain only spam or ham. If a folder contain a mix of them, SpamAssassin will learn wrong info and produce bad quality results | |||
* To be effective you need between 1000 and 5000 messages each of both spam and ham. | |||
* You need to have more ham than spam to train. Otherwise, SpamAssassin might become biased toward spam. | |||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
# | # su vmail -s /bin/sh -c "sa-learn --spam --progress --dir /var/maildir/<username>/Maildir/.Spam/cur/" | ||
# su vmail -s /bin/sh -c "sa-learn --spam --progress --dir /var/maildir/<username>/Maildir/cur/" | |||
</syntaxhighlight> | </syntaxhighlight> | ||
To check the status of the database, you can run | |||
To | |||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
# | # su vmail -s /bin/sh -c "sa-learn --dump magic" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 34: | Line 29: | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
# apt install sa-exim | # apt install sa-exim | ||
</syntaxhighlight> | |||
Configuration is stored in <code>/etc/exim4/sa-exim.conf</code>. | |||
Edit the following setting | |||
<syntaxhighlight lang="apache"> | |||
SAspamcUser: vmail | |||
</syntaxhighlight> | |||
By defauld ''sa-exim'' is disabled. Remove the following lines to enable it | |||
<syntaxhighlight lang="apache"> | |||
#---------------------------------------------------------------------- | |||
# Remove or comment out the following line to enable sa-exim | |||
SAEximRunCond: 0 | |||
#---------------------------------------------------------------------- | |||
</syntaxhighlight> | |||
You can now restart exim to take you settings into account | |||
<syntaxhighlight lang="console"> | |||
# service exim4 restart | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 49: | Line 64: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Install]] | |||
Revision as of 23:30, 7 March 2016
| This page is a work in progress and is not completed. Important informations might be missing or wrong. |
Install
# apt install spamassassin
Bayesian filter
To reach a good efficiency, SpamAssassin Bayesian filter need to be trained with both spam and ham messages. You can use your actual mailbox for that but note the following points:
- Be sure that the folders you use for training contain only spam or ham. If a folder contain a mix of them, SpamAssassin will learn wrong info and produce bad quality results
- To be effective you need between 1000 and 5000 messages each of both spam and ham.
- You need to have more ham than spam to train. Otherwise, SpamAssassin might become biased toward spam.
# su vmail -s /bin/sh -c "sa-learn --spam --progress --dir /var/maildir/<username>/Maildir/.Spam/cur/"
# su vmail -s /bin/sh -c "sa-learn --spam --progress --dir /var/maildir/<username>/Maildir/cur/"
To check the status of the database, you can run
# su vmail -s /bin/sh -c "sa-learn --dump magic"
Integrate with exim
# apt install sa-exim
Configuration is stored in /etc/exim4/sa-exim.conf.
Edit the following setting
SAspamcUser: vmail
By defauld sa-exim is disabled. Remove the following lines to enable it
#----------------------------------------------------------------------
# Remove or comment out the following line to enable sa-exim
SAEximRunCond: 0
#----------------------------------------------------------------------
You can now restart exim to take you settings into account
# service exim4 restart
Integrate with dovecot
# apt install dovecot-antispam
In file /etc/dovecot/conf.d/20-imap.conf, modify the option mail_plugins and add antispam to the list
protocol imap {
# Space separated list of plugins to load (default is global mail_plugins).
mail_plugins = $mail_plugins antispam
}