spamassassin-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc MERLIN <>
Subject greylisting plugin for SA 3.0
Date Sun, 14 Nov 2004 05:03:27 GMT
Hi folks,

So, I'm porting my SA-Exim SA patch to a SA plugin for SA 3.0

For SA 2.6, I had written this:

The key part is that my rule is an SA rule, but it has to be run last
since it uses the current SA score to decide whether it should greylist
the incoming tuplet
(details here: )

If I use a regular plugin rule, I don't control when it gets run, and it
gets run too early.
So, I tried to make use of check_end, to guarantee that I was running
last, or close to last, but at that point, I'm not quite sure how I can
fake the GREYLIST_ISWHITE rule having been successful after the fact

I'm calling my rule this way:
loadplugin Greylisting /usr/share/perl5/Mail/SpamAssassin/Plugin/
header GREYLIST_ISWHITE eval:greylisting("( 'dir' => '/var/spool/sa-exim/tuplets'; 'method'
=> 'dir'; 'greylistsecs' => '1800'; 'dontgreylistthreshold' => 11; 'connectiphdr'
=> 'X-SA-Exim-Connect-IP'; 'envfromhdr' => 'X-SA-Exim-Mail-From'; 'rcpttohdr' =>
'X-SA-Exim-Rcpt-To'; 'greylistnullfrom' => 1; 'greylistfourthbyte' => 0 )")
describe GREYLIST_ISWHITE The incoming server has been whitelisted for this receipient and

and my plugin's rule only does this:
# Greylisting happens depending on the SA score, so we want to run it last,
# which is why we have it in the check_end plugin chain
sub greylisting 
    my ($self, $permsgstatus, $optionhash) = @_;

    $optionhash  =~ s/;/,/g;
    # This is safe, right? (users shouldn't be able to set it in their config)
    $_=eval $optionhash;

    Mail::SpamAssassin::Plugin::dbg("GREYLISTING: called function");

    return 0;

I was hoping to then run the actual code in check_end, but that doesn't
quite work since I don't know how to make the GREYLIST_ISWHITE rule
succeed after the fact.
At that point, however, I ought to be able to get the current SA score,
which is what I want.


I'm attaching my current plugin (the code isn't that long), which hopefully
will help in getting help.

"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems & security ....
                                      .... what McDonalds is to gourmet cooking
Home page:   |   Finger for PGP key

View raw message