You are here
Christoph Knittel - Tue, 2014/01/21 - 18:52
Hi all,
I just discovered that, in the OpenLDAP appliance, the ldap database (located in /var/lib/ldap) is not backed up by tklbam.
I consider this a hazard, as I would definitely expect an OpenLDAP appliance to back up its ldap database by default.
Adding /var/lib/ldap to /etc/tklbam/overrides fixes the problem, but I am not sure whether it is ok to backup the DB while slapd is running.
Christoph
Forum:
A TKLBAM simulation will show what will be backed up
If you use the '-s' switch (for simulate) it will show you everything that will be backed up...
If you have some suggestions on what should be being backed up but isn't please feel free to detail it.
In the meantime I found that
In the meantime I found that it is definitely not ok to backup or restore /var/lib/ldap without shutting down slapd first.
Therefore I added a tklbam hook /etc/tklbam/hooks.d/ldap as follows:
Nice work
Thanks for posting this. Sounds like it should be included in the TKLBAM OpenLDAP profile.
Also I have just raised a bug on the TKL Isue Tracker.
slapcat/slapadd
Howard, thanks for the hint! Unfortunately I am not an expert on OpenLDAP or BerkeleyDB.
In the OpenLDAP admin guide, it says
19.4. Migration
The simplest steps needed to migrate between versions or upgrade, depending on your deployment type are:
So I guess
Do you have any sample backup/restore scripts based on slapcat/slapadd and covering all the dbs?
Sample scripts
The LDAP schema's and index definitions are normally restored because they are stored in "/etc/ldap/slapd.d/" (and below).
To backup the LDAP data fields I use the (modified example) script "/etc/tklbam/hooks.d/ldap" (Note: /root/ldap/backup.ldif wil be normally backuped and restored):
I manually restore the LDAP data fields because a clean appliance doesn't have the ldap hook script with the following script:
Regards
Updated scripts
Thanks to point this out, I have changed the scripts as follows and it works great.
Hook:
Restore
Great work guys :)
I have added additional notes to the bug report referring back to this thread.
Thanks a lot!
Hi guys,
Thanks a lot for your work! I would have looked into this myself after Howard's comments, but didn't find the time. I will test the latest version of Eric's scripts and let you know my findings.
Christoph
Some results
Using my scripts I discover that the first time I make a backup the config.ldif and data.ldif files doesn't appear in the backup! In following backup's they are in the backup.
This means, to my opinion, that the check of files to be backuped is done before calling the hook scripts. I don't know where to change the order.
New script version
I can confirm the issue that Eric mentions above. It can be resolved by performing the backup in the operation=backup / state=pre phase.
Also, in Eric's script, an error would occur if the backup directory didn't exist yet.
Here is my latest version of the script with backup and restore working perfectly for me: :-)
It works!
I can confirm that the script above works, thanks Christoph.
I have noticed errors from the "libnss-ldapd" package during backup, so I stop/start also the "nslcd" service.
Another point I found is that during "--simulate" of tklbam-backup and tklbam-restore the script is normally executed :-( Is it possible that the script is aware of the "--simulate" option?
Added this hook to the OpenLDAP TKLBAM profiles
I monkey patched the TKLBAM profiles for OpenLDAP that live on the Hub to include this hook so that that slapd migration happens out of the box and you don't need to install hooks to /etc/tklbam/hooks.d
It's been possible to do this since TKLBAM v1.4. From the RelNotes-1.4:
Redmine was the first and only use case up until now. Thanks for helping me add a second one!So that I don't have to monkey patch tklbam profiles for future versions I added the final version of the hook by Christoph to tklbam-profiles:
https://github.com/turnkeylinux/tklbam-profiles/commit/d12462fa18d2f721a...
Great work Liraz
I just closed the issue on the tracker.
Awesome!
Thanks a lot!
I just retested backup and restore to a new cloud server without my script present in /etc/tklbam/hooks.d, and everything worked fine. :-)
Excellent!
Great news! Thanks for the confirmation. :)
Add new comment