Re: [Exim] Lsearch by IP

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: Nico van der Dussen
Υ/ο: exim-users
Αντικείμενο: Re: [Exim] Lsearch by IP
On Tue, 22 Apr 2003, Nico van der Dussen wrote:

> I would like to do an lsearch* on IP-numbers from a file for the
> smtp_accept_max_per_host command (using Exim 4.14)
>
> >From the manual I gather that the lookup must be
> smtp_accept_max_per_host =
> ${lookup{$sender_host_address}lsearch*{/path/to/file}}
>
> The file should contain lines like
>
> 123.111.222.123:4
> *:1
>
> Now the big thing I'm not sure about: How do I handle say
> 123.111.222.0/24 blocks of IP's?
>
> It does not seem right from the manual to add a line
>
> 123.11.222.0/24:2
>
> to the search file


That will only work if you replace $sender_host_address with
${mask:$sender_host_address/24} in the lookup. But the lookup will not
then find the other entries. What you need is a double lookup. Something
like this:


smtp_accept_max_per_host = \
${lookup{$sender_host_address}lsearch{/path/to/file}\
{$value}\
{\
${lookup{${mask:$sender_host_address/24}lsearch*{/path/to/file}}\
}}

Note that the first one does *not* have the * on the search type. If you
have blocks of different sizes (/24, /26, etc) you will have to
configure it to do a separate lookup for each size.

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.