Reduce non-verbose logging to a single line per message.
This commit is contained in:
parent
2f5a4ff1ba
commit
3156020666
2 changed files with 51 additions and 34 deletions
3
CHANGES
3
CHANGES
|
|
@ -8,6 +8,9 @@
|
||||||
* Chomp erroneus NULLs off the end of local and authority explanations to
|
* Chomp erroneus NULLs off the end of local and authority explanations to
|
||||||
work around a Mail::SPF bug (in Mail::SPF versions prior to 2.008)
|
work around a Mail::SPF bug (in Mail::SPF versions prior to 2.008)
|
||||||
- Patch thanks to Allison Randal
|
- Patch thanks to Allison Randal
|
||||||
|
* Stop logging queue ID since it is virtually never available and clutters
|
||||||
|
the logs
|
||||||
|
* Reduced non-verbose logging to a single line per-message
|
||||||
--- 2.008 (2012-01-19 13:46 -0500)
|
--- 2.008 (2012-01-19 13:46 -0500)
|
||||||
! Query only TXT and not DNS RR Type SPF records to reduce unnecessary DNS
|
! Query only TXT and not DNS RR Type SPF records to reduce unnecessary DNS
|
||||||
lookups (LP: #161133)
|
lookups (LP: #161133)
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ while (<STDIN>) {
|
||||||
for (sort keys %attr) {
|
for (sort keys %attr) {
|
||||||
syslog(debug => "Attribute: %s=%s", $_ || '<UNKNOWN>', $attr{$_} || '<UNKNOWN>');
|
syslog(debug => "Attribute: %s=%s", $_ || '<UNKNOWN>', $attr{$_} || '<UNKNOWN>');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
my $message_instance = $attr{instance};
|
my $message_instance = $attr{instance};
|
||||||
my $cache = defined($message_instance) ? $results_cache{$message_instance} ||= {} : {};
|
my $cache = defined($message_instance) ? $results_cache{$message_instance} ||= {} : {};
|
||||||
|
|
@ -160,11 +160,13 @@ while (<STDIN>) {
|
||||||
|
|
||||||
if ($VERBOSE) {
|
if ($VERBOSE) {
|
||||||
syslog(debug => "handler %s: %s", $handler_name || '<UNKNOWN>', $response || '<UNKNOWN>');
|
syslog(debug => "handler %s: %s", $handler_name || '<UNKNOWN>', $response || '<UNKNOWN>');
|
||||||
}
|
};
|
||||||
|
|
||||||
# Pick whatever response is not 'DUNNO'
|
# Pick whatever response is not 'DUNNO'
|
||||||
if ($response and $response !~ /^DUNNO/i) {
|
if ($response and $response !~ /^DUNNO/i) {
|
||||||
syslog(info => "handler %s: is decisive.", $handler_name || '<UNKNOWN>');
|
if ($VERBOSE) {
|
||||||
|
syslog(info => "handler %s: is decisive.", $handler_name || '<UNKNOWN>');
|
||||||
|
}
|
||||||
$action = $response;
|
$action = $response;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|
@ -238,12 +240,14 @@ sub sender_policy_framework {
|
||||||
# probably due to invalid input data!
|
# probably due to invalid input data!
|
||||||
my $errmsg = $@;
|
my $errmsg = $@;
|
||||||
$errmsg = $errmsg->text if UNIVERSAL::isa($@, 'Mail::SPF::Exception');
|
$errmsg = $errmsg->text if UNIVERSAL::isa($@, 'Mail::SPF::Exception');
|
||||||
syslog(
|
if ($VERBOSE) {
|
||||||
info => "HELO check failed - Mail::SPF->new(%s, %s, %s) failed: %s",
|
syslog(
|
||||||
$attr->{client_address} || '<UNKNOWN>',
|
info => "HELO check failed - Mail::SPF->new(%s, %s, %s) failed: %s",
|
||||||
$attr->{sender} || '<UNKNOWN>', $attr->{helo_name} || '<UNKNOWN>',
|
$attr->{client_address} || '<UNKNOWN>',
|
||||||
$errmsg || '<UNKNOWN>'
|
$attr->{sender} || '<UNKNOWN>', $attr->{helo_name} || '<UNKNOWN>',
|
||||||
);
|
$errmsg || '<UNKNOWN>'
|
||||||
|
);
|
||||||
|
};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -268,27 +272,33 @@ 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(
|
if ($VERBOSE) {
|
||||||
info => "SPF %s: HELO/EHLO: %s",
|
syslog(
|
||||||
$helo_result || '<UNKNOWN>',
|
info => "SPF %s: HELO/EHLO: %s",
|
||||||
$attr->{helo_name} || '<UNKNOWN>'
|
$helo_result || '<UNKNOWN>',
|
||||||
);
|
$attr->{helo_name} || '<UNKNOWN>'
|
||||||
|
);
|
||||||
|
};
|
||||||
return "550 $helo_authority_exp";
|
return "550 $helo_authority_exp";
|
||||||
}
|
}
|
||||||
elsif ($helo_result->is_code('temperror')) {
|
elsif ($helo_result->is_code('temperror')) {
|
||||||
syslog(
|
if ($VERBOSE) {
|
||||||
info => "SPF %s: HELO/EHLO: %s",
|
syslog(
|
||||||
$helo_result || '<UNKNOWN>',
|
info => "SPF %s: HELO/EHLO: %s",
|
||||||
$attr->{helo_name} || '<UNKNOWN>'
|
$helo_result || '<UNKNOWN>',
|
||||||
);
|
$attr->{helo_name} || '<UNKNOWN>'
|
||||||
|
);
|
||||||
|
};
|
||||||
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(
|
if ($VERBOSE) {
|
||||||
info => "SPF %s: HELO/EHLO (Null Sender): %s",
|
syslog(
|
||||||
$helo_result || '<UNKNOWN>',
|
info => "SPF %s: HELO/EHLO (Null Sender): %s",
|
||||||
$attr->{helo_name} || '<UNKNOWN>'
|
$helo_result || '<UNKNOWN>',
|
||||||
);
|
$attr->{helo_name} || '<UNKNOWN>'
|
||||||
|
);
|
||||||
|
};
|
||||||
return "PREPEND $helo_spf_header"
|
return "PREPEND $helo_spf_header"
|
||||||
unless $cache->{added_spf_header}++;
|
unless $cache->{added_spf_header}++;
|
||||||
}
|
}
|
||||||
|
|
@ -316,11 +326,13 @@ sub sender_policy_framework {
|
||||||
# probably due to invalid input data!
|
# probably due to invalid input data!
|
||||||
my $errmsg = $@;
|
my $errmsg = $@;
|
||||||
$errmsg = $errmsg->text if UNIVERSAL::isa($@, 'Mail::SPF::Exception');
|
$errmsg = $errmsg->text if UNIVERSAL::isa($@, 'Mail::SPF::Exception');
|
||||||
syslog(
|
if ($VERBOSE) {
|
||||||
info => "Mail From (sender) check failed - Mail::SPF->new(%s, %s, %s) failed: %s",
|
syslog(
|
||||||
$attr->{client_address} || '<UNKNOWN>',
|
info => "Mail From (sender) check failed - Mail::SPF->new(%s, %s, %s) failed: %s",
|
||||||
$attr->{sender} || '<UNKNOWN>', $attr->{helo_name} || '<UNKNOWN>', $errmsg || '<UNKNOWN>'
|
$attr->{client_address} || '<UNKNOWN>',
|
||||||
);
|
$attr->{sender} || '<UNKNOWN>', $attr->{helo_name} || '<UNKNOWN>', $errmsg || '<UNKNOWN>'
|
||||||
|
);
|
||||||
|
};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -343,11 +355,13 @@ sub sender_policy_framework {
|
||||||
};
|
};
|
||||||
|
|
||||||
# Same approach as HELO....
|
# Same approach as HELO....
|
||||||
syslog(
|
if ($VERBOSE) {
|
||||||
info => "SPF %s: Envelope-from: %s",
|
syslog(
|
||||||
$mfrom_result || '<UNKNOWN>',
|
info => "SPF %s: Envelope-from: %s",
|
||||||
$attr->{sender} || '<UNKNOWN>'
|
$mfrom_result || '<UNKNOWN>',
|
||||||
);
|
$attr->{sender} || '<UNKNOWN>'
|
||||||
|
);
|
||||||
|
};
|
||||||
if ($mfrom_result->is_code('fail')) {
|
if ($mfrom_result->is_code('fail')) {
|
||||||
return "550 $mfrom_authority_exp";
|
return "550 $mfrom_authority_exp";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue