From 7a4c789ae2e0f73fac70b2c44673b419bb83df92 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Sat, 23 Mar 2013 01:43:32 -0400 Subject: [PATCH] helo: smite senders that fail the selected tests and made log entries more terse --- plugins/helo | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/helo b/plugins/helo index aace329..203f29b 100644 --- a/plugins/helo +++ b/plugins/helo @@ -256,7 +256,10 @@ sub helo_handler { foreach my $test ( @{ $self->{_helo_tests} } ) { my @err = $self->$test( $host ); - return $self->get_reject( @err ) if scalar @err; + if ( scalar @err ) { + $self->adjust_karma( -1 ); + return $self->get_reject( @err ); + }; }; $self->log(LOGINFO, "pass"); @@ -389,6 +392,8 @@ sub is_not_fqdn { sub no_forward_dns { my ( $self, $host ) = @_; + return if $self->is_address_literal( $host ); + my $res = $self->init_resolver(); $host = "$host." if $host !~ /\.$/; # fully qualify name @@ -396,7 +401,7 @@ sub no_forward_dns { if (! $query) { if ( $res->errorstring eq 'NXDOMAIN' ) { - return ("HELO hostname does not exist", "HELO hostname does not exist"); + return ("HELO hostname does not exist", "no such host"); } $self->log(LOGERROR, "skip, query failed (", $res->errorstring, ")" ); return; @@ -411,7 +416,7 @@ sub no_forward_dns { $self->log(LOGDEBUG, "pass, forward DNS") if $hits; return; }; - return ("helo hostname did not resolve", "fail, HELO forward DNS"); + return ("HELO hostname did not resolve", "no forward DNS"); }; sub no_reverse_dns { @@ -451,7 +456,7 @@ sub no_matching_dns { if ( $self->connection->notes('helo_forward_match') && $self->connection->notes('helo_reverse_match') ) { $self->log( LOGDEBUG, "foward and reverse match" ); - $self->adjust_karma( 1 ); # whoppee, a match! + $self->adjust_karma( 1 ); # a perfect match return; }; @@ -465,7 +470,7 @@ sub no_matching_dns { }; $self->log( LOGINFO, "fail, no forward or reverse DNS match" ); - return ("That HELO hostname fails forward and reverse DNS checks", "no matching DNS"); + return ("That HELO hostname fails FCrDNS", "no matching DNS"); }; sub check_ip_match {