New version of bogofilter-milter.pl

Tom Anderson tanderso at oac-design.com
Fri Jul 27 04:27:18 CEST 2007


I've made some changes to bogofilter-milter.pl to remedy a few problems 
I was having, one being that it wasn't writing to my syslog... I fixed 
that one.  Another being that the rejection message wasn't working and 
still isn't.  Instead of the given setreply, it returns "554 5.7.1 
Command rejected".  I still can't figure that one out after reading the 
Sendmail::Milter docs several times.  Anyway here's my patch thus far:

70a71,73
 > # The syslog facility to which to log messages -- see syslog(3) docs
 > my $facility = 'LOG_MAIL';
 >
142a146,153
 > # Rejection options
 > my $rcode = "550"; # three-digit RFC 821 SMTP reply
 > my $xcode = "5.7.1"; # extended RFC 2034 reply code
 > my $message = "This message has been classified as spam.\n" .
 >             "If it is not spam, please try rewording your message " .
 >             "and sending it again.  Otherwise, please contact " .
 >             "recipient via phone, snail mail, IM, or another means.";
 >
196c207
< openlog($whoami, 'pid', 'mail');
---
 > openlog($whoami, 'pid', $facility);
489,491c500
<           $ctx->setreply(550, "5.7.1", "Your message looks like spam.\n" .
<                          "If it isn't, resend it with $magic_string " .
<                          "in the Subject line.");
---
 >           $ctx->setreply($rcode, $xcode, $message);

Also, in case anyone is interested, I created a Gentoo start/stop script:

#!/sbin/runscript

depend() {
         need net
         use logger
}

start() {
         ebegin "Starting bogofilter-milter"

         if [ -f /var/run/bogofilter-milter.pid ]; then
                 rm -f /var/run/bogofilter-milter.pid
         fi

         if [ -S /var/run/bogofilter-milter.sock ]; then
                 rm -f /var/run/bogofilter-milter.sock
         fi

         start-stop-daemon --start --quiet --pidfile 
/var/run/bogofilter-milter.pid --exec /usr/sbin/bogofilter-milter.pl -- 
--daemon
         eend $? "Failed to start bogofilter-milter"
}

stop() {
         ebegin "Stopping bogofilter-milter"
         start-stop-daemon --stop --quiet --pidfile 
/var/run/bogofilter-milter.pid
         eend $? "Failed to stop bogofilter-milter"
}

Tom


Tom Anderson wrote:
> I've been meaning to try this out for awhile now, so I've finally 
> decided to give it a go.  So far, everything appears to be working as 
> expected.  I just have two questions/requests... 1) is it possible to 
> use a different bogofilter.cf file than the default for the milter. 
> What I'm thinking is to reject email with a spamicity > X at the milter, 
> but permit the rest through to be classified and trained at the MTA 
> level and double-checked for false positives.  But anything more than 
> say 0.95 would just be rejected wholesale and I wouldn't care about it. 
>   And 2) it is possible to tweak the response returned to the sender? 
> It would be nice to supply an explanation for why the mail is being 
> rejected and how to get around it (ie. try rewording the email or try 
> calling by phone).
> 
> Tom
> 
> 
> Jonathan Kamens wrote:
>> I've just submitted a new version of bogofilter-milter.pl to the 
>> bogofilter maintainers to be included in the next release.  I've 
>> attached it here as well, in case anyone needs the features I've added 
>> now.  The current version is always linked off of my home page, 
>> http://stuff.mit.edu/~jik/ <http://stuff.mit.edu/%7Ejik/>.  On a related 
>> note, there's also a neat graph at the bottom of my home page showing 
>> the number of spam messages that bogofilter blocks from my inbox per day 
>> vs. how many it lets through.
>>
>> The new features in the new version of bogofilter-milter.pl are:
>>
>>    * Support archival of spam messages in Cyrus IMAP mailboxes in
>>      addition to the mbox files that were previously supported.
>>    * Support address canonicalization using sendmail (useful for sites
>>      that have a sendmail virtusertable).
>>    * Support expiration of old entries in the cache of expanded addresses.
>>
>> These new features are explained in the comments in the configuration 
>> section at the top of the script.
>>
>> Please feel free to contact me if you have any questions.
>>
>> Enjoy!
>>
>>  jik
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Bogofilter mailing list
>> Bogofilter at bogofilter.org
>> http://www.bogofilter.org/mailman/listinfo/bogofilter
> 
> _______________________________________________
> Bogofilter mailing list
> Bogofilter at bogofilter.org
> http://www.bogofilter.org/mailman/listinfo/bogofilter
> 
> 




More information about the Bogofilter mailing list