initial commit of file from CVS for smeserver-qpsmtpd on Thu 26 Oct 11:25:19 BST 2023

This commit is contained in:
2023-10-26 11:25:19 +01:00
parent c8bfca82cb
commit c45ac2b2d0
197 changed files with 3867 additions and 2 deletions

View File

@@ -0,0 +1,2 @@
# Format is IP, or IP part with trailing dot
# e.g. "127.0.0.1", or "192.168."

View File

@@ -0,0 +1,5 @@
{
$OUT = "127.0.0.1\n";
$OUT = "127.0.0.\n";
$OUT .= "$LocalIP";
}

View File

@@ -0,0 +1,37 @@
{
use esmith::util::network qw(isValidIP);
use Net::IPv4Addr qw(ipv4_in_network ipv4_parse);
my $relayclients = ${qpsmtpd}{UnauthenticatedRelayClients} || return;
my @relayclients = split /[,:]/, $relayclients;
my $ndb = esmith::NetworksDB->open_ro();
sub convert_to_cidr
{
$_ = shift;
return "$_/32" unless m!/!;
my ($ip,$bits) = ipv4_parse($_);
return "$ip/$bits";
}
my @localAccess = map {
convert_to_cidr($_)
} $ndb->local_access_spec();
foreach my $relayclient (@relayclients)
{
if (!isValidIP($relayclient))
{
$OUT .= "## $relayclient is not an IP\n";
}
elsif (grep { ipv4_in_network($_, $relayclient) } @localAccess)
{
$OUT .= "$relayclient\n";
}
else
{
$OUT .= "## $relayclient is not in any local network\n";
}
}
}

View File

@@ -0,0 +1,25 @@
{
use esmith::util;
my @prefixes = ();
require esmith::NetworksDB;
my $n = esmith::NetworksDB->open;
foreach my $network ($n->get_all_by_prop(type => 'network'))
{
if ( (($qpsmtpd{'RelayRequiresAuth'} || 'enabled') eq 'disabled') or
(($network->prop('RelayRequiresAuth') || 'enabled') eq 'disabled'))
{
push(@prefixes,
esmith::util::computeAllLocalNetworkPrefixes(
$network->key, $network->prop('Mask')));
}
}
foreach my $prefix ( @prefixes )
{
my $dot = ( $prefix =~ /\d+\.\d+\.\d+\.\d+/ ) ? '' : '.';
$OUT .= $prefix . $dot . "\n";
}
}