Add more logging and correct test case.
This commit is contained in:
parent
bb35819cd5
commit
2fddc34a57
2 changed files with 20 additions and 4 deletions
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
# postfix-policyd-spf-perl
|
# postfix-policyd-spf-perl
|
||||||
# http://www.openspf.org/Software
|
# http://www.openspf.org/Software
|
||||||
# version 2.005
|
# version 2.006
|
||||||
#
|
#
|
||||||
# (C) 2007 Scott Kitterman <scott@kitterman.com>
|
# (C) 2007-2008 Scott Kitterman <scott@kitterman.com>
|
||||||
# (C) 2007 Julian Mehnle <julian@mehnle.net>
|
# (C) 2007 Julian Mehnle <julian@mehnle.net>
|
||||||
# (C) 2003-2004 Meng Weng Wong <mengwong@pobox.com>
|
# (C) 2003-2004 Meng Weng Wong <mengwong@pobox.com>
|
||||||
#
|
#
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
use version; our $VERSION = qv('2.005');
|
use version; our $VERSION = qv('2.006');
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
|
@ -259,12 +259,24 @@ sub sender_policy_framework {
|
||||||
# Reject on HELO fail. Defer on HELO temperror if message would otherwise
|
# Reject on HELO fail. Defer on HELO temperror if message would otherwise
|
||||||
# be accepted. Use the HELO result and return for null sender.
|
# be accepted. Use the HELO result and return for null sender.
|
||||||
if ($helo_result->is_code('fail')) {
|
if ($helo_result->is_code('fail')) {
|
||||||
|
syslog(
|
||||||
|
info => "%s: SPF %s: HELO/EHLO: %s",
|
||||||
|
$attr->{queue_id}, $helo_result, $attr->{helo_name}
|
||||||
|
);
|
||||||
return "550 $helo_authority_exp";
|
return "550 $helo_authority_exp";
|
||||||
}
|
}
|
||||||
elsif ($helo_result->is_code('temperror')) {
|
elsif ($helo_result->is_code('temperror')) {
|
||||||
|
syslog(
|
||||||
|
info => "%s: SPF %s: HELO/EHLO: %s",
|
||||||
|
$attr->{queue_id}, $helo_result, $attr->{helo_name}
|
||||||
|
);
|
||||||
return "DEFER_IF_PERMIT SPF-Result=$helo_local_exp";
|
return "DEFER_IF_PERMIT SPF-Result=$helo_local_exp";
|
||||||
}
|
}
|
||||||
elsif ($attr->{sender} eq '') {
|
elsif ($attr->{sender} eq '') {
|
||||||
|
syslog(
|
||||||
|
info => "%s: SPF %s: HELO/EHLO (Null Sender): %s",
|
||||||
|
$attr->{queue_id}, $helo_result, $attr->{helo_name}
|
||||||
|
);
|
||||||
return "PREPEND $helo_spf_header"
|
return "PREPEND $helo_spf_header"
|
||||||
unless $cache->{added_spf_header}++;
|
unless $cache->{added_spf_header}++;
|
||||||
}
|
}
|
||||||
|
|
@ -317,6 +329,10 @@ sub sender_policy_framework {
|
||||||
};
|
};
|
||||||
|
|
||||||
# Same approach as HELO....
|
# Same approach as HELO....
|
||||||
|
syslog(
|
||||||
|
info => "%s: SPF %s: Envelope-from: %s",
|
||||||
|
$attr->{queue_id}, $mfrom_result, $attr->{sender}
|
||||||
|
);
|
||||||
if ($mfrom_result->is_code('fail')) {
|
if ($mfrom_result->is_code('fail')) {
|
||||||
return "550 $mfrom_authority_exp";
|
return "550 $mfrom_authority_exp";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ recipient=bogus@kitterman.org
|
||||||
queue_id=q1234
|
queue_id=q1234
|
||||||
instance=3
|
instance=3
|
||||||
|
|
||||||
#helo pass and mfrom fail
|
#helo pass and mfrom pass
|
||||||
request=smtpd_access_policy
|
request=smtpd_access_policy
|
||||||
client_address=72.81.252.19
|
client_address=72.81.252.19
|
||||||
helo_name=mailout00.controlledmail.com
|
helo_name=mailout00.controlledmail.com
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue