Recently I posted a question about getting qmailqueue to send mail through a virus scanner and a spam scanner. I found a patch that will do just that, so I thought I'd share it here since there has been a lot of virus talk lately.
I am running Sophos Sweep. They have a pretty good deal for ISPs. I think for us it worked out to about $.20 per month. We are more than willing to pay that for the extra service. The auto updates work well. The spam scanner I am using is SpamAssassin found at spamassassin.taint.org. It is very agressive, and we have had a few legitimate emails get blocked, but it is VERY effective on spam. Since Procmail doesn't seem to work well with Vpopmail, we decided to use QMAILQUEUE to run everything through the scanners. This works, but does have the disadvantage that filters are not customizable per user. Here is the patch we used to get it to run the two scanners...it was written by a guy named Kobe Lenjou and posted to the Spamassassin list. Maybe it will be useful to some of you. Trey *** qmail-scanner-1.01/qmail-scanner-queue.template Thu Sep 6 23:12:20 2001 --- qmail-scanner-1.01-pattched/qmail-scanner-queue.template_with_spam Wed Nov 21 15:58:32 2001 *************** *** 155,160 **** --- 155,168 ---- my $uudecode_binary='UUDECODE_BINARY'; my $uudecode_pipe='UUDECODE_PIPE'; + #Kobe SpamAssasin Hack - if $spamcheck is 1 then spamcheck is done + my $spamcheck = 1; #Enabled + #my $spamcheck = 0; #Disabled + my $spamc='/var/qmail/tools/spamc -f '; + #These strings will be regexpd against the recieps var + my $spam_rec = '<EMAIL: PROTECTED>, <EMAIL: PROTECTED>, publinet.be,moerman.co m'; + #End of part 1 of 2 of the SpamAssasin hack + #my ($uvscan_binary,$sweep_binary=$iscan_binary=$hbedv_binary=$avpdaemon_binar y)='; #my ($avp_binary=$fsecure_binary=$inocucmd_binary)='; *************** *** 325,331 **** &email_quarantine_report; } else { &qmail_smtpd_check; ! &qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file_id" ); } alarm 0; }; --- 333,364 ---- &email_quarantine_report; } else { &qmail_smtpd_check; ! #Mail passed all virus check, now do a spam check ! if ($spamcheck == 1) { ! my @spamusers = split(',',$spam_rec); ! my $spam_var; ! my $spam_flag = 0; ! foreach $spam_var (@spamusers) { ! $spam_var =~ s/ //mgi; ! debug("Spamuser: -".$spam_var."-"); ! my $spamaddr = ($recips =~ /.*($spam_var).*/mi); ! debug("Find?: $spamaddr"); ! if ($spamaddr == 1) { ! $spam_flag = 1; ! last; ! } ! } ! &debug("Recieps: $recips"); ! if ($spam_flag == 1) { ! &debug("Now checking message for spam"); ! &debug("Executing: $spamc < $scandir/$wmaildir/new/$file_id > $scandir/$wmaildir/tmp/$file_id"); ! system ("$spamc < $scandir/$wmaildir/new/$file_id > $scandir/$ wmaildir/tmp/$file_id"); ! rename ("$scandir/$wmaildir/tmp/$file_id","$scandir/$wmaildir/ new/$file_id"); ! } else { ! &debug("Message NOT scanned for spam"); ! } ! } ! &qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file_id" ) ; } alarm 0; };