How To Install and Configure OpenLDAP and PhpLDAPAdmin on AWS Ec2 Ubuntu Server

Introduction

LDAP is a good way to manage users and set-up the limited-privilege. LDAP is Lightweight Directory Access Protocol. You can find full information in the wikipedia. People can easily set-up LDAP on the Windows server. However, you have to pay licence fee for windows machine. So, we have another choice — OpenLDAP. For management LDAP we can use an open source software — PhpLDAPAdmin, which based on PHP and web. This means that you can use browser to manage your LDAP.

In this guide, we will install OpenLDAP and PhpLDAPAdmin on the EC2 Ubuntu server.

Launch Ec2 Instance

Launch a Ec2 Ubuntu instance, and open HTTP (TCP/80), SSH (TCP/22), and LDAP (TCP/389) port.

Install OpenLDAP

First, Update your package storehouse, then install ldap package.


$ sudo apt-get update
$ sudo apt-get install slapd ldap-utils

When you install, it will ask you input LDAP password.

Set the password for install OpenLDAP

Re-configure OpenLDAP

After installation, it will use default profile to set-up your LDAP. So, you need to re-configure your OpenLDAP.

$ sudo dpkg-reconfigure slapd

It will ask several questions.
1. Omit OpenLDAP server configuration? – No.
2. DNS domain name. – Set-up your domain name, like: ad.spz.io
3. Organization name. – Set-up your organization name, like: SpZ
4. Administrator password. – Set-up your administrator password. it is same with when you set-up before.
5. Database backend to use. – Choose HDB
6. Removed when slapd is purged? – No.
7. Move old database? – Yes.
8. Allow LDAPv2 protocol? – No.

Then, you finish OpenLDAP installation.

Install PhpLDAPAdmin

Thirdly, you need to install PhpLDAP Admin. It will automatically install php, apache web and PhpLDAPAdmin.
$ sudo apt-get install phpldapadmin

Edit PhpLDAPAdmin profile

$ sudo vim /etc/phpldapadmin/config.php

You need to change 4 lines.
1. Change 127.0.0.1 to your Ubuntu server’s IP.

$servers->setValue('server','host','127.0.0.1');

2.Change “dc=test,dc=com” to your domain that you set before.

$servers->Value('server','base',array('dc=test,dc=com'));

3.Change “dc=test,dc=com” to your domain that you set before.

$servers->setValue('login','bind_id','cn=admin,dc=test,dc=com');

4.Hide warning
$config->custom->appearance['hide_template_warning'] = true;

Open: Ec2-IP/phpldapadmin/
The graphic page for phpldapadmin

All Done! If you have any questions, please let me know.

2 Comments How To Install and Configure OpenLDAP and PhpLDAPAdmin on AWS Ec2 Ubuntu Server

Leave a Reply

Your email address will not be published. Required fields are marked *