Hi, I have two LDAP domains, which has some equal users, eg: abc at domain1.com abc at domain2.com I sat up this config: domain1 users maildirs are stored in /home/vmail/username domain2 users maildirs are stored in /home/vmail/domain2/username This works fine except one thing: i cant set up the ldap query to choose the correct maildir if the user names are equal. 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 Thanks, Robert
-----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 = MD5you 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEVAwUBWTEeOXz1H7kL/d9rAQKgKAf+NgTeS/4p/BPFwiP7pFXvn1K0cNRvBLcA n6sDHQPebxnVxotRPomblaXoHVpYHPY9PlADQ6tF0g0ZjVuXeYdQuF5Yxy8pJgKb Wyy12H2kLOCbN4rbFEGJqxL9301mMQLfgIRe4EbDi4BdXRjyBNvIYU+6M2BYXHTx VNTXcsql18tmjJufN5/7XeVFpd3LVC4o6v2W99N88JLi2GJjpPVYGiyMrRmdGTOI XL75q8wg9Zoh6FKu+fdocDUpsFvxmraMChsagJScdHvG2pfMj26J87aJzHJ43zZe GhzI7fwCbuVWZ4mGyZNB4Age7MjO0yaeqCVR/M29dUPv3Xtl8Z7NCg==qnQp -----END PGP SIGNATURE-----
> 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 KaiserDovecot 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
Hi, 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. Unfortunately i cant do anything with this. :S 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? Nop, I have two ldap.conf files, one for domain1 and one for domain2 and two userdb setting in dovecot.conf for each ldap.conf files. | Can you make use of ${domain} in one of the LDAP servers, is the domain present in the user entries? Uhm, what do you mean? "Can you make use of ${domain} in one of the LDAP servers"? Only the mail address and the departmentNumber contains the domain in the user entries, to be clear, the first domain's (this is the "old" one) user entries does not contain any departmentNumber data so those e-mails are going to the current /home/vmail/user/maildir directory, the second domain (which is the "new" one) contains the departmentnumber data, so those emails are going to the /home/vmail/domain2.com/user/maildir directory. The main problem that I have the same usernames in both domains, thats why i cant use only one domain. Actually i have one ldap server with two domains configured. Just thinking about the problem, is that not possible to fill up a not used LDAP record eg: labeledURI with the user's second e-mail address? So in the ldap.conf i have to use a filter which can decide which e-mail address is used -> where to store the mail. Or, use two mail record. Both requires e-mail address filtering where i have to use the domain part as a decision parameter....what do you think? Robert 2017-06-02 10:13 GMT+02:00 Steffen Kaiser <skdovecot at smail.inf.fh-brs.de>:> -----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 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1 > > iQEVAwUBWTEeOXz1H7kL/d9rAQKgKAf+NgTeS/4p/BPFwiP7pFXvn1K0cNRvBLcA > n6sDHQPebxnVxotRPomblaXoHVpYHPY9PlADQ6tF0g0ZjVuXeYdQuF5Yxy8pJgKb > Wyy12H2kLOCbN4rbFEGJqxL9301mMQLfgIRe4EbDi4BdXRjyBNvIYU+6M2BYXHTx > VNTXcsql18tmjJufN5/7XeVFpd3LVC4o6v2W99N88JLi2GJjpPVYGiyMrRmdGTOI > XL75q8wg9Zoh6FKu+fdocDUpsFvxmraMChsagJScdHvG2pfMj26J87aJzHJ43zZe > GhzI7fwCbuVWZ4mGyZNB4Age7MjO0yaeqCVR/M29dUPv3Xtl8Z7NCg=> =qnQp > -----END PGP SIGNATURE----- >