[Exim] MySQL + "failed to find host name from IP address"

Page principale
Supprimer ce message
Répondre à ce message
Auteur: J Yunke
Date:  
À: exim-users
Sujet: [Exim] MySQL + "failed to find host name from IP address"
Hi --

I am using the following in my 'configure' file:

  host_accept_relay = "/etc/exim/hosts_allow : \
    mysql;select ip from ip where ip='${quote::$sender_host_address}'"


This query simply returns back a single record if the IP is in the
database, and no records if it's not.

The ip column is a VARCHAR(15).

I get the pesky 'failed to find host name from IP address' message even
when the IP is in the database, IF AND ONLY IF the ISP doesn't have
reverse IP on the IP address. Else, it works fine.

The only recommendation I could find was in Q0029 (attached below) which
says to list IPs first. Fair enough...except the /etc/exim/hosts_allow
contains ONLY IP ADDRESSES and the MySQL database query either returns the
IP ADDRESS or no records, so there is never a host name involved.

I have also tried:

#1. Playing with the +allow_unknown parameter.

#2. Using concat(ip,"/32") to force the MySQL query to return a
CIDR-notation IP address.

The only way I can fix this problem (until this gets corrected) is to
add:

w.x.y.0/24

...into the /etc/exim/hosts_allow.

How can I fix this so that I can ignore crappy ISPs that don't have
proper reverse DNS? (I've contacted them before and they ignore my
requesets, so it's not an option.)

Thanks!

P.S. Once this is corrected, I will post a link to a home-grown
POP-before-SMTP solution (in the form of a patch to popa3d and a config
line in exim similar to the above) that uses MySQL. It's nifty as long as
IPs reverse resolve ;)

-- Justin

-- FROM THE FAQ --

Q0029: Why is Exim refusing to relay, saying "failed to find host name
from IP address" when I have the sender's IP address in host_accept_relay?

A0029: When checking host_accept_relay, the items are tested in
left-to-right order. The first item in your list is a lookup on the
incoming host's name, so Exim has to determine the name from the incoming
IP address in order to perform the test. If it can't find the host name,
it can't do the check, so it gives up. The solution is to put all explicit
IP addresses first in the list. You would have discovered what was going
on if you had run a test such as

         exim -bh 192.168.96.131