OpenLDAP Installation

OpenLDAP is an open source implementation of the Lightweight Directory Access Protocol.

OpenLDAP Installation
http://www.openldap.org/doc/admin24/quickstart.html
Download the latest OpenLDAP version (2.4.42 at time of writing) and extract the tarball:

cd /extra/src
wget http://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-2.4.42.tgz
tar zxf openldap-2.4.42.tgz
cd openldap-2.4.42

Configure it:

./configure

Once you've successfully configured, build and install the programs:

make depend
make
make test
make install

Configuring slapd
Rather than using a plaintext password for rootpw, run /usr/local/sbin/slappasswd to generate a hashed password for use in slapd.conf.
Edit the installed slapd configuration file, /usr/local/etc/openldap/slapd.conf and give a basic MDB database configuration. (Replace "example" with your domain name.)

database mdb
suffix "dc=example,dc=com"
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
directory /usr/local/var/openldap-data
maxsize 1073741824

Test startup of the config:

/usr/local/libexec/slapd -d 256

The DB_CONFIG file contains options that are used to optimize the database that is used to store the openldap directory. There is a DB_CONFIG.example file in the /usr/local/var/openldap-data/ that can be used as a base for the DB_CONFIG file.

cd /usr/local/var/openldap-data/
cp DB_CONFIG.example DB_CONFIG

We'll create a test entry to confirm that we can modify the directory. Create a file called ~/test.ldif and put the following in it, substituting your own values as needed:

dn: dc=example,dc=com
objectclass: dcObject
objectclass: organization
o: <Organization Name>
dc: example
dn: cn=Manager,dc=example,dc=com
objectclass: organizationalRole
cn: Manager

Add the contents of the LDIF file to the LDAP server:

ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f ~/test.ldif

Check that the info was put in:

ldapsearch -x -b 'dc=example,dc=com' '(objectclass=*)'
<code>
<strong>Automatic Startup</strong>
Assuming daemontools has already been <A HREF="/guides/qmail-server/daemontools">installed</A>, create a directory for the slapd service:
<code>
cd /var/service
mkdir -m 1755 slapd
cd slapd

Create the run script, /var/service/slapd/run with the following contents:

#!/bin/sh
# daemontools run script for slapd service
# ** "foreground" version **
exec 2>&1
echo "*** Starting slapd..."
exec \
  /usr/local/libexec/slapd \
  -d 256 \
  -f /usr/local/etc/openldap/slapd.conf

Make the script executable then set up the logging service:

chmod 755 run
mkdir -m 755 log
cd log
wget http://qmail.jms1.net/scripts/run.log
mv run.log run
chmod 755 run

Create a symbolic link in /service to start the service:

ln -s /var/service/slapd /service/

After about 10 seconds, confirm that the service is running;

svstat /service/slapd

Recent Updates

  • 8 months 2 weeks ago
    1.27.2 update
  • 8 months 4 weeks ago
    Drupal 10/11 config
  • 8 months 4 weeks ago
  • PHP
    8 months 4 weeks ago
    PHP 8.3.11 and AlmaLinux
  • 9 months 9 hours ago
    New version of Pound