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
|
||||
work around a Mail::SPF bug (in Mail::SPF versions prior to 2.008)
|
||||
- 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)
|
||||
! Query only TXT and not DNS RR Type SPF records to reduce unnecessary DNS
|
||||
lookups (LP: #161133)
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ while (<STDIN>) {
|
|||
for (sort keys %attr) {
|
||||
syslog(debug => "Attribute: %s=%s", $_ || '<UNKNOWN>', $attr{$_} || '<UNKNOWN>');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
my $message_instance = $attr{instance};
|
||||
my $cache = defined($message_instance) ? $results_cache{$message_instance} ||= {} : {};
|
||||
|
|
@ -160,11 +160,13 @@ while (<STDIN>) {
|
|||
|
||||
if ($VERBOSE) {
|
||||
syslog(debug => "handler %s: %s", $handler_name || '<UNKNOWN>', $response || '<UNKNOWN>');
|
||||
}
|
||||
};
|
||||
|
||||
# Pick whatever response is not 'DUNNO'
|
||||
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;
|
||||
last;
|
||||
}
|
||||
|
|
@ -238,12 +240,14 @@ sub sender_policy_framework {
|
|||
# probably due to invalid input data!
|
||||
my $errmsg = $@;
|
||||
$errmsg = $errmsg->text if UNIVERSAL::isa($@, 'Mail::SPF::Exception');
|
||||
syslog(
|
||||
info => "HELO check failed - Mail::SPF->new(%s, %s, %s) failed: %s",
|
||||
$attr->{client_address} || '<UNKNOWN>',
|
||||
$attr->{sender} || '<UNKNOWN>', $attr->{helo_name} || '<UNKNOWN>',
|
||||
$errmsg || '<UNKNOWN>'
|
||||
);
|
||||
if ($VERBOSE) {
|
||||
syslog(
|
||||
info => "HELO check failed - Mail::SPF->new(%s, %s, %s) failed: %s",
|
||||
$attr->{client_address} || '<UNKNOWN>',
|
||||
$attr->{sender} || '<UNKNOWN>', $attr->{helo_name} || '<UNKNOWN>',
|
||||
$errmsg || '<UNKNOWN>'
|
||||
);
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -268,27 +272,33 @@ sub sender_policy_framework {
|
|||
# Reject on HELO fail. Defer on HELO temperror if message would otherwise
|
||||
# be accepted. Use the HELO result and return for null sender.
|
||||
if ($helo_result->is_code('fail')) {
|
||||
syslog(
|
||||
info => "SPF %s: HELO/EHLO: %s",
|
||||
$helo_result || '<UNKNOWN>',
|
||||
$attr->{helo_name} || '<UNKNOWN>'
|
||||
);
|
||||
if ($VERBOSE) {
|
||||
syslog(
|
||||
info => "SPF %s: HELO/EHLO: %s",
|
||||
$helo_result || '<UNKNOWN>',
|
||||
$attr->{helo_name} || '<UNKNOWN>'
|
||||
);
|
||||
};
|
||||
return "550 $helo_authority_exp";
|
||||
}
|
||||
elsif ($helo_result->is_code('temperror')) {
|
||||
syslog(
|
||||
info => "SPF %s: HELO/EHLO: %s",
|
||||
$helo_result || '<UNKNOWN>',
|
||||
$attr->{helo_name} || '<UNKNOWN>'
|
||||
);
|
||||
if ($VERBOSE) {
|
||||
syslog(
|
||||
info => "SPF %s: HELO/EHLO: %s",
|
||||
$helo_result || '<UNKNOWN>',
|
||||
$attr->{helo_name} || '<UNKNOWN>'
|
||||
);
|
||||
};
|
||||
return "DEFER_IF_PERMIT SPF-Result=$helo_local_exp";
|
||||
}
|
||||
elsif ($attr->{sender} eq '') {
|
||||
syslog(
|
||||
info => "SPF %s: HELO/EHLO (Null Sender): %s",
|
||||
$helo_result || '<UNKNOWN>',
|
||||
$attr->{helo_name} || '<UNKNOWN>'
|
||||
);
|
||||
if ($VERBOSE) {
|
||||
syslog(
|
||||
info => "SPF %s: HELO/EHLO (Null Sender): %s",
|
||||
$helo_result || '<UNKNOWN>',
|
||||
$attr->{helo_name} || '<UNKNOWN>'
|
||||
);
|
||||
};
|
||||
return "PREPEND $helo_spf_header"
|
||||
unless $cache->{added_spf_header}++;
|
||||
}
|
||||
|
|
@ -316,11 +326,13 @@ sub sender_policy_framework {
|
|||
# probably due to invalid input data!
|
||||
my $errmsg = $@;
|
||||
$errmsg = $errmsg->text if UNIVERSAL::isa($@, 'Mail::SPF::Exception');
|
||||
syslog(
|
||||
info => "Mail From (sender) check failed - Mail::SPF->new(%s, %s, %s) failed: %s",
|
||||
$attr->{client_address} || '<UNKNOWN>',
|
||||
$attr->{sender} || '<UNKNOWN>', $attr->{helo_name} || '<UNKNOWN>', $errmsg || '<UNKNOWN>'
|
||||
);
|
||||
if ($VERBOSE) {
|
||||
syslog(
|
||||
info => "Mail From (sender) check failed - Mail::SPF->new(%s, %s, %s) failed: %s",
|
||||
$attr->{client_address} || '<UNKNOWN>',
|
||||
$attr->{sender} || '<UNKNOWN>', $attr->{helo_name} || '<UNKNOWN>', $errmsg || '<UNKNOWN>'
|
||||
);
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -343,11 +355,13 @@ sub sender_policy_framework {
|
|||
};
|
||||
|
||||
# Same approach as HELO....
|
||||
syslog(
|
||||
info => "SPF %s: Envelope-from: %s",
|
||||
$mfrom_result || '<UNKNOWN>',
|
||||
$attr->{sender} || '<UNKNOWN>'
|
||||
);
|
||||
if ($VERBOSE) {
|
||||
syslog(
|
||||
info => "SPF %s: Envelope-from: %s",
|
||||
$mfrom_result || '<UNKNOWN>',
|
||||
$attr->{sender} || '<UNKNOWN>'
|
||||
);
|
||||
};
|
||||
if ($mfrom_result->is_code('fail')) {
|
||||
return "550 $mfrom_authority_exp";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue