Difference between revisions of "Spamassassin"

From wiki
(Add Bayes training)
(Dovecot install)
Line 1: Line 1:
 
{{WIP}}
 
{{WIP}}
 +
 +
== Install ==
 +
 +
<syntaxhighlight lang="console">
 +
# apt install spamassassin
 +
</syntaxhighlight>
 +
 
edit file <code>/etc/spamassassin/local.cf</code>
 
edit file <code>/etc/spamassassin/local.cf</code>
  
Line 10: Line 17:
 
# mkdir /var/lib/spamassassin/bayes_db
 
# mkdir /var/lib/spamassassin/bayes_db
 
</syntaxhighlight>
 
</syntaxhighlight>
 
  
 
== Training ==
 
== Training ==
Line 22: Line 28:
 
# sa-learn --spam --showdots --dir /var/maildir/<username>/Maildir/.Spam/cur/
 
# sa-learn --spam --showdots --dir /var/maildir/<username>/Maildir/.Spam/cur/
 
# sa-learn --ham --showdots --dir /var/maildir/<username>/Maildir/cur/
 
# sa-learn --ham --showdots --dir /var/maildir/<username>/Maildir/cur/
 +
</syntaxhighlight>
 +
 +
== Integrate with exim ==
 +
 +
<syntaxhighlight lang="console">
 +
# apt install sa-exim
 +
</syntaxhighlight>
 +
 +
== Integrate with dovecot ==
 +
 +
<syntaxhighlight lang="console">
 +
# apt install dovecot-antispam
 +
</syntaxhighlight>
 +
 +
In file <code>/etc/dovecot/conf.d/20-imap.conf</code>, modify the option ''mail_plugins'' and add ''antispam'' to the list
 +
<syntaxhighlight lang="ini">
 +
protocol imap {
 +
  # Space separated list of plugins to load (default is global mail_plugins).
 +
  mail_plugins = $mail_plugins antispam
 +
}
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 08:39, 4 March 2016


Warning Warning: This page is a work in progress and is not completed. Important informations might be missing or wrong.

Install

# apt install spamassassin

edit file /etc/spamassassin/local.cf

bayes_path /var/lib/spamassassin/bayes_db/bayes
bayes_file_mode 0770
# mkdir /var/lib/spamassassin/bayes_db

Training

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.
# sa-learn --spam --showdots --dir /var/maildir/<username>/Maildir/.Spam/cur/
# sa-learn --ham --showdots --dir /var/maildir/<username>/Maildir/cur/

Integrate with exim

# apt install sa-exim

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
}