Re: [Exim] Matching hostnames in a hostlist

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: James P. Roberts
CC: exim-users
Tárgy: Re: [Exim] Matching hostnames in a hostlist
On Tue, 30 Dec 2003, James P. Roberts wrote:

> Am I correct that, when I use "hosts = +host_list" in an ACL, and I have
> defined "host_list" to include only fully specified hostnames (no wildcards),
> then Exim **will not** do a reverse lookup on the connecting host's IP, unless
> forced to by something else, right?


That should be right, yes.

> And this explains why, right after doing
> the above check in an ACL, the following statement in the ACL finds that
> $sender_host_name is blank?


If you are using the most recent version of Exim, any reference to
$sender_host_name should automatically cause a reverse DNS lookup if one
has not previously been tried. (This feature came in a few releases ago;
can't remember exactly when.)

> Can I simply add "host_lookup = +host_list", even though these are hostnames,
> not IPs? And would this then force a lookup for just those hosts in the list?
> The ONLY reason I want to do this is to populate $sender_host_name for this
> specific list of hosts, so it can be used in a regex later in the ACL.


What you are saying, I think, is

"If the IP associated with this name (one of those in your list) is
the IP of the calling host, then do a reverse lookup to see what name
is associtated with the IP."

Is that right? This hackery should do that:

  hostlist special_hosts = a.b.c.d : x.y.z : ...
...
  warn   hosts = +special_hosts
         condition = ${if eq{$sender_host_name}{}{yes}{yes}}


In other words, force a reference to $sender_host_name, which should
automatically cause the reverse look up.

Wait a minute! I'm being stupid. Given that a reference to that variable
causes the lookup, you don't need to pre-set it at all! Just use it in
your regex when you need it. Of course, if the lookup fails, the
variable will be empty.

Philip

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book