208Backup - amagerard/FreeRadius GitHub Wiki

HOME

RedHat/OpenLdap

01 Synoptic 02 Network 03 Openldap 04 PhpLdapAdmin
05 Selinux 06 GnomeShell 07 Troubleshoots 08 Backup
FreeRadius DaloRadius ADserver

8. Backup

8.1 Block the update.

OpenLDAP updates prevent the start of slapd.
I advise to clone your virtual machine before updating.
It is possible to block the PHPLDAPADMIN and OPENLDAP update.
vi /etc/dnf/dnf.conf
Add the line.

exclude=phpldapadmin openldap*  

8.2 Keep the directory.

The 2 directories to keep are:

  • /etc/openldap
  • LDAP folder to find.

Add a directory for backup.
mkdir /root/backup

Find the LDAP folder.
grep olcDbDirectory /etc/openldap/slapd.d/cn=config/olcDatabase={2}mdb.ldif

/var/lib/ldap  

Stop the slapd service.
systemctl stop slapd

cd /etc
tar --acls -cvzf /root/backup/openldap.tar openldap

cd /var/lib
tar --acls -cvzf /root/backup/ldap.tar ldap

The packages to be preserved.
dnf install yum-utils
yumdownloader phpldapadmin openldap openldap-compat openldap-servers openldap-clients --destdir /root/backup

8.3 slapcat

http://www.jouvinio.net/wiki/index.php/Administration_OpenLDAP
I sincerely I have not tested a restoration.

8.3.1 Backup.

systemctl stop slapd  
slapcat -n 0 > /root/backup/config.ldif  
slapcat -n 2 > /root/backup/users.ldif  
systemctl start  slapd  

The first use of the SLAPCAT utility makes it possible to save the "database" to index 0,
corresponding to the structure of the server. Then users are exported.
This second instruction must be performed on the basic assembly,
modifying the index number in the argument -n.

8.3.2 Restore.

systemctl stop slapd  
slapadd -n 0 -l /root/backup/config.ldif  
slapadd -n 2 -l /root/backup/users.ldif  
systemctl  start  slapd  

The first use of the slapadd utility allows the server structure to be restored.
Then users are restored.