By lifting the code out of the
nodialup plugin I am trying to implement a
new qpsmtpd plugin that aims to staunch those incomings of the form...
2007-02-08 10:18:37.955450500 6648 Accepted connection 0/40 from 213.197.173.234 / Unknown
2007-02-08 10:18:37.955662500 6648 Connection from Unknown [213.197.173.234]
Uncertain how to parse for... well, that which is ascribed to be 'Unknown'!
These are the variations for which I am testing...
sub hook_connect {
my ($self, $transaction) = @_;
my $remote_ip = $self->qp->connection->remote_ip;
my $remote_host = $self->qp->connection->remote_host;
my $reverse_remote_ip = join (".", reverse(split(/\./,$remote_ip)));
if ($remote_ip eq $remote_host) {
return (DENYSOFT, "Reverse DNS lookup for $remote_ip failed.");
}
elsif (($remote_host =~ /$reverse_remote_ip/)
|| ($remote_host =~ /\.Unknown\./)
|| ($remote_host =~ /\.unknown\./)
|| ($remote_host =~ /\.\./)
|| ($remote_host =~ /\. \./)) {
return (DENY, "Sorry, $remote_host ($remote_ip) seems to ".
"be unidentifiable, your ISP should remedy.");
}
else {
return DECLINED;
}
}
...but they don't work. Possibly for the reason that the 'Unknown' is a
qpsmtpd insertion as opposed to being anything real - any thoughts?