Installing openLDAP on ubuntu 18.04
Install OpenLDAP with phpLDAPAdmin on ubuntu
configure open ldap with phpldapadmin UI on ubuntu 18.04
OpenLDAP is an open-source and fast directory server that provides network client with directory services. Client applications connect to OpenLDAP server using the Lightweight Directory Access Protocol (LDAP) to access organizational information stored on that server. Given the appropriate access, clients can search the directory, modify and manipulate records in the directory
Note : This article is also published on my personal blog. (https://dineshkumarkb.com/tech/install-openldap-with-phpldapadmin-on-ubuntu/)
Step1 — Install slapd — Stand alone LDAP daemon
$sudo apt-get update
$sudo apt-get install slapd ldap-utils
You will prompted for admin password during installation.Please enter one and remember the same. Then slapd will be installed automatically.
Step2 — Validate the slapd status
systemctl status slapd
Step3 — Configure the openLDAP server post installation
sudo dpkg-reconfigure slapd
A series of questions will be prompted. Please select the options as provided below
1.Omit openLDAP configuration? No
2.DNS domain name. Enter the domain name. This domain name will be used to create a root dn(Distinguished name) for your openLDAP server.Example testldap.com. Your dn will be dc=testldap,dc=com.
3.Organization name : Enter your organization name
4.Administrator password. Set the same administrator password which we did in step 1.
5.DataBase : BDB is deprecated.MDB’s read/write capacity is relatively faster.So we choose MDB
6.Do you want to remove the Database during purge? No
7.Move old DataBase? Yes
Now your openLDAP will be configured and ready to use.
Output:Backing up /etc/ldap/slapd.d in /var/backups/slapd-2.4.45+dfsg-1ubuntu1.5... done.
Moving old database directory to /var/backups:
- directory unknown... done.
Creating initial configuration... done.
Creating LDAP directory... done.
Step4 — Configure LDAP clients
sudo nano /etc/ldap/ldap.conf
Specify the base dn and URI of the openLDAP server that we configured
BASE dc=testldap,dc=com
URI ldap://localhost
Step5 — Testing the server
ldapsearch -x
Output:
ldapsearch -x
# extended LDIF
#
# LDAPv3
# base <dc=testldap,dc=com> (default) with scope subtree
# filter: (objectclass=*)
# requesting: ALL
## testldap.com
dn: dc=testldap,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: TestLdap
dc: testldap# admin, testldap.com
dn: cn=admin,dc=testldap,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator# search result
search: 2
result: 0 Success# numResponses: 12
# numEntries: 11
Step6 — Installing phpldapadmin
sudo apt install phpldapadmin
Configure phpldapadmin
sudo nano /etc/phpldapadmin/config.php
Set your time zone accordingly.
# $config->custom->appearance['timezone'] = 'Asia/Kolkata';
Set the server name, Provide your ip address and set the hide template warning to true.
$servers->setValue('server','name','TestLdap LDAP Server');
$servers->setValue('server','host','192.168.1.3');
$config->custom->appearance['hide_template_warning'] = true;
By default, anonymous login is enabled. To disable it, you need to remove the comment character (the two slashes) and change true to false.Save and close the file.
$servers->setValue('login','anon_bind',false);
Login to your phpldapadmin UI. Ex 192.168.1.3:389
References: