OpenLDAP
Installation
For installation of OpenLDAP use this link as a reference:
http://www.unixmen.com/install-and-configure-openldap-in-ubuntu-15-04-and-debian-8/
Walking through the process, install OpenLDAP and utilities:
# aptitude install slapd ldap-utils
Note, it appears that /etc/ldap/ldap.conf
is no longer required (as of package shipped with Ubuntu 15.10)
Re-configure
To set up your system defaults, do the following.
# dpkg-reconfigure slapd
-
No
-
hillnet.localnet
-
hillnet
-
admin password
-
yes or no
# You decide -
yes
-
yes or no
# Selectyes
to allow backward compatibility
At completion, review syslog:
# cat /var/log/syslog | grep slap
/etc/ldap/slapd.d/cn=config.ldif file
, as follows:
ldif_read_file: checksum error on "/etc/ldap/slapd.d/cn=config.ldif"
Stop the service
# systemctl stop slapd
# cd /tmp
# slapcat -n0 -F /etc/ldap/slapd.d > config.ldif
# mv /etc/ldap/slapd.d /etc/ldap/slapd.d.org
# mkdir /etc/ldap/slapd.d
# slapadd -n0 -F /etc/ldap/slapd.d -l config.ldif
/etc/ldap/slapd.d
directory
Then fix the ownership of the new directory and its contents:
# chown -R openldap:openldap /etc/ldap/slapd.d
Start the service
# systemctl start slapd
# cat /var/log/syslog | grep slap
/etc/ldap/slapd.d.org
directory
# rm -r /etc/ldap/slapd.d.org
...slapd[24858]: <= mdb_substring_candidates: (cn) not indexed
...slapd[24858]: <= mdb_substring_candidates: (uid) not indexed
...slapd[24858]: <= mdb_substring_candidates: (mail) not indexed
/tmp/new_index.ldif
file
Refer https://wiki.debian.org/LDAP/OpenLDAPSetup
Replace mdb with whatever db was selected on package reconfigure (hdb, bdb, mdb)
dn: olcDatabase={1}mdb,cn=config
changetype: modify
replace: olcDbIndex
olcDbIndex: cn pres,sub,eq
-
add: olcDbIndex
olcDbIndex: sn pres,sub,eq
-
add: olcDbIndex
olcDbIndex: displayName pres,sub,eq
-
add: olcDbIndex
olcDbIndex: default sub
-
add: olcDbIndex
olcDbIndex: mail,givenName eq,subinitial
-
add: olcDbIndex
olcDbIndex: dc eq
-
add: olcDbIndex
olcDbIndex: objectClass pres,eq
# ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f /tmp/new_index.ldif
Backup and Restore
To backup the data in your ldap installation do:
# systemctl stop slapd
# slapcat -l /opt/backup/ldapbup.ldif
# systemctl start slapd
Stop the service
# systemctl stop slapd`
dn: dc=hillnet,dc=localnet
more text
dn: cn=admin,dc=hillnet,dc=localnet
more text
The run,
# slapadd -F /etc/ldap/slapd.d -l /opt/backup/ldapbup.ldif
# systemctl start slapd
Last update: April 1, 2021