Re: [Exim] Exim 4 - problem mixing acls with hostlists

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Philip Hazel
Date:  
À: J.Horne
CC: exim-users
Sujet: Re: [Exim] Exim 4 - problem mixing acls with hostlists
On Wed, 27 Mar 2002, John Horne wrote:

> PLYM_NET = 141.163.0.0/16
> ISP = 194.164.0.0/16
>
> hostlist external_hosts = ! PLYM_NET : ! 127.0.0.0/8
> hostlist rbl_hosts = +external_hosts : ! ISP


That won't work (as you have found). Remember that if a host list ends
with a negative item, there is an implicit : * at the end.

> If I set the
> helo_verify_hosts to '! PLYM_NET : ! 127.0.0.0/8 : ! ISP' then that works
> fine too.


Exactly. When you wrote

helo_verify_hosts = +external_hosts : ! ISP

it is in fact equivalent to

helo_verify_hosts = ! PLYM_NET : ! 127.0.0.0/8 : * : !ISP

which is why it didn't behave the way you expected.

Or, to look at it another way, when Exim is processing rbl_hosts, it
first asks "Is the host in +external_hosts?" The answer is "yes", because
it matches

! PLYM_NET : ! 127.0.0.0/8

(because of the implied * at the end). So Exim never looks as ! ISP.

This seems to be one case where using a macro instead of a host list
would be more intuitive. (And I thought it was all the other way round!)

Negation is always tricky, unfortunately. How about doing it the
other way round? For example:

hostlist internal_hosts = PLYM_NET : 127.0.0.0/8
hostlist rbl_hosts = !+internal_hosts : ! ISP

This will also continue to work when you change PLYM_NET to contain more
than one item.

Maybe I should document somewhere the best way of reading these things:

   a :  b       a or b
  !a :  b       not a and b (or b and not a)
  !a : !b       not a and not b


After a positive item ":" is "or"; after a negative item, it is "and".
So your setting or rbl_hosts means "external host or not ISP", which is
isn't what you want.

I hope this helps!

Philip

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