! Changed non-standard X-Comment header fields for localhost and

whitelisted addresses to use RFC 5451 Authentication Results header
      fields
    ! Added depenency on Sys::Hostname::Long for local hostname determination
This commit is contained in:
Scott Kitterman 2012-06-17 23:49:11 -04:00
commit 8c2ec2083f
3 changed files with 13 additions and 3 deletions

View file

@ -7,6 +7,10 @@
--- 2.010 2012-06-17
* Fixed incorrect use of != instead of ne for string comparison
(LP: #1014243)
! Changed non-standard X-Comment header fields for localhost and
whitelisted addresses to use RFC 5451 Authentication Results header
fields
! Added depenency on Sys::Hostname::Long for local hostname determination
--- 2.009 2012-02-03
* Chomp erroneus NULLs off the end of local and authority explanations to

View file

@ -7,7 +7,8 @@ postfix-policyd-spf-perl:
Perl 5.6
version
NetAddr-IP 4
Mail-SPF (not Mail-SPF-Query) version 2.006 or later
Mail::SPF (not Mail-SPF-Query) version 2.006 or later
Sys::Hostname::Long
Installing
----------

View file

@ -31,6 +31,7 @@ use IO::Handle;
use Sys::Syslog qw(:DEFAULT setlogsock);
use NetAddr::IP;
use Mail::SPF;
use Sys::Hostname::Long 'hostname_long';
# ----------------------------------------------------------
# configuration
@ -92,6 +93,10 @@ use constant relay_addresses => map(
qw( )
); # add addresses to qw ( ) above separated by spaces using CIDR notation.
# Fully qualified hostname, if available, for use in authentication results
# headers now provided by the localhost and whitelist checks.
my $host = hostname_long;
my %results_cache; # by message instance
# ----------------------------------------------------------
@ -187,7 +192,7 @@ sub exempt_localhost {
my $attr = $options{attr};
if ($attr->{client_address} ne '') {
my $client_address = NetAddr::IP->new($attr->{client_address});
return 'PREPEND X-Comment: SPF not applicable to localhost connection - skipped check'
return "PREPEND Authentication-Results: $host; none (SPF not checked for localhost)"
if grep($_->contains($client_address), localhost_addresses);
};
return 'DUNNO';
@ -202,7 +207,7 @@ sub exempt_relay {
my $attr = $options{attr};
if ($attr->{client_address} ne '') {
my $client_address = NetAddr::IP->new($attr->{client_address});
return 'PREPEND X-Comment: SPF skipped for whitelisted relay'
return "PREPEND Authentication-Results: $host; none (SPF not checked for whitelisted relay)"
if grep($_->contains($client_address), relay_addresses);
};
return 'DUNNO';