# LDAP merge question



## Leander (Sep 24, 2014)

Hi,

I have two OpenLDAP servers ==> A & B

Now I have a mailserver which needs to get account data out of LDAP Server A and LDAP Server B. Is there a way I can set up a third one merging the both? What is the common strategy with such issues?

Thanks


----------



## SirDice (Sep 25, 2014)

Which mail server software and what do the different LDAP servers contain? There may be other solutions.


----------



## Leander (Sep 25, 2014)

I'm going to use mail/postfix and  mail/dovecot again. The two LDAP server have the exact same structure - just different users and groups. Basically the three of them looks like:


```
-LDAP-Root
    |- People (users)
    |--- User 1
    |---- Contacts (privat addressbook of user)
    |--- User 2
    |---- Contacts (privat addressbook of user)
    |- Groups
    |--- Group 1
    |--- Group 2
    |- Contacts (public addressbook)
```

I've had the hope, that hte mailserver could hold a third LDAP three, which is a mirror to the two existing one like eg.:

```
-LDAP-Root A
    |- People
    |--- User 1
    |---- Contacts
    |--- User 2
    |---- Contacts
    |- Groups
    |--- Group 1
    |--- Group 2
    |- Contacts
    |
-LDAP-Root B
    |- People
    |--- User 1
    |---- Contacts
    |--- User 2
    |---- Contacts
    |- Groups
    |--- Group 1
    |--- Group 2
    |- Contacts
```

But hinking twice about this solution doesn't sound to prmising anymore, since UIDs and GIDs will definitly clash in this szenario ;(


----------



## Leander (Sep 25, 2014)

I think, I need to let the mailserver have the master LDAP, and the two storage server A and B should have a replication of the master. But how do I do this?


----------



## ondra_knezour (Sep 25, 2014)

It depends, if you want to exchange stored info between those two servers (both of them containing everything), then go with the replication, or if you just want to get all information from both servers in one query without full replication, then look for the chaining overlay.

http://www.openldap.org/doc/admin24/replication.html
http://www.openldap.org/doc/admin24/overlays.html


----------



## Leander (Sep 25, 2014)

Thank you very much for your advice and the useful links. I think I want to replicate.

*In my own words:*
Replication means that, if one of the three LDAP DBs experiences any change (add, remove, edit) - then the other two LDAP DBs will be synchronized to this update immediately. Is this correct for my case?


----------



## ondra_knezour (Sep 25, 2014)

Not sure about immediately (couple of seconds, configured timeouts?) and how well will a multimaster replication work, but generally yes.


----------



## Leander (Sep 25, 2014)

Cool - thanks a lot


----------

