Recently we walked through the process of installing and using OpenLDAP on Ubuntu 18.04. That process isn’t terribly difficult, but using OpenLDAP from the command line to enter LDAP data can be very cumbersome.
Fortunately, there are tools available to make this process considerably easier. One such tool is phpLDAPadmin. This particular web-based front-end for OpenLDAP makes creating entries into the LDAP database as easy as point and click.
And installing phpLDAPadmin is quite simple. Or at least it was. Prior to the release of Ubuntu 18.04, installing this tool was as easy as opening a terminal window and issuing the command:
sudo apt-get install phpldapadmin
SEE: Power checklist: Managing and troubleshooting Linux user accounts (Tech Pro Research)
However, there’s a problem. With the latest release of Ubuntu Server, PHP was upgraded to 7.2. Because of this, there are a number of deprecation issues found in phpLDAPadmin, so installing from the standard repositories won’t work. Thankfully, a developer took care of the issues plaguing the latest release of phpLDAPadmin and PHP 7.2 and made it possible to install this front-end.
I’m going to show you how to install the workaround, created by GitHub user breisig. It’s quite easy to do and only requires you already have OpenLDAP installed and working on your Ubuntu Server 18.04 platform.
Outside of having OpenLDAP running on your Ubuntu Server 18.04 platform, you will also need to install git. This is done with the command:
sudo apt-get install git
Once you have that requirement out of the way, you’re ready to go.
Back at the terminal window, change into the document root of your web server with the command cd /var/www/html. Next, clone phpLDAPadmin with the command:
sudo git clone https://github.com/breisig/phpLDAPadmin.git
To make things slightly easier, let’s rename that directory with the command:
sudo mv /var/www/html/phpLDAPadmin /var/www/html/phpldapadmin
The final step in the installation is to copy the configuration file. Change into the config directory with the command cd /var/www/html/phpldapadmin/config and then copy the file with the command:
sudo cp config.php.example config.php
You could now point your browser to http://SERVER_IP/phpldapadmin and start using the tool. However, there’s a couple of configuration options to be taken care of.
Issue the command sudo nano /var/www/html/phpldapadmin/config/config.php. In this file you’ll want to take care of the following configuration options:
To prevent any possible security issues with the phpLDAPadmin server address, change the following:
where SERVER_IP is the address of the OpenLDAP server.
The next configurations are as follows.
Around line 300, change the following:
Note: You will change example and com to whatever domain you used in setting up OpenLDAP.
Go to (approximately) line 335 and change:
Around line 453, change the line:
That’s all there is to the configuration options. Save and close the file.
You can now point your browser to http://SERVER_IP/phpldapadmin (where SERVER_IP is the IP address of your hosting server). You will see the login screen, at which point you will enter cn=admin,dc=example,dc=com as the username and the password you created when installing OpenLDAP. If you used a different domain than example.com, you would replace those entries in the username to fit your needs.
Once properly authenticated, you should see the phpLDAPadmin screen, where you can start entering data to your OpenLDAP server (Figure A).
Easy path to LDAP data entry
You now have a much easier path to LDAP data entry. Thanks to this handy fix for phpLDAPadmin, you are no longer bound to the command line for entering information on OpenLDAP with Ubuntu Server 18.04.