This is no “problem report”, but more of a little helper article, the first in my new category “howto”.
There are some articles on the net covering the subject of converting OpenLDAP schema files to LDIF format and then importing the result into your server(s). Unfortunately, all articles I’ve read so far were either too complex in their approach, too simple (leaving out important steps) or contained mistakes. All this for a rather simple task.
From time to time, we need to add another schema to our LDAP servers, but all we have is a .schema file, while our OpenLDAP servers are configured the OLC way (“LDIF configuration”).
The task is simple, done in 5 steps:
- create a temporary directory and put a simple dummy config file in there, with a single line to include your schema file
- use slaptest to convert to LDIF format
- remove sequence information from the created LDIF file name and content, as well as structural information
- import the LDIF file to your OpenLDAP server
- clean up the temporary directory
You can use our little helper script (schema2ldif.sh) to create the LDIFs directly, or to look up how it can be done and optimize that to better suit your needs.
Importing the resulting file is easily done via “ldapadd”:
ldapadd -D “configUser” -Wx -h yourhost -f yourfile.ldif
Of course, you need to insert your own credentials, host name and LDIF file.