[ top-posted as the rest is code which was not posted to the list ]

Mark.

A couple of questions.

If you look at 'perldoc greylisting' you should find:

       deny_late <bool>
           Whether to defer denials during the 'mail' hook until 'data_post'
           e.g. to allow per-recipient logging. Default: 0.

You do not have 'deny_late=1' in your configuration.  I think that you
may need this to make your code work but I am not sure.

However if you *do* set it then you can drop the grey-listing in
'mail_handler' rather than in 'hook_data' ... but, as far as I can tell,
you can't log that you've accepted it.

Also, you've commented out some code in 'hook_data' and I'm not sure why
you've done that.

I'm going to put this back on the list since Matt will be able to
correct any mistakes here.

I think you can just use:
        $transaction->notes('denysoft_greylist', $msg)
                unless $sender =~ /\.nz>$/
instead of:
        $transaction->notes('denysoft_greylist', $msg)
in 'mail_handler' but if you do this, you won't be able to log the
connections (I think).

--gh

P.S. Mark's configuration and code sent to me privately.

On Thu, 2007-22-02 at 13:50 +1300, Mark Signal wrote:
> opps... here goes
> 
> thanks Mark
> 
> greylisting plugin: config: 
> black_timeout=60,grey_timeout=12000,mode=denysoft,recipient=0,remote_ip=1,sender=0,white_timeout=3110400
<snip>
> sub mail_handler {
>    my ($self, $transaction, $sender) = @_;
>    my ($status, $msg) = $self->denysoft_greylist($transaction, $sender, 
> undef);
>    if ($status == DENYSOFT) {
>      my $config = $self->{_greylist_config};
>      return DENYSOFT, $msg unless $config->{deny_late};
>      $transaction->notes('denysoft_greylist', $msg)
>    }
>    return DECLINED;
> }
<snip>
> sub hook_data {
>    my ($self, $transaction) = @_;
>    my $note = $transaction->notes('denysoft_greylist');
>    return DECLINED unless $note;
>    # Decline if ALL recipients are whitelisted
>    #if (($transaction->notes('whitelistrcpt')||0) == 
> scalar($transaction->recipients)) {
>    #  $self->log(LOGWARN,"all recipients whitelisted - skipping");
>    #  return DECLINED;
>    #}
>    if ($transaction->sender->format =~ /\.nz>$/i) {
>       $self->log(LOGINFO, "Sender from NZ - skipping");
>       return DECLINED;
>    }
>    return DENYSOFT, $note;
> }

<snip>



Reply via email to