Sitemap
Kenza el marchouk

Kenza el marchouk

I am a cybersecurity engineer (Pentesting, IAM)

OpenLDAP: Overview and Installation Guide

3 min readOct 13, 2023

--

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).

Press enter or click to view image in full size

Implementation

  1. Windows: Active Directory
  2. Linux: OpenLDAP, RedHat Directory Studio

Installation

  1. Update your package list
sudo apt update

2. Install the OpenLDAP server

sudo apt install slapd

3.Install OpenLDAP client

sudo apt install ldap-utils

4. Start OpenLDAP server

service slapd start

5. Check its status

sudo systemctl status slapd
Press enter or click to view image in full size

In 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

Press enter or click to view image in full size

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:

  1. 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.ldif

Add 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: mdupond

2. 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" 
Press enter or click to view image in full size

--

--

Kenza el marchouk
Kenza el marchouk