OpenLDAP: Overview and Installation Guide
OpenLDAP (Open Lightweight Directory Access Protocol): A protocol that allows access to a centralized directory.
It facilitates the search for information within this directory.
An LDAP directory is a hierarchical structure in the form of a tree called a DIT (Directory Information Tree), composed of sets of attributes with a unique identifier called a DN (Distinguished Name).
Implementation
- Windows: Active Directory
- Linux: OpenLDAP, RedHat Directory Studio
Installation
- Update your package list
sudo apt update2. Install the OpenLDAP server
sudo apt install slapd3.Install OpenLDAP client
sudo apt install ldap-utils4. Start OpenLDAP server
service slapd start5. Check its status
sudo systemctl status slapdIn Kali Linux, the OpenLDAP configuration files are typically located in the /etc/ldap/directory.
LDAP server configuration
sudo dpkg-reconfigure slapd Select No to configure the server
Next, provide: DNS Name Organization Name Administrator Password
Get Kenza el marchouk’s stories in your inbox
Join Medium for free to get updates from this writer.
Example:
- Create a Hierarchical Structure
Start by creating the basic hierarchical structure of the schema below to store information about people. Therefore, create the file struc.ldif to define the structure.
nano struc.ldifAdd this content:
dn: ou=Person,dc=kenza,dc=com
objectclass: organizationalUnit
ou: Person
description: Employies
dn: ou=Machine,dc=kenza,dc=com
objectclass: organizationalUnit
ou: Machine
description: Computers of the company
dn: cn=Kenza Kenza,ou=Person,dc=kenza,dc=com
objectClass: inetOrgPerson
givenName: Kenza
sn: Kenza
cn: Kenza Kenza
uid: mdupond
userPassword: mdupond2. Add Entries
Use ldapadd to add this hierarchical structure to your LDAP server
ldapadd -x -D cn=admin,dc=kenza,dc=com -W -f struc.ldif 3. Search for Entries
Use the ldapsearch command to search for the entries you have added. For example, to search for all users
ldapsearch -x -D cn=admin,dc=kenza,dc=com -W -b ou=Person,dc=kenza,dc=com "objectClass=inetOrgPerson" 







