smeserver-qpsmtpd/root/etc/e-smith/db/configuration/migrate/20RBLList

36 lines
1.1 KiB
Plaintext

{
$qpsmtpd = $DB->get('qpsmtpd');
return unless $qpsmtpd;
my $rbl = $qpsmtpd->prop('RBLList');
return unless $rbl;
my @rbl = ();
# Migrate to use , as separator instead of :
if ($rbl !~ m/,/){
my @zones = split /[:]/, $rbl;
my $fqdn_re = qr/([a-zA-Z0-9][a-zA-Z0-9\-]{1,61}\.)*[a-zA-Z0-9][a-zA-Z0-9\-]{1,61}\.[a-zA-Z]{2,}/;
if (scalar @zones == 2 && $zones[1] !~ m/^$fqdn_re$/){
# When we have only two entries, check if the second one looks like a valid hostname
# so if you only have something like dnsbl.foo.net:Sorry you are blacklisted
# it won't be migrated to dnsbl.foo.net,Sorry you are blacklisted
@rbl = ($rbl);
}
else{
@rbl = @zones;
}
}
else{
@rbl = split /[,]/, $rbl;
}
my %obsolete = map { $_ => 1} qw(
combined.njabl.org
list.dsbl.org
multihop.dsbl.org
dnsbl.ahbl.org
);
@rbl = grep { ! $obsolete{$_} } @rbl;
$qpsmtpd->set_prop('RBLList', join ',', @rbl);
}