LDIF Tools
What is LDIF?
LDIF, the LDAP Data Interchange Format, is described in RFC 2849, which means that all LDAP-servers out there (more or less) support it.
It's main purpose is to provide a common format to be used by LDAP servers when synchronizing their data, but you can also use it to import new data from an other source.
Roughly, there are two types of LDIF-files:
- A static "snapshot" of data
- An "update-file", relative to the data already present in a certain server.
OK, now I have an idea of what LDIF is, but how can this program help me?
Imagine you have an LDAP-server containing data that is gotten from another source (an SQL server or something likewise). We can safely assume that the data will not be updated that often, but from time to time (say, once a month or so), you will want to update the LDAP-server to reflect reality again. You could do a few things:
- Create a program that connects to the SQL server and to the LDAP server, compares the data from both sources, and updates where necessary.
This would work, but it's fairly complex, since you'd need to connect to two different servers using two completely different protocols and two completely different storage paradigms. It would be fast, though, since only those entries that have changed will be updated.
- Every time you need to update your server, create a new static "snapshot" LDIF file, and then overwrite your server with the data in there.
This is a Quick and Dirty solution, but it wouldn't work for LDAP servers that are under heavy load, or when your data comes from more than just one data source (since in the latter case, entering data from one source will remove the data from the other)
- create an LDIF-file with only those things that've changed.
This is a better idea, since you'll be using most advantages of both ways to do things. You'll still have one little problem, though: to find out what data needs to be changed, you'll need information about the current state of the LDAP server. To accomplish that, you could keep an old dump-file and compare that to your new, or just create your static LDIF-file anyway and compare it to a new one.
If you choose to do the last option, you've come to the right place: ldifmerge does just that -- it compares two "static" LDIF files, and produces a new file with the update you need to get from the one state to the other. It's also possible to use data from different sources; if you don't want ldifmerge to update certain attributes or entries, you can just supply extra command-line arguments; then ldifmerge will ignore differences in those attributes.
OK, looks good. What else?
Currently, that's it. Nothing else.
However, I'm planning to implement the following:
- a tool to "normalize" LDIF-files so that data looks the same. LdifMerge is able to find and update differences, but some types of data can be written to an LDIF-file in different ways. In such a case, LdifMerge may create an update although it's not necessary. LdifNormalize will make sure all data is represented in the same way, so that this will not happen.
- a tool to sort entries in a LDIF-file
- ... maybe more, if I find something interesting
Never mind, where can I get it?
From the sourceforge project site: http://sf.net/projects/ldiftools/
Copyright © Wouter
Verhelst, 2001
Hosted at SourceForge.