<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ra23.net &#187; sendmail</title>
	<atom:link href="http://ra23.net/wop/tag/sendmail/feed/" rel="self" type="application/rss+xml" />
	<link>http://ra23.net/wop</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 10 Mar 2011 23:45:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>SMF-SPAMD ein wenig aufgebohrt</title>
		<link>http://ra23.net/wop/2009/08/smf-spamd-ein-wenig-aufgebohrt/</link>
		<comments>http://ra23.net/wop/2009/08/smf-spamd-ein-wenig-aufgebohrt/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 02:02:40 +0000</pubDate>
		<dc:creator>Andre Rein</dc:creator>
				<category><![CDATA[milter-smf-spamd]]></category>
		<category><![CDATA[sendmail]]></category>
		<category><![CDATA[milter]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[smf-spamd]]></category>
		<category><![CDATA[Spam]]></category>

		<guid isPermaLink="false">http://ra23.net/wop/?p=20</guid>
		<description><![CDATA[Ich benutze schon eine ganze Weile die Milter smf-* von Eugene Kurmanin für Sendmail und bin sehr zufrieden damit. Das Programm smf-spamd dient dazu Emails an SpamAssassin weiter zu reichen. Wenn ein bestimmer einstellbarer Grenzwert bei der Überprüfung überschritten wird (in meinem Fall 15 Punkte), wird die Email mit einer Fehlermeldung abgelehnt. Da ich unter [...]]]></description>
			<content:encoded><![CDATA[<p>Ich benutze schon eine ganze Weile die <a href="http://smfs.sourceforge.net/index.html"> Milter smf-*</a> von Eugene Kurmanin<br />
für <a href="http://www.sendmail.org">Sendmail</a> und bin sehr zufrieden damit.<br />
Das Programm smf-spamd dient dazu Emails an <a href="http://spamassassin.apache.org/">SpamAssassin</a> weiter zu reichen.<br />
Wenn ein bestimmer einstellbarer Grenzwert bei der Überprüfung überschritten wird (in meinem Fall 15 Punkte), wird die Email mit einer Fehlermeldung abgelehnt.</p>
<p>Da ich unter anderem Emails von einem Server empfange der keinen Spamfilter verwendet, in dem speziellen Fall ist es eine Weiterleitung, werden auch sämtliche Mails abgelehnt die in diesem Fall über 15 Punkten liegen.<br />
Dies resultiert dann auf dem externen Mailserver in einem Mailer Error der an mich gerichtet ist und die Spam Mail ist im Anhang der Error Mail.</p>
<p>Damit ist natürlich nicht viel gewonnen und bedeutet nur Mehrarbeit.<br />
Eine Möglichkeit wäre den Host in die generelle Whitelist zu packen, dann wird die Mail aber schon beim eigentlichen Connect direkt durchgelassen ohne das eine Prüfung auf Spam erfolgt. </p>
<p>Der hier aufgeführte Patch führt eine zusätzliche Whitelist ein, die dieses Verhalten ändert.<br />
Kommt eine Mail von einem Host dessen IP in der extra Whitelist steht, wird sie vom Server nie abgelehnt, sondern sie durchläuft die Prüfung durch SpamAssassin. Es spielt keine Rolle ob sie als EXTRA SPAM identifiziert wurde, sie wird ganz normal weitergeleitet, jedoch wird wie gewünscht das Subject richtig umgeschrieben und kann somit lokal direkt in den Spamordner geschoben werden.</p>
<p><a href="http://ra23.net/wop/?attachment_id=19">Patch für smf-spamd -&gt; Download</a></p>
<pre name="code" class="diff">
diff -up -r smf-spamd-1.3.1/smf-config.h smf-spamd-1.3.1-modded/smf-config.h
--- smf-spamd-1.3.1/smf-config.h	2007-01-18 15:35:08.000000000 +0100
+++ smf-spamd-1.3.1-modded/smf-config.h	2009-08-08 03:51:05.000000000 +0200
@@ -5,10 +5,13 @@
  */

 /* Hosts/Networks whitelist (extended regex format) */
-#define WHITE_LIST	"(^127\\.|^192\\.168\\.|^10\\.)"
+#define WHITE_LIST     "(^127\\.|^192\\.168\\.|^10\\.)"
+
+/* Hosts/Networks which probably send EXTRA SPAM and should not be blocked*/
+#define WHITE_LIST_EXTRA   "(^1\\.2\\.3\\.)"

 /* Maximal message size */
-#define MAX_SIZE	131072 /* bytes */
+#define MAX_SIZE	5131072 /* bytes */

 /* Probable SPAM e-Mail messages Subject tagging */
 #define TAG_SUBJECT	1 /* set 0 to disable */
diff -up -r smf-spamd-1.3.1/smf-spamd.c smf-spamd-1.3.1-modded/smf-spamd.c
--- smf-spamd-1.3.1/smf-spamd.c	2007-01-18 15:35:08.000000000 +0100
+++ smf-spamd-1.3.1-modded/smf-spamd.c	2009-08-08 02:43:33.000000000 +0200
@@ -91,6 +91,10 @@ int daemon(int nochdir, int noclose) {
 static const char *ignore_connect = WHITE_LIST;
 static regex_t re_ignore_connect;

+static const char *no_ignore_connect = WHITE_LIST_EXTRA;
+static regex_t no_re_ignore_connect;
+
+
 struct context {
     char addr[64];
     char fqdn[MAXLINE];
@@ -470,12 +474,18 @@ static sfsistat smf_eom(SMFICTX *ctx) {
     elapsed = context->tend.tv_sec - context->tstart.tv_sec + (context->tend.tv_usec - context->tstart.tv_usec) / 1.0e6;
     if (ret == 1) {
 	if (context->score >= EXTRA_SPAM) {
+	  // if there is an entry in WHITELIST_EXTRA do not reject the message;
+	  if (no_ignore_connect[0] &#038;& regexec(&#038;no_re_ignore_connect, context->addr, 0, NULL, 0)){
 	    char reject[MAXLINE];

 	    syslog(LOG_NOTICE, "EXTRA SPAM (%.1f/%.1f), %.3fsec, %s, %s -> %s", context->score, context->threshold, elapsed, context->fqdn, context->from, context->rcpt);
 	    snprintf(reject, sizeof(reject), "Sorry, looks like spam. Contact %s to resolve this issue", CONTACT_ADDRESS);
 	    smfi_setreply(ctx, "554", "5.7.1", reject);
 	    return SMFIS_REJECT;
+          }
+          else{
+            syslog(LOG_NOTICE, "EXTRA SPAM WHITELISTED (%.1f/%.1f), %.3fsec, %s, %s -> %s", context->score, context->threshold, elapsed, context->fqdn, context->from, context->rcpt);
+          }
 	}
 	if (REDIRECT_SPAM) {
 	    if (context->rcpts) {
@@ -572,6 +582,7 @@ int main(int argc, char **argv) {
     int ret = 0;

     regcomp(&#038;re_ignore_connect, ignore_connect, REG_EXTENDED|REG_ICASE);
+    regcomp(&#038;no_re_ignore_connect, no_ignore_connect, REG_EXTENDED|REG_ICASE);
     tzset();
     openlog("smf-spamd", LOG_PID|LOG_NDELAY, SYSLOG_FACILITY);
     if (!strncmp(oconn, "unix:", 5))
</pre>
<p>Alles weitere zu smf-spamd kann man auf der Seite des Entwicklers nachschaun.</p>
<p>gruss<br />
Andre</p>
]]></content:encoded>
			<wfw:commentRss>http://ra23.net/wop/2009/08/smf-spamd-ein-wenig-aufgebohrt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

