Author: Dave C. Date: To: Philip Hazel CC: exim-users Subject: Re: [Exim] check host_accept_relay from script?
On Tue, 27 Feb 2001, Philip Hazel wrote:
> On Tue, 27 Feb 2001, Dave C. wrote:
>
> > Say it contained:
> >
> > 10.34.0.0/18 : 192.168.5.0/24 : 192.168.19.0/24
> >
> > If I put that in a file, one per line, and used
> >
> > host_accept_relay = net-lsearch;/some/file
>
> If you are never going to consider turning it into anything other than
> lsearch, you could in fact just omit "net-lsearch;" altogether. The file
> is valid as an insertion.
>
> > Grumble.. Testing suggests that while this:
> >
> > > host_accept_relay = net-lsearch;/some/file
> >
> > would probably work fine, this:
> >
> > > ${lookup{$sender_host_address}net-lsearch{/some/file}{yes}{no}}
> >
> > will not. The spec implies that the net- appendage to lsearch is only
> > valid when exim is parsing a host list.. Sigh...
>
> But
>
> ${lookup{$sender_host_address}lsearch{/some/file}{yes}{no}}
>
> will work.[1] You need to have the "net-" prefix in host lists to tell Exim
> to search using the address instead of the name. But in this lookup, you
> are giving the key explicitly, so there's no need.
>
> [1] Actually, it won't work. Your file has keys like "10.34.0.0/18" but
> $sender_host_address contains just an IP address. However, all is not
> lost. You can use the ${mask... construction to turn it into the right
> form. But unfortunately, you have two different key lengths. You'll have
> to use
Yeah.. Id really like to have it support variable masklenth, as
specified in the file, since it theoretically can contain any number of
different networks with different mask lengths..
I need the "Is this IP address contained within any of the Network/Mask
specifications given" concept that (i think) exim does with net-lsearch
in host lists.. Hrm.. I suppose I could use exim -d9 -bh and somehow try
and parse the output, which, awkward tho it might be, is still closer to
the 'would exim permit relay for this IP address' which is really the
question I want to be able to answer..