Two domains - same user names filter
Aki Tuomi
aki.tuomi at dovecot.fi
Fri Jun 2 11:40:52 EEST 2017
> On June 2, 2017 at 11:13 AM Steffen Kaiser <skdovecot at smail.inf.fh-brs.de> wrote:
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Fri, 2 Jun 2017, Sandbox wrote:
>
> > I have two LDAP domains, which has some equal users, eg:
> >
> > abc at domain1.com
> > abc at domain2.com
> >
> > This works fine except one thing: i cant set up the ldap query to choose
> > the correct maildir if the user names are equal.
>
> Well the most problem is that you have two LDAP servers with different
> content.
>
> > Is it possible to use a user_filter which will choose the correct maildir
> > and user/domain from the email address?
> >
> > My current ldap.conf for domain1:
> >
> > hosts = ldap.domain1.com
> > base = ou=People,dc=domain1,dc=com
> > ldap_version = 3
> > user_attrs = uid=user
> > user_filter = (uid=%n)
> > pass_attrs = uid=user,userPassword=password
> > pass_filter = (uid=%n)
> > default_pass_scheme = MD5
> >
> > and for domain2:
> > hosts = ldap.domain2.com
> > base = ou=People,dc=domain2,dc=com
> > ldap_version = 3
> > user_attrs = \
> > =mail=maildir:/home/vmail/%{ldap:departmentNumber)/%n/Maildir
> > user_filter = (uid=%n)
> > pass_attrs = uid=%n,userPassword=password
> > pass_filter = (uid=%n)
> > default_pass_scheme = MD5
>
> you have one LDAP conf per domain and two userdb's, right?
>
> Can you make use of ${domain} in one of the LDAP servers, is the domain
> present in the user entries?
>
> - --
> Steffen Kaiser
Dovecot 2.2.29+ has feature called username_filter for passdb blocks, which lets you specify usernames the passdb block is to be used. This could simplify your config somewhat. See https://wiki.dovecot.org/PasswordDatabase
Aki
More information about the dovecot
mailing list