Table of content
SpamAssassin can classify the mail and in particular detect if it is spam or viruses. For this, it relies on several strategies: message analysis, blacklists querying, use of SPF records, …
- Requirement: Postfix
- Reference: SpamAssassin, Postfix Milter
Build information
Ensure the following options:
Configuration
The SpamAssassin configuration is located in the
/usr/local/etc/mail/spamassassin/
directory,
the main configuration file is local.cf
.
In this example we keep the default configuration.
The spamd
process is started under the
spamd
user identity and as it is to set up a server
type usage, only the global configuration will be considered (ie: no
user configuration).
Usage
The spamc
command will allow to ask the SpamAssassin
daemon to decide on the status of the message. Below, messages
weighting more than 100K or taking more than 10s to analyze will be
considered as valid.
This command is of course rarely invoked manually as it is integrated
into the mail server operation.
1 |
|
Rules can be updated (and should) using:
1 2 |
|
Integration
Postfix
It is possible to apply SpamAssassin using either a content filter or milter (mail filter)
Content filter
The master.cf
defines how the client program connects to the
service and what daemon is invoked when a service is requested. The
original configuration is modified to allow e-mails analysis by
SpamAssassin
-
The
content_filter=spamassassin
filter is applied tosmtp
: -
An entry is added for
spamassassin
:
Milter
Milter socket is added to the postfix configuration (if multiple sockets are to be used, they are coma-separated):
The spamass-milter
daemon must be enabled at startup, it
will allow communication between the postfix milter and SpamAssassin,
in the example below processing will be limited to 10s and
to message size below 10Mo: