Deployment guide

OpenLDAP

Overview

OpenLDAP is the widely deployed open-source implementation of the Lightweight Directory Access Protocol (LDAP). Its standalone daemon, slapd, stores users, groups and organisational data in a hierarchical directory and answers standard LDAP queries. Your applications, operating systems and network services can then share one authoritative identity source instead of keeping a separate account store for each.

The SecureAnyCloud image installs OpenLDAP 2.6.10 from the Ubuntu 24.04 main repository and seeds a usable directory tree. It enables LDAP over TLS (LDAPS), stores the directory database on a dedicated Azure data disk, and generates a unique administrator password on first boot. It is backed by 24/7 SecureAnyCloud support.

What you get:

  • OpenLDAP 2.6.10 (slapd and ldap-utils) with the fast memory-mapped mdb backend.
  • The directory database (data.mdb) on a dedicated 20 GiB Azure data disk at /var/lib/ldap.
  • A seeded base directory dc=example,dc=com with ou=people, ou=groups and a demo inetOrgPerson, so queries return data out of the box.
  • A unique per-VM administrator password generated on first boot, with no shared default credential.
  • LDAP on 389 (with StartTLS) and LDAPS on 636, with a self-signed TLS certificate regenerated per VM on first boot.
  • Anonymous writes refused by default. The administrator binds as cn=admin,dc=example,dc=com.

Prerequisites

  • An active Azure subscription, an SSH key pair, and a VNet with a subnet in the target region.
  • Standard_B2s (2 vCPU, 4 GiB RAM) is a good starting point.
  • Network security group inbound rules: allow 22/tcp from your management network. Open 636/tcp (LDAPS), 389/tcp (LDAP with StartTLS), or both, only to the private networks that host the services that bind to the directory.
  • Never expose the plain LDAP port to the internet without transport encryption.

Step 1 - Deploy from the Azure Marketplace

Sign in to the Azure portal, choose Create a resource, search the Marketplace for OpenLDAP by SecureAnyCloud, and select Create.

On the Basics tab, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22). After deployment, add port 636 (and optionally 389) scoped to your VNet. Then choose Review + create, and then Create.

Step 2 - Deploy from the Azure CLI

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:openldap-ubuntu-24-04:default:latest
az vm create \
  --resource-group <your-rg> \
  --name openldap \
  --image sac1647283583153:openldap-ubuntu-24-04:default:latest \
  --size Standard_B2s \
  --admin-username azureuser \
  --ssh-key-values ~/.ssh/id_ed25519.pub \
  --vnet-name <your-vnet> --subnet <your-subnet> \
  --public-ip-sku Standard

Step 3 - Connect to your VM

ssh azureuser@<vm-public-ip>

Step 4 - Confirm OpenLDAP is installed and running

slapd runs as the slapd.service systemd unit and listens for LDAP on 389 and LDAPS on 636. Check the version, the service state, the listeners and the dedicated data disk:

slapd -VV 2>&1 | head -1 systemctl is-active slapd ss -tln | grep -E ':389 |:636 ' | awk '{print $1, $4}' findmnt -no SOURCE,TARGET,FSTYPE /var/lib/ldap

The output shows OpenLDAP 2.6.10, the active state, listeners on 389 and 636, and the directory database on the dedicated data disk:

@(#) $OpenLDAP: slapd 2.6.10+dfsg-0ubuntu0.24.04.1 (Sep 23 2025 16:26:39) $ active LISTEN 0.0.0.0:389 LISTEN 0.0.0.0:636 /dev/sdc /var/lib/ldap ext4

Step 5 - Retrieve your per-VM admin password

Each VM generates its own unique directory administrator password on first boot and writes it to a root-only credentials file:

sudo cat /root/openldap-credentials.txt
OPENLDAP_ADMIN_DN=cn=admin,dc=example,dc=com OPENLDAP_ADMIN_PASSWORD=<set-at-first-boot> openldap.base_dn=dc=example,dc=com openldap.ldap_uri=ldap://10.0.0.6:389 openldap.ldaps_uri=ldaps://10.0.0.6:636

The file contains OPENLDAP_ADMIN_PASSWORD, the bind DN cn=admin,dc=example,dc=com, the base DN dc=example,dc=com and the resolved ldap:// and ldaps:// URIs. Store the password in your secrets manager.

In the commands below, <OPENLDAP_ADMIN_PASSWORD> stands for the value of OPENLDAP_ADMIN_PASSWORD.

Step 6 - Run an anonymous rootDSE query

OpenLDAP permits an anonymous read of the rootDSE, so clients can discover the server's naming contexts and capabilities without credentials:

ldapsearch -x -LLL -H ldap://127.0.0.1 -s base -b '' namingContexts supportedLDAPVersion
dn: namingContexts: dc=example,dc=com supportedLDAPVersion: 3

dc=example,dc=com is the seeded base directory.

Step 7 - Search the seeded directory tree

Bind as the administrator and list the seeded directory tree under dc=example,dc=com:

ldapsearch -x -LLL -H ldap://127.0.0.1 \
  -D 'cn=admin,dc=example,dc=com' -w '<OPENLDAP_ADMIN_PASSWORD>' \
  -b 'dc=example,dc=com' '(objectclass=*)' dn
dn: dc=example,dc=com dn: ou=people,dc=example,dc=com dn: ou=groups,dc=example,dc=com dn: uid=demo,ou=people,dc=example,dc=com

Step 8 - Authenticated search for user attributes

Filter for the seeded inetOrgPerson entries and return selected attributes. The result proves the authenticated bind and the directory data:

ldapsearch -x -LLL -H ldap://127.0.0.1 \
  -D 'cn=admin,dc=example,dc=com' -w '<OPENLDAP_ADMIN_PASSWORD>' \
  -b 'dc=example,dc=com' '(objectclass=inetOrgPerson)' cn sn mail uid
dn: uid=demo,ou=people,dc=example,dc=com uid: demo cn: Demo User sn: User mail: demo@example.com

Step 9 - Bind securely over LDAPS (TLS)

The image enables LDAPS on port 636 with a self-signed certificate that is regenerated uniquely on each VM's first boot. Confirm an authenticated bind over TLS with ldapwhoami. Because the certificate is self-signed, an LDAP client must either trust it or skip verification, so this test sets LDAPTLS_REQCERT=never:

LDAPTLS_REQCERT=never ldapwhoami -x -H ldaps://127.0.0.1:636 \
  -D 'cn=admin,dc=example,dc=com' -w '<OPENLDAP_ADMIN_PASSWORD>'
dn:cn=admin,dc=example,dc=com

For production, replace the self-signed certificate under /etc/ldap/certs/ with one issued by your own certificate authority (CA). Distribute the CA certificate to your LDAP clients so they can verify the connection.

Step 10 - Add your own entry

Add a new user with ldapadd. Create an LDIF file and import it, replacing the example password with your own:

cat > /tmp/alice.ldif <<'LDIF' dn: uid=alice,ou=people,dc=example,dc=com objectClass: inetOrgPerson cn: Alice Anderson sn: Anderson uid: alice mail: alice@example.com LDIF ldapadd -x -H ldap://127.0.0.1 \
  -D 'cn=admin,dc=example,dc=com' -w '<OPENLDAP_ADMIN_PASSWORD>' -f /tmp/alice.ldif

Remove the entry again with ldapdelete:

ldapdelete -x -H ldap://127.0.0.1 \
  -D 'cn=admin,dc=example,dc=com' -w '<OPENLDAP_ADMIN_PASSWORD>' \
  'uid=alice,ou=people,dc=example,dc=com'

Step 11 - Confirm authentication is enforced

A wrong administrator password is rejected with LDAP result code 49 (Invalid credentials), so the directory is never readable with a bad credential. The command below is expected to fail by design:

$ ldapsearch -x -H ldap://127.0.0.1 \
  -D 'cn=admin,dc=example,dc=com' -w WRONG-PASSWORD \
  -b 'dc=example,dc=com' '(objectclass=*)' ldap_bind: Invalid credentials (49)

The bind fails immediately with result: 49, which confirms that authentication is enforced before any directory data is returned. Anonymous writes are refused for the same reason.

Step 12 - Point your services at the directory

Applications that support LDAP authentication, such as Nextcloud, Grafana, Gitea and Jellyfin, can bind to this directory. Configure them with these settings:

  • Host / URI: ldaps://<vm-private-ip>:636 (preferred), or ldap://<vm-private-ip>:389 with StartTLS.
  • Base DN: dc=example,dc=com.
  • Bind DN: a dedicated read-only service account that you create under ou=people,dc=example,dc=com. Do not use the administrator for application binds.
  • User search base: ou=people,dc=example,dc=com.

Open 636/tcp (and optionally 389/tcp) on the VM's network security group only to the private networks that host those services. Keep the directory off the public internet.

Maintenance

  • Persistence: the directory database (data.mdb) lives on the dedicated data disk at /var/lib/ldap. The directory survives reboots, and you can resize the volume independently.
  • Admin password: the per-VM password is generated once at first boot. To rotate it later, replace olcRootPW on olcDatabase={1}mdb,cn=config with ldapmodify -Y EXTERNAL -H ldapi:///, using a fresh slappasswd hash.
  • Service control: sudo systemctl restart slapd restarts the directory, and journalctl -u slapd shows the logs.
  • TLS: the shipped certificate is self-signed and unique to each VM. For production, install a CA-issued certificate under /etc/ldap/certs/ and update the olcTLSCertificateFile and olcTLSCertificateKeyFile settings.
  • Security patches: unattended-upgrades stays enabled, so the OS continues to receive security updates automatically.
  • Compatibility: slapd is a standard LDAP v3 server. Existing LDAP clients, libraries and tooling work unchanged against ports 389 and 636.

Support

SecureAnyCloud provides 24/7 expert support for this image. Contact sales@secureanycloud.com.

OpenLDAP is a registered trademark of the OpenLDAP Foundation. This image is provided by SecureAnyCloud and is not affiliated with or endorsed by the OpenLDAP Foundation.

Deploy on Azure

Launch OpenLDAP on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure