In my recent experience, I've set it up several examples that involve the Essential Business Functionsmodule of SAP Leonardo IoT Edge Services.
The usage of this module often requires the authentication of a certain user over an LDAP server.
Since I don't have any pre-cooked LDAP server available, I have decided to create my own server starting from scratch in an Ubuntu 18.04 LTS virtual machine.
I will reuse this server for the Edge Services integrations that I'm going to share in my next blog posts.
Is it an empty machine or do you need to reconfigure an existing LDAP server?
Let's consider that you have already tried to install the LDAP server, or that a partial installation has already been executed; as suggested in many blog posts/questions in several internet portals, the best solution is to reset and purge the slapd and ldap-utils services.
In case you are really starting from scratch, you can skip this step.
sudo apt-get purge slapd ldap-utils
Prepare the machine and install the LDAP server
it's a good practice to set the hostname of the machine properly and define the host address for each IP address associated to the virtual machine.
use the linux command to discover the IPs addresses of the virtual machine:
let's assume that my virtual machine has 2 IP addresses: 188.8.131.52 and 10.251.251.10, for each existing address add it into /etc/hosts with the following command
echo "184.108.40.206 SAAP.user.com" | sudo tee -a /etc/hosts
echo "10.251.214.145 SAAP.user.com" | sudo tee -a /etc/hosts
sudo hostnamectl set-hostname SAAP.user.com
with the above commands, we have set SAAP.user.com as hostname of my virtual machine
Now let's proceed with the installation of the LDAP required software: slapd and ldap-utils
During the installation, you are asked to set up a password, use your favorite password; in this example, we have used Password1.
Now reconfigure the service
sudo dpkg-reconfigure slapd
and use the following details:
Omit initial configuration: No
DNS domain name: user.com
Database type: MDB
Remove db when purged: Yes
Move old database: Yes
Org name: SAAP
I'd like to suggest you install the LDAP Account Manager graphical UI, it's an optional step and not required for the setup of the LDAP server, but especially if you are not an expert with LDAP, it could be useful to navigate the server structure.