Re: greylisting and dnsbl patch

2007-08-23 Thread Matthew Harrell
> There is a much simpler solution to this problem: Put the greylisting
> module *after* the dnsbl module in the plugins file.

It is but it seems like the greylisting module looks up the IP address of
the host during an earlier sequence than the point at which the dnsbl 
returns it's information.  At least the sequence I get in the log messages
even with deny_late turned on shows the greylisting module adding the
entry to the database long before dnsbl returns it's information.  I
currently have greylisting as the last entry right above the queue where
the dnsbl is one of the first entries.

With deny_late turned on it doesn't bother to DENY_SOFT the connection but
it does still update / increment the greylisting DBM entry

-- 
  Matthew Harrell  Any sufficiently advanced bug is
  Bit Twiddlers, Inc.   indistinguishable from a feature.
  [EMAIL PROTECTED] 


Re: greylisting and dnsbl patch

2007-08-23 Thread Peter J. Holzer
On 2007-08-23 10:33:59 -0400, Matthew Harrell wrote:
> This patch changes the deny_late option so the greylisting plugin will
> wait to check and update it's database until later.  The problem I
> noticed was that greylisting was filling up it's database with hosts
> that were later denied by dnsbl.

There is a much simpler solution to this problem: Put the greylisting
module *after* the dnsbl module in the plugins file.

hp

-- 
   _  | Peter J. Holzer| I know I'd be respectful of a pirate 
|_|_) | Sysadmin WSR   | with an emu on his shoulder.
| |   | [EMAIL PROTECTED] |
__/   | http://www.hjp.at/ |-- Sam in "Freefall"


signature.asc
Description: Digital signature


greylisting and dnsbl patch

2007-08-23 Thread Matthew Harrell

This patch changes the deny_late option so the greylisting plugin will wait
to check and update it's database until later.  The problem I noticed was
that greylisting was filling up it's database with hosts that were later
denied by dnsbl.  Similarly if the host is allowed by dns_whitelist_soft
then the greylisting plugin will now ignore it

-- 
  Matthew Harrell  Welcome to All Things Unix,
  Bit Twiddlers, Inc.   where if it's not Unix,
  [EMAIL PROTECTED] it's CRAP!
--- greylisting.bck	2007-08-17 12:28:10.0 -0400
+++ greylisting	2007-08-23 10:00:24.0 -0400
@@ -159,11 +159,17 @@
 
 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) 
+  my $config = $self->{_greylist_config};
+
+  if ( $config->{deny_late} ) {
+$transaction->notes('denysoft_greylist', $sender) 
+
+  } else {
+my ($status, $msg) = $self->denysoft_greylist($transaction, $sender, undef);
+
+if ($status == DENYSOFT) {
+  return DENYSOFT, $msg;
+}
   }
   return DECLINED;
 }
@@ -186,14 +192,20 @@
 
 sub hook_data {
   my ($self, $transaction) = @_;
-  my $note = $transaction->notes('denysoft_greylist');
-  return DECLINED unless $note;
+  my $sender = $transaction->notes('denysoft_greylist');
+  return DECLINED unless $sender;
   # Decline if ALL recipients are whitelisted
   if (($transaction->notes('whitelistrcpt')||0) == scalar($transaction->recipients)) {
 # $self->log(LOGWARN,"all recipients whitelisted - skipping");
 return DECLINED;
   }
-  return DENYSOFT, $note;
+
+  my ($status, $msg) = $self->denysoft_greylist($transaction, $sender, undef);
+
+  if ($status == DENYSOFT) {
+return DENYSOFT, $msg;
+  }
+  return DECLINED;
 }
 
 sub denysoft_greylist {