Re: Spam Filtering

Claudio Nieder <[email protected]>
Newsgroups gmane.mail.qmail.scanner
Message-ID <[email protected]>
Hi,

> >> the mails. Is there a way to let qmailscanner filter out the Spams
> >> as it does with the virus mails?

> JM> You must use the ST patch to qmail-scanner.
> JM> http://toribio.apollinare.org/qmail-scanner/

>Invalid link. :(

Here a simple patch I just made which lets you quarantine all mails above a 
certain adjustable spamassassin score (see sa_quarantine):

diff -Naur qmail-scanner-1.25.orig/qmail-scanner-queue.template 
qmail-scanner-1.25/qmail-scanner-queue.template
--- qmail-scanner-1.25.orig/qmail-scanner-queue.template	2005-01-27 
23:51:58.000000000 +0100
+++ qmail-scanner-1.25/qmail-scanner-queue.template	2006-01-15 
14:05:06.000000000 +0100
@@ -220,6 +220,7 @@
 my $spamc_options='SPAMC_OPTIONS';
 my $spamc_subject='SPAMC_SUBJECT';
 my $spamassassin_binary='SPAMASSASSIN_BINARY';
+my $sa_quarantine=12;
 my ($sa_comment,$sa_level);
 my $sa_symbol='+';
 my ($tag_score)="";
@@ -1242,7 +1243,7 @@
     }
     if (!$quarantine_event) {
       $quarantine_event=$quarantine_event_tmp;
-    } else {
+    } elsif (($destring||'') ne 'spamtext') {
       #Make sure this is set correctly
       $destring="virus";
     }
diff -Naur qmail-scanner-1.25.orig/sub-spamassassin.pl 
qmail-scanner-1.25/sub-spamassassin.pl
--- qmail-scanner-1.25.orig/sub-spamassassin.pl	2004-10-19 02:58:17.000000000 
+0200
+++ qmail-scanner-1.25/sub-spamassassin.pl	2006-01-15 14:04:56.000000000 +0100
@@ -75,6 +75,14 @@
     $sa_comment = "Yes, hits=$sa_score required=$sa_max" if ($sa_fast);
     &debug("SA: yup, this smells like SPAM");
   }	
+  if ($sa_score >= $sa_quarantine) {
+   $quarantine_event="SPAM: Score $sa_score too high to deliver.";
+   $destring='spamtext';
+   $quarantine_description=$sa_comment."\n\n"
+    .'From: '.($headers{'from'}||'-')."\n"
+    .'To: '.($headers{'to'}||'-')."\n"
+    .'Subject: '.($headers{'subject'}||'-');
+  }
   if ($sa_score > 0) {
     $sa_score=int($sa_score);
     #Keep it RFC compliant

It would be nice, if spamassassin would offer a functionality like this 
without needing an extra patch.

claudio
-- 
Claudio Nieder, Kanalweg 1, CH-8610 Uster, Tel +41 79 357 6743
yahoo messenger: claudionieder aim: claudionieder icq:42315212
mailto:[email protected]                http://www.claudio.ch
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQBDyk6VKS3qZW4vY9IRAnynAJ9jAxJqxL7fFWLhXthxdG02ifMhQgCfbpdu
VwDMiPg9W0Ev+UPKE7uQB+A=
=eZm7
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.