I'm having trouble configuring OpenLDAP meta backend through OLC. Unfortunately, openldap.org/docs doesn't have back-meta configuration yet

11.5.2. back-meta Configuration


 man slapd-meta

Yields info for slapd.conf configuration style. Also, there are many how-tos on meta using slapd.conf, but I found none using OLC.

  1. I would appreciate an example of .ldif for meta-backend configuration
  2. Is it possible to partially configure OpenLDAP using slapd.conf to OLC conversion? For example, configure meta using slapd.conf only and everything else using OLC?

Here is a sample .ldif file for meta-backend configuration:

dn: olcDatabase={3}meta,cn=config
objectClass: olcDatabaseConfig
objectClass: olcMetaConfig
olcDatabase: {3}meta
olcSuffix: dc=example,dc=com
olcDbOnErr: continue
olcDbCancel: abandon
olcDbTFSupport: no
structuralObjectClass: olcMetaConfig

dn: olcMetaSub={0}uri,olcDatabase={3}meta,cn=config
objectClass: olcMetaTargetConfig
olcMetaSub: {0}uri
olcDbURI: "ldap://localhost/ou=backend1,dc=example,dc=com"
olcDbRewrite: {0}suffixmassage "ou=backend1,dc=example,dc=com" "ou=backend1"
olcDbKeepalive: 0:0:0
olcDbBindTimeout: 100000
olcDbCancel: abandon
structuralObjectClass: olcMetaTargetConfig

To answer your second question here is how I created above. I followed this excellent blog post: https://blog.oddbit.com/post/2010-02-16-merging-directories-with-openldap-meta/

Here are my steps:

  1. Compile and install openldap under /u01/app/openldap
  2. Created slapd-be1.conf, slapd-be2.conf and slapd-fe.conf
  3. Included above three files in /u01/app/openldap/etc/openldap/slapd.conf (I also commented out default database creation directive right below "MDB Database Definition"
  4. Created openldap database using this conf file:
    $ u01/app/openldap/libexec/slapd  -f /u01/app/openldap/etc/openldap/slapd.conf -h ldap:/// -F /u01/app/openldap/etc/slapd.d/

The above use slapd.conf and creates the database and it also creates structure under /u01/app/openldap/etc/slapd.d, which can be used for OLC going forward.
5. Stop slapd
6. Start slapd and this time do not use slapd.conf

$ u01/app/openldap/libexec/slapd -h ldap:/// -F /u01/app/openldap/etc/slapd.d/
  1. Add data as per the blogpost
$ ldapadd -x -D cn=ldif-admin,ou=backend1 -W -f backend1.ldif 
$ ldapadd -x -D cn=ldif-admin,ou=backend2 -W -f backend2.ldif 
  1. Search for this added data using backend endpoint
$ dapsearch -x -b ou=backend1 
  1. Search for this data using meta endpoint
$ ldapsearch -x -b dc=example,dc=com
  1. Dump LDAP config
$ slapcat -n 0 -l config.ldif -F /u01/app/openldap/etc/slapd.d

The above command would generate config.ldif containing configuration for the whole of LDAP. You'll see the meta configuration towards the end of the file. Going forward, you can use this syntax to create meta LDIF and import using OLC.

Hope the above helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.