Reject mail inline using SpamAssassin spamd
See milter-regex for a general introduction
to milter plugins.
This program is very simple. About 700 lines of C code. No configuration file.
Only basic functionality. No bells and whistles. This is a design choice.
There are plenty of other plugins that provide much more functionality.
In short, if this is all you need, it's probably the easiest and most
efficient choice. If it isn't, you'll have to fork and extend the code,
or look elsewhere ;)
milter-spamd runs on OpenBSD and is
MILTER-SPAMD(8) OpenBSD System Manager's Manual MILTER-SPAMD(8)
milter-spamd - sendmail milter plugin for SpamAssassin spamd
milter-spamd [-d] [-i RE] [-p pipe] [-u user] [-U spamd-user]
The milter-spamd plugin can be used with the milter API of sendmail(8) to
filter mails based on decisions from SpamAssassin's spamd(1) daemon.
Mails are piped to the daemon, which decides whether a mail is spam or
not according to its own configuration. Spam mails are rejected with an
SMTP 554 ("Transaction failed") reply, containing the score from spamd.
This typically causes the remote MTA to generate a bounce message to the
sender. Non-spam mails are accepted without any modifications.
The options are as follows:
-d Do not detach from controlling terminal. Produce verbose out-
put on stdout for debugging.
-i RE Accept mails without invoking spamd for peers whose host names
or IP addresses match the specified regular expression. The
argument is a case-insensitive extended regular expression
(like an argument of egrep(1) -i). Example:
# milter-spamd -i '(^127\.|^10\.1\.|\.benzedrine\.cx$)'
would skip filtering for senders whose host names end in .ben-
zedrine.cx or whose IP addresses start with 127. or 10.1.
-p pipe Use the specified pipe to interface sendmail(8). Default is
-u user Run as the specified user instead of the default, _milter-
spamd. When milter-spamd is started as root, it calls
setuid(2) to drop privileges. The non-privileged user should
have read access to the configuration file and read-write ac-
cess to the pipe.
Pass the specified user to spamd, so that user's SpamAssassin
settings are used instead of the default system-wide ones.
The plugin needs to be registered in the sendmail(8) configuration, by
adding the following lines to the .mc file
rebuilding /etc/mail/sendmail.cf from the .mc file using m4(1), and
milter-spamd sends log messages to syslogd(8) using facility daemon and,
with increasing verbosity, level err, notice, info and debug. The fol-
lowing syslog.conf(5) section can be used to log messages to a dedicated
egrep(1), mailstats(1), regex(3), syslog.conf(5), re_format(7),
Simple Mail Transfer Protocol, RFC 2821.
Enhanced Mail System Status Codes, RFC 1893.
The first version of milter-spamd was written in 2004.
Daniel Hartmeier <firstname.lastname@example.org>
OpenBSD 3.7 September 24, 2003 2
0.6: January 16, 2014
SpamAssassin uses the top-most (trusted) Received: header in its score rules.
Because sendmail inserts its own Received: header only after the milter plugin
has been called, the plugin adds a similar header to the output sent to
Improve this fake header by adding the authentication parts, when available.
Some SpamAssassin rules use these to score favorably.
Suggested and tested by Joerg Jung.
0.5: February 20, 2007
Remove man page section about building sendmail with milter support,
this is the default since a while.
June 6, 2005
Fixes for multi-receipient mails (state machine).
October 31, 2004
milter-spamd 0.3 has been successfully tested with SpamAssassin 3.0.1.
The API changes mentioned in the SpamAssassin upgrade documentation
seem to refer to the command line interface, not the TCP interface used
0.3: April 4, 2004
Several bugfixes, add -i to exclude specific senders from getting
0.1: April 3, 2004
- sendmail and milter
- RFC 821 Simple Mail Transfer Protocol (SMTP)
- RFC 1893 Enhanced Mail System Status Codes
- Other milter plugins (multiple plugins can be chained)
- milter-regex filtering using regular expression (and links to other milter plugins)