El día Tuesday, November 24, 2015 a las 08:27:45PM +0100, Edda escribió:

> Anyway, for the moment, here's the patch, diff is on version 3.4.1:
> 
> Rule (I tested it as a simple rule in local.cf, sure one can combine it 
> with RDNS_NONE):
> 
> ifplugin Mail::SpamAssassin::Plugin::DNSEval
> 
> header NO_RDNS_FOR_LAST_EXTERNAL          eval:check_dns_rdns()
> describe NO_RDNS_FOR_LAST_EXTERNAL        Last External really has no rdns
> tflags NO_RDNS_FOR_LAST_EXTERNAL          net
> score NO_RDNS_FOR_LAST_EXTERNAL              1.00
> 
> endif
> 
> pop:Mail eh$ diff -u SpamAssassin/Plugin/DNSEval.pm.ORG 
> SpamAssassin/Plugin/DNSEval.pm
> --- SpamAssassin/Plugin/DNSEval.pm.ORG    2015-11-24 19:02:58.000000000 
> +0100
> +++ SpamAssassin/Plugin/DNSEval.pm    2015-11-24 19:25:59.000000000 +0100
> @@ -58,6 +58,7 @@
>       'check_rbl_from_host',
>       'check_rbl_from_domain',
>       'check_rbl_envfrom',
> +    'check_dsn_rdns',
>       'check_dns_sender',
>     ];
> 
> @@ -373,6 +374,25 @@
>     }
>   }
> 
> +sub check_dns_rdns {
> +  my ($self, $pms, $rule) = @_;
> +
> +  my $lasthop = $pms->{relays_external}->[0];
> +  return 0 unless defined $lasthop;
> +
> +  # Perform reverse lookup only, if empty and mta is known to not 
> always insert rdns
> +  return 0 unless (! $lasthop->{rdns} && $lasthop->{rdns_not_in_headers});
> +
> +  return 0 unless $pms->is_dns_available();
> +  $pms->load_resolver();
> +
> +  dbg("dns: checking rDNS for last external ip $lasthop->{ip}");
> +
> +  $pms->do_dns_lookup($rule, 'PTR', $lasthop->{ip});
> +
> +  return 0;
> +}
> +
>   sub check_dns_sender {
>     my ($self, $pms, $rule) = @_;
> 
> 
> pop:Mail eh$ diff -u SpamAssassin/Dns.pm.ORG SpamAssassin/Dns.pm
> --- SpamAssassin/Dns.pm.ORG    2015-11-24 19:01:59.000000000 +0100
> +++ SpamAssassin/Dns.pm    2015-11-24 19:02:39.000000000 +0100
> @@ -257,6 +257,12 @@
>       for my $rule (@{$rules}) {
>         $self->got_hit($rule, "DNS: ", ruletype => "dns");
>       }
> +  } elsif ($question->qtype =~ /^(PTR)$/ &&
> +      $packet->header->rcode =~ /^(?:NXDOMAIN|SERVFAIL)$/)
> +  {
> +    for my $ptr_rule (@{$rules}) {
> +      $self->got_hit($ptr_rule, "DNS: ", ruletype => "dns");
> +    }
>     }
> 
>     # DNSBL tests are here


Hello,

I have applied your patch by hand (had to change $packet->... by $pkt-> ...)
but it gives the following warning when I run it through -tD:

nov 25 08:12:51.207 [2017] warn: rules: failed to run NO_RDNS_FOR_LAST_EXTERNAL 
RBL test, skipping:
nov 25 08:12:51.207 [2017] warn:  (Can't locate object method "check_dns_rdns" 
via package "Mail: [...]:SpamAssassin::PerMsgStatus" at 
/usr/local/lib/perl5/site_perl/5.16/Mail/SpamAssassin/Plugin/Check.pm line 271.)

Why I do miss?

Thanks

        matthias


-- 
Matthias Apitz, ✉ g...@unixarea.de, 🌐 http://www.unixarea.de/  ☎ 
+49-176-38902045

Reply via email to