LDAP Restoration Steps

LDAP server 192.168.2.2: Backup

sudo /etc/init.d/slapd stop

sudo slapcat -n 0 -l slapd_config.ldif

sudo slapcat -n 1 -l slapd_data.ldif

sudo /etc/init.d/slapd start

Daily backup of these two files is automated on SVN

http://192.168.2.4/G-Cube_IT/License & Hardware/Backups/LDAP_Backup

Move these two files in shared drive (//192.168.2.128/Data_Transfer/Mavi/ldap)

And rename these files as config.ldif and data.ldif

Backup LDAP VM Server 192.168.2.23

VM is saved on cloud storage as well

Steps:

  • Install Oracle VM in any system.
  • Download VM vdi file (LDAP.VDI), configuration file config.ldif and data.ldif from SVN or Cloud.
  • Create a VM in oracle VM application according to the requirements and add the vdi file downloaded from backup.
  • Start the VM and login.

Commands: Stop Services

sudo /etc/init.d/slapd stop

Edit the below file at line 300 and 326 replace the content as below.

sudo vim /etc/phpldapadmin/config.php


$servers->setValue('server','base',array('dc=gc-solutions,dc=net'));

$servers->setValue('login','bind_id','cn=admin,dc=gc-solutions,dc=net');


Remove files form /etc/ldap.slapd.d


cd /etc/ldap/slapd.d/

sudo rm -rvf cn\=config cn\=config.ldif


Mount shared drive

sudo mount -t cifs //192.168.2.128/Data_Transfer/Mavi /mnt/ -o username=user,password=user,rw


Goto shared drive

cd /mnt/ldap


Now Run command as below

sudo slapadd -n 0 -F /etc/ldap/slapd.d -l config.ldif

sudo slapadd -n 1 -l data.ldif

Change ownership and permission of files

sudo chmod -R 755 /etc/ldap/slapd.d

sudo chown -R openldap:openldap /etc/ldap/slapd.d

sudo chmod -R 755 /var/lib/ldap

sudo chown -R openldap:openldap /var/lib/ldap

sudo /etc/init.d/slapd start

Now change ip address of the VM (192.168.2.2) and restart the system. It’s done.