[Dovecot] v2.0 configuration parsing

Felix Schueren felix.schueren at hosteurope.de
Mon Aug 10 21:47:35 EEST 2009


Timo Sirainen wrote:
> I'm trying to figure out how exactly v2.0 should be parsing
> configuration files. The most annoying part is if it should always just
> "use whatever comes first in config" or try some kind of a "use most
> specific rule". The "most specific" kind of makes more sense initially,
> but then you start wondering how to handle e.g.:
> 
> 1) User logs in to imap from 192.168.0.1. What is foo's value?
> 
> protocol imap {
>   remote_ip 192.168.0.0/16 {
>     foo = foo
>   }
> }
> remote_ip 192.168.0.0/24 {
>   foo = bar
> }
> 


make it
protocols {
  imap {
    remote_ip x/16 {
      foo = foo
    }
  }
  all {
    remote_ip x/24 {
      foo = bar
    }
  }
}

> 2) User logs in from 192.168.0.1 to 10.1.2.3. What is foo's value?
> 
> local_ip 192.168.0.1 {
>   remote_ip 10.1.2.0/24 {
>     foo = foo
>   }
> }
> remote_ip 10.1.2.3 {
>   local_ip 192.168.0.0/24 {
>     foo = bar
>   }
> }
> 
I'd strongly suggest to use the same approach as firewalls (or exim):
first match wins. I love exim because I can configure it much like my
firewalls & routers, and the "fall through until something matches"
syntax that most firewalls/ACLs use is well-understood & flexible.

Kind regards,

Felix

-- 
Felix Schüren
Head of Network

-----------------------------------------------------------------------
Host Europe GmbH - http://www.hosteurope.de
Welserstraße 14 - 51149 Köln - Germany
Telefon: 0800 467 8387 - Fax: +49 180 5 66 3233 (*)
HRB 28495 Amtsgericht Köln - USt-IdNr.: DE187370678
Geschäftsführer:
Uwe Braun - Alex Collins - Mark Joseph - Patrick Pulvermüller

(*) 0,14 EUR/Min. aus dem dt. Festnetz, Mobilfunkpreise ggf. abweichend


More information about the dovecot mailing list