Postfix LDAP with multiple domains

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Postfix LDAP with multiple domains

sercoinful
Hi,

I'm using Postfix/Dovecot. I have two different domain (xdomain.com and
ydomain.com). I create two different Dovecot config file for authentication
and it works fine. But I can't configure virtual_mailbox_maps for my
domains. If I configure like below it works fine;

server_host = ldap://ldap.xdomain.com:389
search_base = cn=Users, dc=xdomain, dc=com
version = 3
query_filter = (&(objectclass=person)(mail=%s))
result_attribute = mail
result_format = %d/%u/
bind = yes
bind_dn = [hidden email]
bind_pw = AdminTest

If I change xdomain to ydomain it also works fine. But I can't configure
both. How can I do that?

Regards



--
Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html
Reply | Threaded
Open this post in threaded view
|

Re: Postfix LDAP with multiple domains

Viktor Dukhovni
> On Oct 16, 2018, at 4:50 AM, sercoinful <[hidden email]> wrote:
>
> server_host = ldap://ldap.xdomain.com:389
> search_base = cn=Users, dc=xdomain, dc=com
> version = 3
> query_filter = (&(objectclass=person)(mail=%s))
> result_attribute = mail
> result_format = %d/%u/
> bind = yes
> bind_dn = [hidden email]
> bind_pw = AdminTest
>
> If I change xdomain to ydomain it also works fine. But I can't configure
> both. How can I do that?

As described in:  http://www.postfix.org/ldap_table.5.html

   ...
   search_base = cn=Users, dc=%2, dc=%1
   domain = xdomain.com, ydomain.com
   ...

which works when the number of components in the search base is the same
for all the domains of interest.  If even that is variable, then you
need multiple tables, each with its own search base and "domain = ..."
constraint.  Since the "domain = ..." constraints quickly skip tables
that don't apply without incurring the costs of an actual LDAP lookup,
using multiple tables incurs no noticeable overhead:

    virtual_mailbox_maps =
        ldap:${config_directory}/virtual-example.net.cf,
        ldap:${config_directory}/virtual-example.org.cf,
        ...

--
        Viktor.