Re: [Exim] Matching hostnames in a hostlist

Startseite
Nachricht löschen
Nachricht beantworten
Autor: James P. Roberts
Datum:  
To: exim-users
Betreff: Re: [Exim] Matching hostnames in a hostlist
----- Original Message -----
From: "Philip Hazel" <ph10@???>
To: "James P. Roberts" <punster@???>
> 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.


OK.

>
> > 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.)
>


Ah. Yet another reason to upgrade to latest ASAP. Why am I not surprised you
fixed it before I needed it? ;)

> > 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


So, if I upgrade (I'm at 4.02 at the moment), the only reason
$sender_host_name would be blank (when I try to use it) is if the reverse
lookup failed, which I do not expect to happen for the specific hosts in
question. Cool.

Now, here's the thing. What I REALLY want to do is, when a host connects that
is in my "special" list of hosts, I want to (a) trigger a specific ACL
statement (easily done), and (b) use a regex in that ACL which uses precisely
the same hostname that was the one in the hostlist which matched the incoming
client IP. Any chance that is already lying about in some expansion variable?

That is to say, if a particular host connects, and it has more than one name,
I want to make sure I only use the same name in my regex as the one in my
hostlist which triggered the match.

At the moment, I am using $sender_helo_name in the regex, simply because I
know the host(s) in question actually helo with the name I want to use in the
regex. This is probably not a "general" solution, though.

Kindest Regards,
Happy New Year,
etc.,

Jim Roberts
Punster Productions, Inc.