SPF: added more precise disposition logs, so that

postprocess can determine if a SPF failure caused a rejection
This commit is contained in:
Matt Simerson 2013-04-24 16:18:22 -04:00
parent b4ee9620e5
commit 981bdf5f85

View File

@ -151,22 +151,25 @@ sub mail_handler {
return $self->handle_code_softfail($reject, $why) if $code eq 'softfail'; return $self->handle_code_softfail($reject, $why) if $code eq 'softfail';
if ($code eq 'neutral') { if ($code eq 'neutral') {
$self->log(LOGINFO, "fail, $code, $why"); if ($reject >= 5 ) {
return (DENY, "SPF - $code: $why") if $reject >= 5; $self->log(LOGINFO, "fail, $code, $why");
return (DENY, "SPF - $code: $why");
};
$self->log(LOGINFO, "fail, tolerated, $code, $why");
return (DECLINED);
} }
elsif ($code eq 'error') { if ($code =~ /(?:permerror|error)/ ) {
$self->log(LOGINFO, "fail, $code, $why"); $self->log(LOGINFO, "fail, $code, $why") if $reject > 3;
return (DENY, "SPF - $code: $why") if $reject >= 6; return (DENY, "SPF - $code: $why") if $reject >= 6;
return (DENYSOFT, "SPF - $code: $why") if $reject > 3; return (DENYSOFT, "SPF - $code: $why") if $reject > 3;
$self->log(LOGINFO, "fail, tolerated, $code, $why");
return (DECLINED);
} }
elsif ($code eq 'permerror') { if ($code eq 'temperror') {
$self->log(LOGINFO, "fail, $code, $why");
return (DENY, "SPF - $code: $why") if $reject >= 6;
return (DENYSOFT, "SPF - $code: $why") if $reject > 3;
}
elsif ($code eq 'temperror') {
$self->log(LOGINFO, "fail, $code, $why"); $self->log(LOGINFO, "fail, $code, $why");
return (DENYSOFT, "SPF - $code: $why") if $reject >= 2; return (DENYSOFT, "SPF - $code: $why") if $reject >= 2;
$self->log(LOGINFO, "fail, tolerated, $code, $why");
return (DECLINED);
} }
$self->log(LOGINFO, "SPF from $from was $code: $why"); $self->log(LOGINFO, "SPF from $from was $code: $why");
@ -211,7 +214,7 @@ sub handle_code_softfail {
return (DENYSOFT, "SPF - fail: $why") if $reject >= 3; return (DENYSOFT, "SPF - fail: $why") if $reject >= 3;
} }
$self->log(LOGINFO, "fail, soft, tolerated, $why"); $self->log(LOGINFO, "fail, tolerated, soft, $why");
return DECLINED; return DECLINED;
} }