CINXE.COM

Reject mail inline using SpamAssassin spamd

<!-- https://www.benzedrine.ch/milter-spamd.html I get up at 5 in the morning, I fight traffic, I bust my hump all day, then I fight traffic again, then I pay my taxes - The End - Jack Arnold, The Wonder Years //--> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta name="description" content="Reject mail inline using SpamAssassin spamd"> <meta name="keywords" content="sendmail, milter, SpamAssassin, spamd, filter, reject, mail"> <meta name="author" content="Daniel Hartmeier"> <meta name="robots" content="index, follow"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="canonical" href="https://www.benzedrine.ch/milter-spamd.html"> <title>Reject mail inline using SpamAssassin spamd</title> </head> <body text="#000000" bgcolor="#FFFFFF" link="#1919C0" vlink="#101030" alink="#FE0000"> <table width="100%"><tr><td> <table><tr><td valign=top height="62"> <img src="/logo.jpg" alt="[benzedrine.ch logo]"><br> </td></tr></table> </td></tr><tr><td> <table> <tr><td valign=top> <table cellspacing=2 cellpadding=1 border=0 width=175> <tr><td bgcolor="#C8C8FF" align=center><b>Contents</b></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/index.html">Home</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/dhartmei.html">Daniel Hartmeier</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/pf.html">Packet Filter</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/pfstat.html">pfstat</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/mailinglist.html">Mailing list</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/relaydb.html">Annoying spammers</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/ackpri.html">Prioritizing ACKs</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/transquid.html">Transparent squid</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/icbirc.html">Proxy ICB/IRC</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/milter-regex.html">milter-regex</a></td></tr> <tr><td bgcolor="#E0E0FF"><a href="/milter-spamd.html">milter-spamd</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/milter-checkrcpt.html">milter-checkrcpt</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/yubikey.html">login_yubikey</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/dorabella.html">Dorabella</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/tron.html">Tron</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/planetwars.html">Planet Wars</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/hexiom.html">Hexiom solver</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/3D-ODRPP.html">3D-ODRPP</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/polygon-partition.html">Polygon partition</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/grid-puzzle.html">Mikero's grid puzzle</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/darkstar.html">Dark Star</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/misc.html">Misc</a></td></tr> <tr><td bgcolor="#F0F0FF"><a href="/statistics.html">Statistics</a></td></tr> </table><br> </td><td valign=top> <table width=25><tr><td><br></td></tr></table> </td><td valign=top bgcolor="#F0F0FF" width="100%"> <!--------------------------------------------------------------- --> <h2>Reject mail inline using SpamAssassin spamd</h2><p> <h3>Introduction</h3> See <a href="milter-regex.html">milter-regex</a> for a general introduction to milter plugins.<p> 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.<p> 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 <a href="http://wiki.apache.org/spamassassin/IntegratedInMta">elsewhere</a> ;)<p> milter-spamd runs on OpenBSD and is <a href="http://www.opensource.org/licenses/bsd-license.php">BSD licensed</a>.<p> <h3>Man page</h3> <pre> MILTER-SPAMD(8) OpenBSD System Manager's Manual MILTER-SPAMD(8) NAME milter-spamd - sendmail milter plugin for SpamAssassin spamd SYNOPSIS milter-spamd [-d] [-i RE] [-p pipe] [-u user] [-U spamd-user] DESCRIPTION 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\.ch$)' would skip filtering for senders whose host names end in .ben- zedrine.ch or whose IP addresses start with 127. or 10.1. -p pipe Use the specified pipe to interface sendmail(8). Default is unix:/var/spool/milter-spamd/sock. -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. -U spamd-user Pass the specified user to spamd, so that user's SpamAssassin settings are used instead of the default system-wide ones. SENDMAIL CONFIGURATION The plugin needs to be registered in the sendmail(8) configuration, by adding the following lines to the .mc file INPUT_MAIL_FILTER(`milter-spamd', `S=unix:/var/spool/milter-spamd/sock, T=S:30s;R:2m') rebuilding /etc/mail/sendmail.cf from the .mc file using m4(1), and restarting sendmail(8). LOGGING 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 file: !milter-spamd daemon.err;daemon.notice /var/log/milter-spamd SEE ALSO egrep(1), mailstats(1), regex(3), syslog.conf(5), re_format(7), sendmail(8), syslogd(8) Simple Mail Transfer Protocol, RFC 2821. Enhanced Mail System Status Codes, RFC 1893. HISTORY The first version of milter-spamd was written in 2004. AUTHORS Daniel Hartmeier &lt;daniel@benzedrine.ch&gt; OpenBSD 3.7 September 24, 2003 2 </pre> <h3>Sources</h3> <ul> <li><a href="milter-spamd-0.9.tar.gz">milter-spamd-0.9.tar.gz</a> source tarball <i>MD5 42bc41678b1430c60b3f83baaee9c59a</i> <a href="milter-spamd-0.9.tar.gz.asc">GPG signature</a><br> <li><a href="milter-spamd-0.8.tar.gz">milter-spamd-0.8.tar.gz</a> source tarball <i>MD5 198dbf9ab4f0fc3b13305b43b5db7751</i> <a href="milter-spamd-0.8.tar.gz.asc">GPG signature</a><br> <li><a href="milter-spamd-0.7.tar.gz">milter-spamd-0.7.tar.gz</a> source tarball <i>MD5 4b3f3dcf2c31ce7b9ed8f2a5102c1e69</i> <a href="milter-spamd-0.7.tar.gz.asc">GPG signature</a><br> <li><a href="milter-spamd-0.6.tar.gz">milter-spamd-0.6.tar.gz</a> source tarball <i>MD5 449ef09371e48cdc0963a9a5f5b53fd7</i> <a href="milter-spamd-0.6.tar.gz.asc">GPG signature</a><br> <li><a href="http://www.openbsd.org/cgi-bin/cvsweb/ports/mail/milter-spamd/">mail/milter-spamd</a> OpenBSD port<br> </ul> <p> <h3>History</h3> <h4>0.9: September 26, 2017</h4> Add -l option to specify maximum log level, defaults to 6 (LOG_INFO), i.e. excludes LOG_DEBUG. <h4>0.8: June 20, 2017</h4> Remove setegid/seteuid calls. <h4>0.7: January 16, 2017</h4> Add pieces to build on Linux. Use make -f Makefile.linux. <h4>0.6: January 16, 2014</h4> 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 SpamAssassin. 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. <h4>0.5: February 20, 2007</h4> Remove man page section about building sendmail with milter support, this is the default since a while. <h4>June 6, 2005</h4> Fixes for multi-receipient mails (state machine). <h4>October 31, 2004</h4> 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 by milter-spamd. <h4>0.3: April 4, 2004</h4> Several bugfixes, add -i to exclude specific senders from getting filtered. <h4>0.1: April 3, 2004</h4> First version. <h3>Related links</h3> <ul> <li>sendmail and milter<br> <ul> <li><a href="http://www.milter.org/">milter.org</a> Helping you use libmilter to process your mail<br> <li><a href="http://www.sendmail.com/partner/resources/development/milter_api/api.html">Milter API</a><br> <li><a href="http://milter.free.fr/intro/">Milter Introduction</a> slides by Stephane Lentz<br> <li><a href="http://www.sendmail.org/">sendmail.org</a><br> <li><a href="http://vintners.net/~mikel/howto/milter.html">MikeL's FreeBSD howto - Milter</a> by Mike Lempriere<br> </ul> <li>SpamAssassin<br> <ul> <li><a href="http://www.spamassassin.org/">spamassassin.org</a> main site<br> <li><a href="https://wiki.apache.org/spamassassin/IntegratedInMta">IntegratedInMta</a><br> </ul> <li>OpenBSD<br> <ul> <li><a href="http://www.openbsd.org/">openbsd.org</a> The OpenBSD Project<br> </ul> <li>SMTP<br> <ul> <li><a href="http://www.faqs.org/rfcs/rfc821.html">RFC 821</a> Simple Mail Transfer Protocol (SMTP)<br> <li><a href="http://www.faqs.org/rfcs/rfc1893.html">RFC 1893</a> Enhanced Mail System Status Codes<br> </ul> <li>Other milter plugins (multiple plugins can be chained)<br> <ul> <li><a href="milter-regex.html">milter-regex</a> filtering using regular expression (and links to other milter plugins)<br> </ul> </ul> <p> <!--------------------------------------------------------------- --> </td></tr> </table> </td></tr><tr><td> <center> <small> Last updated on Tue Sep 26 08:57:43 2017 by <a href="mailto:daniel@benzedrine.ch">daniel@benzedrine.ch</a><a href="/crawlertrap/index.html?no-prefetch">.</a><br><br> </small> </center> </td></tr> </table> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10