[Mimedefang] filter_relay
David Hiebert
david at keyway.net
Fri Oct 29 20:30:56 EDT 2004
I am attempting to reject mail for ip's with no reverse DNS (not
mismatched forward/reverse.) The below filter_relay works, however it is
not passing the $msg for return(REJECT) to sendmail (or maybe sendmail
isn't picking it up?) The maillog reports: "sm-mta[82794]:
i9U00cCx082794: Milter: connect: host=[216.117.199.248],
addr=216.117.199.248, rejecting commands" for IP's without reverse, and
successfully sends with reverse.
My second question/problem is the 3 commented out lines. The man page for
mimedefang-filter indicates that if an IP has no reverse dns, then
$hostname is a duplicate of $hostip. This then should make a real quick
and easy check for no reverse, however the if statement (when not
commented) never seems to be true.
use Net::DNS;
sub filter_relay () {
my ($hostip, $hostname) = @_;
my $res = Net::DNS::Resolver->new;
my $query = $res->search($hostip);
#if ($hostip eq $hostname) {
# return ('TEMPFAIL',"Please fix your reverse DNS before sending us mail.");
#}
if ($query) {
$query->answer;
}
$response=$res->errorstring;
if ($response eq 'NXDOMAIN') {
return ('REJECT', "Please fix your reverse DNS before sending us mail.", 550, 5.7.1, 1);
}
return ('CONTINUE', "ok");
}
David Hiebert
Keyway Internet Services
909-933-3699
More information about the MIMEDefang
mailing list