* Skip SPF checks for local (127.) connections
* TODO skip localhost for IPv6.
This commit is contained in:
parent
515d21722d
commit
0d8075552e
4 changed files with 30 additions and 16 deletions
|
|
@ -43,7 +43,7 @@ my @HANDLERS = (
|
|||
}
|
||||
);
|
||||
|
||||
my $VERBOSE = 1;
|
||||
my $VERBOSE = 0;
|
||||
|
||||
my $DEFAULT_RESPONSE = 'DUNNO';
|
||||
|
||||
|
|
@ -113,24 +113,31 @@ while (<STDIN>) {
|
|||
|
||||
my $action = $DEFAULT_RESPONSE;
|
||||
my %responses;
|
||||
foreach my $handler (@HANDLERS) {
|
||||
my $handler_name = $handler->{name};
|
||||
my $handler_code = $handler->{code};
|
||||
# Skip SPF check for local connections
|
||||
|
||||
if ($attr{client_address}=~ /^127\./) {
|
||||
$action = "PREPEND SPF skipped - localhost is always allowed."
|
||||
}
|
||||
else {
|
||||
foreach my $handler (@HANDLERS) {
|
||||
my $handler_name = $handler->{name};
|
||||
my $handler_code = $handler->{code};
|
||||
|
||||
my $response = $handler_code->(attr => \%attr);
|
||||
my $response = $handler_code->(attr => \%attr);
|
||||
|
||||
if ($VERBOSE) {
|
||||
syslog(debug => "handler %s: %s", $handler_name, $response);
|
||||
}
|
||||
if ($VERBOSE) {
|
||||
syslog(debug => "handler %s: %s", $handler_name, $response);
|
||||
}
|
||||
|
||||
# Picks whatever response is not dunno
|
||||
if ($response and $response !~ /^dunno/i) {
|
||||
syslog(info => "handler %s: is decisive.", $handler_name);
|
||||
$action = $response;
|
||||
last;
|
||||
# Picks whatever response is not dunno
|
||||
if ($response and $response !~ /^dunno/i) {
|
||||
syslog(info => "handler %s: is decisive.", $handler_name);
|
||||
$action = $response;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
syslog(info => "%s: Policy action=%s", $attr{queue_id}, $action);
|
||||
|
||||
STDOUT->print("action=$action\n\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue