Non-working attempt at config file for relay exemption
This commit is contained in:
parent
341d0a775d
commit
652e07ced7
1 changed files with 35 additions and 6 deletions
|
|
@ -78,8 +78,9 @@ my $VERBOSE = 0;
|
||||||
|
|
||||||
my $DEFAULT_RESPONSE = 'DUNNO';
|
my $DEFAULT_RESPONSE = 'DUNNO';
|
||||||
|
|
||||||
# Read in exempt domains list
|
# Read in exemption lists
|
||||||
my $exempt_domains = get_exempt_domains( "/etc/postfix/exempt_spf_domains" );
|
my $exempt_domains = get_exempt_domains( "/etc/postfix/exempt_spf_domains" );
|
||||||
|
my $relay_addresses = get_exempt_address("/etc/postfix/exempt_spf_addresses");
|
||||||
|
|
||||||
#
|
#
|
||||||
# Syslogging options for verbose mode and for fatal errors.
|
# Syslogging options for verbose mode and for fatal errors.
|
||||||
|
|
@ -97,11 +98,6 @@ use constant localhost_addresses => map(
|
||||||
qw( 127.0.0.0/8 ::ffff:127.0.0.0/104 ::1 )
|
qw( 127.0.0.0/8 ::ffff:127.0.0.0/104 ::1 )
|
||||||
); # Does Postfix ever say "client_address=::ffff:<ipv4-address>"?
|
); # Does Postfix ever say "client_address=::ffff:<ipv4-address>"?
|
||||||
|
|
||||||
use constant relay_addresses => map(
|
|
||||||
NetAddr::IP->new($_),
|
|
||||||
qw( )
|
|
||||||
); # add addresses to qw ( ) above separated by spaces using CIDR notation.
|
|
||||||
|
|
||||||
# Fully qualified hostname, if available, for use in authentication results
|
# Fully qualified hostname, if available, for use in authentication results
|
||||||
# headers now provided by the localhost and whitelist checks.
|
# headers now provided by the localhost and whitelist checks.
|
||||||
my $host = hostname_long;
|
my $host = hostname_long;
|
||||||
|
|
@ -195,6 +191,7 @@ while (<STDIN>) {
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
# handler: domain exemption
|
# handler: domain exemption
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
|
|
||||||
sub get_exempt_domains {
|
sub get_exempt_domains {
|
||||||
my ( $file ) = @_;
|
my ( $file ) = @_;
|
||||||
|
|
||||||
|
|
@ -255,6 +252,38 @@ sub exempt_localhost {
|
||||||
# handler: relay exemption
|
# handler: relay exemption
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
|
|
||||||
|
sub get_exempt_address {
|
||||||
|
my ( $file ) = @_;
|
||||||
|
|
||||||
|
my $list = {};
|
||||||
|
|
||||||
|
# Return nothing if file not found
|
||||||
|
if ( ! -r $file ) {
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Read the file into one variable, split on space or comma (or all)
|
||||||
|
open ( FILE, $file ) or die "Can't open $file: $!\n";
|
||||||
|
my $text = "";
|
||||||
|
while ( my $tmp = <FILE> ) {
|
||||||
|
$text .= $tmp;
|
||||||
|
}
|
||||||
|
close( FILE );
|
||||||
|
|
||||||
|
#$list => map(
|
||||||
|
# NetAddr::IP->new($_),
|
||||||
|
# qw( $text )
|
||||||
|
#); # add addresses to qw ( ) above separated by spaces using CIDR notation.
|
||||||
|
|
||||||
|
foreach my $addr ( split( /[\s,]+/, $text ) ) {
|
||||||
|
map(
|
||||||
|
NetAddr::IP->new($list),
|
||||||
|
qw( $addr )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
sub exempt_relay {
|
sub exempt_relay {
|
||||||
my %options = @_;
|
my %options = @_;
|
||||||
my $attr = $options{attr};
|
my $attr = $options{attr};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue