2

I've read all the available documentation, the Mastering OpenLDAP book, and like a zillion mail-list posts but I haven't found a way to make such scenario possible. I see several use cases for this scenario like an enterprise application syncing all users from the main LDAP of the Org but keeping it's own application related schemas and objects in its server.

So please, could you point me in the right direction or help me discard the possibility at all?

EDIT June 17

An example scenario: example scenario

What I'm trying to accomplish is to be able to get all the data in o=area1,o=myorg,dc=org and o=area2,o=myorg,dc=org from the provider, but also to be able to have additional data in the consumer, like o=subarea1,o=myorg,dc=org.

I have no problem getting the data from the provider, I've set up an syncrepl entry in the consumer for each branch (area1, area2) with different rids

syncrepl rid=101 
 provider="ldap://provider:389" 
 bindmethod=simple 
 binddn="cn=replicator,o=myorg,cn=org" 
 credentials="***" 
 searchbase="o=area1,o=myorg,dc=org" 
 type=refreshAndPersist 
 retry="5 5 300 5" 
 timeout=3 
 schemachecking=off 
 scope=sub

and I've also activated syncprov on the provider.

The proble arises when I try to add any data on the consumer, it always fails with error:

LDAP Error code 53 - shadow context; no update referral

4 Answers 4

2
+100

Yes you can. Just search filter and attrs you want to replicate at your syncrepl configuration

syncrepl rid=1
  provider=ldap://provider.myorg.com:389
  type=refreshOnly
  interval=01:00:00:00
  searchbase="ou=sales,o=employees,o=myorg,cn=com"
  filter="(objectClass=posixAccount)"
  scope=base
  attrs="cn,sn,userPassword"
  schemachecking=off
  bindmethod=simple
  binddn="cn=syncuser,o=myorg,cn=com"
  credentials=secret

now, it goes as follows:

  • replicate only ou=sales,o=myorg,cn=com
  • replicate only posixAccount schema
  • only cn, sn, and userPassword. Thus keeping consumer's gid and uid intact.
  • and don't go into children. Just, the baseDN you specify. Scope has some options.
    • sub, means all with subtrees
    • one, means only the searchbase and the one below it
    • base, means only the searchbase

There is one catch though. For attributes that your master samba does not have it, you have to update manually. For example, you have samba password at your consumer LDAP and your master LDAP does not have it, you have to update 2 LDAP to sync sambaNTPassword and sambaLMPassword at consumer LDAP to userPassword at master LDAP when user change their password. Of course, that only apply if you want to keep them passwords sync though.

4
  • But if I only replicate the base DN, the employee objects won't be replicated as they are leafs under this searchbase, no?
    – mvillar
    Jun 13, 2014 at 6:34
  • Then you can change the scope to "one" or "sub"
    – prd
    Jun 13, 2014 at 6:50
  • It doesn't work, when I try to add the local branch it fails with error: LDAP Error code 53 - shadow context; no update referral
    – mvillar
    Jun 13, 2014 at 9:02
  • Be sure to set rid to a unique value.
    – DustWolf
    Nov 18, 2020 at 14:05
1

If you are referring to is it possible to have different data schema for an consumer , then I think that you could just replicate things separately for one forest (or create another one ) then connect the consumer to that forest or AD site . Unfortunately I used openldap only briefly. I hope this helps .

3
  • I'm referring to have additional schemas and data in the consumer OpenLDAP. For example, get the branch "ou=sales,o=employees,o=myorg,cn=com" from the provider and have a branch ou=accounting,o=employees,o=myorg,cn=com only on the slave server.
    – mvillar
    Jun 12, 2014 at 13:47
  • The synchronization should be made by GIDs and SIDs not actual names so this could work out - the objects can be renamed on the slave server as far as I know
    – Alex H
    Jun 12, 2014 at 13:51
  • Please be aware that if it's one way replication it will overwrite the names with the ones from master
    – Alex H
    Jun 12, 2014 at 13:54
1

2 backends approach

As far as your different branches are in different backends, you can have a backend configured to be a consumer of a remote master, and another backend configured to be a standard backend when read and write are performed directly.

You define ou=sales,o=employees,o=myorg,cn=com as the DN of one backend with the settings for the replication. And you define ou=accounting,o=employees,o=myorg,cn=com as the DN of another backend, without replication settings.

1 backend approach

If everything as to be kept into the same backend, I imagine the following :

  1. Configure the backend replication in a multi-master maneer. This way, both servers are writable
  2. Where you locally writable tree has to be located, implement ACI to keep the replicated data read-only for the local users if necessary
  3. If the locally writable tree has to be kept locally and not replicated, you can configure directive to do a selective replication (ignoring attributes, object, DN, ...)
1
  • Yes I know that, but I want to know if it can be made in the same backend, because these additional are not going to be at the top of the tree.
    – mvillar
    Jun 12, 2014 at 14:23
0

I had the similar issue and found an option which allows writes on consumer bases:

olcMirrorMode: TRUE

It must be added after all syncrepl options. I think it solves your issue too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .