This document describes several methods of integrating rspamd with some popular MTAs. Among them are:
This document also describes the rspamd LDA proxy mode that can be used for any MTA.
From version 1.6, you should use rspamd proxy worker in Milter mode to integrate Rspamd in Postfix.
Postfix configuration to scan messages on Rspamd daemon via milter protocol is very simple:
Starting from Exim 4.86, you can use Rspamd directly just like SpamAssassin:
For versions 4.70 through 4.84, a patch can be applied to enable integration. In the exim source directory run
patch -p1 < ../rspamd/contrib/exim/patch-exim-src_spam.c.diff.
For version 4.85, run the following from
contrib/exim in the rspamd source directory:
patch patch-exim-src_spam.c.diff < patch-exim-src_spam.c.diff.exim-4.85.diff
And then follow the steps above to apply the patch.
For versions 4.86 and 4.87 it is recommended to apply a patch to disable half-closed sockets:
patch -p1 < ../rspamd/contrib/exim/shutdown.patch
Alternatively, you can set
enable_shutdown_workaround = true in
Here is an example of the Exim configuration:
Sendmail can use rspamd via milter and configuration is just like for postfix. sendmail configuration could be like:
MAIL_FILTER(`rspamd', `S=inet:localhost:11332, F=T') define(`confINPUT_MAIL_FILTERS', `rspamd')
Then compile m4 to cf in the usual way.
Support for rspamd is available in haraka v2.7.0+: http://haraka.github.io/manual/plugins/rspamd.html.
To enable: add
rspamd to the
DATA section of your
config/plugins file and edit
config/rspamd.ini to suit your preferences.
In LDA mode, the MTA calls the rspamd client
rspamc which scans a message with
rspamd and appends scan results to the source message. The overall scheme is demonstrated in the following picture:
To enable LDA mode,
rspamc has the following options implemented:
--exec "/path/to/lda params": executes the binary specified to deliver modified message
--mime: modify message instead of printing scan results only
--json: optionally add the full output as base64 encoded
Here is an example of using
dovecot as LDA implemented using
mda "/usr/bin/rspamc --mime --exec \"/usr/lib/dovecot/deliver -d %T\""
In this mode,
rspamc cannot reject or greylist messages, but it appends the following headers that can be used for further filtering by means of the LDA (for example,
X-Spam-Scanner: name and version of rspamd
X-Spam: has value
yesif rspamd detects that a message as a spam (either
X-Spam-Action: the desired action for a message (e.g.
X-Spam-Result: contains base64 encoded
JSONreply from rspamd if
--jsonoption was given to
Please note that despite the fact that this method can be used with any MTA (or even without an MTA), it has more overhead than other methods and it cannot apply certain actions, like greylisting (however, that could also be implemented using external tools).