Logging and other code cleanup.
This commit is contained in:
parent
1af44573f7
commit
305b57ec14
2 changed files with 19 additions and 12 deletions
|
|
@ -87,10 +87,10 @@ openlog($syslog_ident, $syslog_options, $syslog_facility);
|
|||
#
|
||||
# Receive a bunch of attributes, evaluate the policy, send the result.
|
||||
#
|
||||
my %attr;
|
||||
while (<STDIN>) {
|
||||
chomp;
|
||||
|
||||
my %attr;
|
||||
if (/=/) {
|
||||
my ($key, $value) =split (/=/, $_, 2);
|
||||
$attr{$key} = $value;
|
||||
|
|
@ -124,9 +124,10 @@ while (<STDIN>) {
|
|||
}
|
||||
}
|
||||
|
||||
syslog(info => "Policy action=%s", $action);
|
||||
|
||||
syslog(info => "%s: Policy action=%s", $attr{queue_id}, $action);
|
||||
|
||||
STDOUT->print("action=$action\n\n");
|
||||
%attr = ();
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------
|
||||
|
|
@ -164,11 +165,13 @@ sub sender_policy_framework {
|
|||
my $helo_authority_exp = $helo_result->authority_explanation
|
||||
if $helo_result->is_code('fail');
|
||||
my $helo_spf_header = $helo_result->received_spf_header;
|
||||
|
||||
syslog(
|
||||
info => "%s: SPF %s: HELO/EHLO: %s, IP Address: %s, Recipient: %s",
|
||||
$attr->{queue_id}, $helo_result, $attr->{helo_name}, $attr->{client_address}, $attr->{recipient}
|
||||
);
|
||||
if ($VERBOSE) {
|
||||
syslog(
|
||||
info => "%s: SPF %s: HELO/EHLO: %s, IP Address: %s, Recipient: %s",
|
||||
$attr->{queue_id}, $helo_result, $attr->{helo_name}, $attr->{client_address},
|
||||
$attr->{recipient}
|
||||
);
|
||||
};
|
||||
|
||||
# Reject on HELO fail. Defer on HELO temperror if message would otherwise
|
||||
# be accepted. Use the HELO result and return for null sender.
|
||||
|
|
@ -211,10 +214,13 @@ sub sender_policy_framework {
|
|||
if $mfrom_result->is_code('fail');
|
||||
my $mfrom_spf_header = $mfrom_result->received_spf_header;
|
||||
|
||||
syslog(
|
||||
info => "%s: SPF %s: Envelope-from: %s, IP Address: %s, Recipient: %s",
|
||||
$attr->{queue_id}, $mfrom_result, $attr->{sender}, $attr->{client_address}, $attr->{recipient}
|
||||
);
|
||||
if ($VERBOSE) {
|
||||
syslog(
|
||||
info => "%s: SPF %s: Envelope-from: %s, IP Address: %s, Recipient: %s",
|
||||
$attr->{queue_id}, $mfrom_result, $attr->{sender}, $attr->{client_address},
|
||||
$attr->{recipient}
|
||||
);
|
||||
};
|
||||
|
||||
# Same approach as HELO....
|
||||
if ($mfrom_result->is_code('fail')) {
|
||||
|
|
|
|||
|
|
@ -53,3 +53,4 @@ helo_name=mailout02.controlledmail.com
|
|||
sender=
|
||||
recipient=bogus@kitterman.org
|
||||
queue_id=q1234
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue