Wednesday, 4 January 2017

Installing Open LDAP on Ubuntu


1. Installing slapd

The OpenLDAP server is in Ubuntu's default repositories under the package "slapd", so we can install it easily with apt-get. We will also install some additional utilities:
(i) Install slapd and other required utilities using the following command

sudo apt-get update
sudo apt-get install slapd ldap-utils
 
(ii) Provide new Admin password when prompted









 




(iii) Confirm the password which will start the installation


 

 

 

 

 

2. Reconfigure slapd

When the installation is complete, we actually need to reconfigure the LDAP package. Type the following to bring up the package configuration tool:
sudo dpkg-reconfigure slapd
We have to reconfigure the slapd by answering the following questions



(i) Omit OpenLDAP server configuration
Navigate to No and press Enter









(ii) DNS domain name
This will create the base structure of your directory path. Read the message to understand how it works.
There are no set rules for how to configure this. If there is an actual domain name on this server, we can use that. Otherwise, use whatever you'd like. 

In this article, we will call it openldap.com 

 








(iii) Organization name

We can choose any name. We will use openldap in this guide.













(iv) Administrator password)


 














Use the password you configured during installation, or choose another one and proceed with <Ok>


(v) Confirm the Password when prompts and proceed with <Ok>








(vi) Database backend to use
Default: Navigate to HDB and proceed with <Ok>. (Please choose options based on your needs)












(vii) Remove the database when slapd is purged
Default: Navigate to No and proceed with <Ok>. (Please choose options based on your needs)












(viii)Move old database

Default: Navigate to Yes and proceed with <Ok>. (Please choose options based on your needs)








(ix) Allow LDAPv2 protocol
Default: Navigate to No and proceed with <Ok> which will complete the reconfiguration. (Please choose options based on your needs)



 

 

3. Install PHPldapadmin

We will be administering LDAP through a web interface called PHPldapadmin. This is available in Ubuntu's default repositories.
Install it with this command:
sudo apt-get install phpldapadmin

4. Configure PHPldapadmin

We need to configure some values within the web interface configuration files before trying it out.
(i) Open the configuration file with root privileges
sudo nano /etc/phpldapadmin/config.php
(ii) Search for the following sections and modify them accordingly.
Change the red value to the way you will be referencing your server, either through domain name or IP address.
$servers->setValue('server','host','domain_name_or_IP_address');
(iii) For the next part, we will need to reflect the same value we gave when asked for the DNS domain name when we reconfigured "slapd".
We have to convert it into a format that LDAP understands by separating each domain component. Domain components are anything that is separated by a dot.
These components are then given as values to the "dc" attribute.
For instance, if your DNS domain name entry was "openldap.com", LDAP would need to see "dc=openldap,dc=com". Edit the following entry to reflect the name.
$servers->setValue('server','base',array('dc=openldap,dc=com'));
(iv) The next value to modify will use the same domain components that we just set up in the last entry. Add these after the "cn=admin" in the entry below:
$servers->setValue('login','bind_id','cn=admin,dc=openldap,dc=com');
(v) Search for the following section about the "hidetemplatewarning" attribute. We want to uncomment this line and set the value to "true" to avoid some annoying warnings that are unimportant.
$config->custom->appearance['hide_template_warning'] = true;
(vi) Save and close the file.

No comments:

Post a Comment