How do I remove a DIT from an OpenLDAP server?

0

I have a need to remove a DIT from an OpenLDAP v2.4 installation.

Creating a DIT is documented at http://www.openldap.org/doc/admin24/dbtools.html, however removing/deleting the DIT is undocumented.

The core problem I am trying to solve is to work around Ubuntu v14.04 behaviour where the system guesses an OpenLDAP configuration based on the hostname. I have a need to remove this configuration and create the correct one.

This process is automated as part of the orchestration of a system, so interactive mechanisms won't do.

I found advice from 2004 suggesting that the /var/lib/ldap tree be deleted using rm -rf, is this still the recommended solution to this problem?

Alternatively, is there a non-interactive mechanism available to configure the OpenLDAP DIT in an Ubuntu v14.04 system?

Graham Leggett

Posted 2016-03-14T17:07:01.013

Reputation: 303

Answers

0

You're already replacing the whole configuration anyway, so just go on and rm -rf everything, and copy/extract/unzip/etc. the new configuration in its place. There are a few more settings than just the autogenerated DIT, after all.

Also, I'm told, the Debian/Ubuntu package will not do any guessing if you extract your custom config before installing the package.

The official way seems to be disabling it via debconf:

echo "slapd slapd/no_configuration boolean true" | debconf-set-selections

That said, to remove a specific DIT, you need to:

  1. remove it from the slapd configuration:

    With a static slapd.conf you would need to somehow remove the 'database' option and all its configuration options.

    With dynamic cn=config, it seems that very recent OpenLDAP versions let you just ldapdelete the config entry, but older ones still require you to stop slapd and manually delete files from /etc/ldap/slapd.d/cn=config/….

    But either way, if you're already installing a full custom config, might as well delete the old one completely.

  2. remove it from the filesystem, since slapd will not delete the data on its own:

    The actual database is a bunch of files. If you want to delete them, do that using rm -rf.

user1686

Posted 2016-03-14T17:07:01.013

Reputation: 283 655