Production-ready OpenLDAP container with TLS, replication, overlays │ and security hardening
507
Production-ready OpenLDAP container with enterprise features.
📖 Documentation | 🐳 Docker Hub
ldap user (UID 55)# Run OpenLDAP with default settings
docker run -d \
--name openldap \
-e LDAP_DOMAIN=example.com \
-e LDAP_ADMIN_PASSWORD=changeme \
-p 389:389 \
-v ldap-data:/var/lib/ldap \
-v ldap-config:/etc/openldap/slapd.d \
vibhuvioio/openldap:latest
# Test connection
ldapsearch -x -H ldap://localhost:389 \
-D "cn=Manager,dc=example,dc=com" \
-w changeme \
-b "dc=example,dc=com"
Registry note: The primary image is hosted on Docker Hub at
vibhuvioio/openldap. The same image is also available on GHCR atghcr.io/vibhuvioio/openldapif you prefer GitHub's registry.
Run a 3-node multi-master replication cluster:
Node 1:
docker run -d \
--name openldap-node1 \
--hostname openldap-node1 \
-e LDAP_DOMAIN=example.com \
-e LDAP_ADMIN_PASSWORD=changeme \
-e ENABLE_REPLICATION=true \
-e SERVER_ID=1 \
-e REPLICATION_PEERS=openldap-node2,openldap-node3 \
-p 389:389 \
-v ldap-data-node1:/var/lib/ldap \
-v ldap-config-node1:/etc/openldap/slapd.d \
--network ldap-network \
vibhuvioio/openldap:latest
Node 2:
docker run -d \
--name openldap-node2 \
--hostname openldap-node2 \
-e LDAP_DOMAIN=example.com \
-e LDAP_ADMIN_PASSWORD=changeme \
-e ENABLE_REPLICATION=true \
-e SERVER_ID=2 \
-e REPLICATION_PEERS=openldap-node1,openldap-node3 \
-p 390:389 \
-v ldap-data-node2:/var/lib/ldap \
-v ldap-config-node2:/etc/openldap/slapd.d \
--network ldap-network \
vibhuvioio/openldap:latest
Node 3:
docker run -d \
--name openldap-node3 \
--hostname openldap-node3 \
-e LDAP_DOMAIN=example.com \
-e LDAP_ADMIN_PASSWORD=changeme \
-e ENABLE_REPLICATION=true \
-e SERVER_ID=3 \
-e REPLICATION_PEERS=openldap-node1,openldap-node2 \
-p 391:389 \
-v ldap-data-node3:/var/lib/ldap \
-v ldap-config-node3:/etc/openldap/slapd.d \
--network ldap-network \
vibhuvioio/openldap:latest
| Variable | Default | Description |
|---|---|---|
LDAP_DOMAIN | example.com | LDAP domain |
LDAP_ADMIN_PASSWORD | admin | Admin password |
LDAP_CONFIG_PASSWORD | config | Config DB password |
ENABLE_REPLICATION | false | Enable multi-master replication |
SERVER_ID | 1 | Server ID (for replication) |
REPLICATION_PEERS | - | Comma-separated peer hostnames |
ENABLE_MEMBEROF | false | Enable memberOf overlay |
ENABLE_PASSWORD_POLICY | false | Enable password policy |
ENABLE_AUDIT_LOG | false | Enable audit logging |
LDAP_TLS_CERT | - | Path to TLS certificate |
LDAP_TLS_KEY | - | Path to TLS key |
LDAP_CONN_MAX_PENDING | 100 | Max pending unauthenticated connections (DoS protection) |
LDAP_CONN_MAX_PENDING_AUTH | 1000 | Max pending authenticated connections |
See the Configuration Guide for the complete reference.
| Path | Purpose |
|---|---|
/var/lib/ldap | Database files |
/etc/openldap/slapd.d | Configuration |
/logs | Log output (slapd.log, audit.log) |
/custom-schema | Custom LDIF schemas |
/docker-entrypoint-initdb.d | Initialization scripts |
The MDB (LMDB) backend is configured with a default maximum database size of 1 GB (olcDbMaxSize: 1073741824). This is the maximum size the database file can grow to.
Important: The MDB database size is fixed at creation time and cannot be changed without reconfiguring the database. Plan your size before loading production data.
services:
openldap:
image: vibhuvioio/openldap:latest
environment:
- LDAP_DOMAIN=example.com
- LDAP_ADMIN_PASSWORD=changeme
- ENABLE_MEMBEROF=true
ports:
- "389:389"
volumes:
- ldap-data:/var/lib/ldap
- ldap-config:/etc/openldap/slapd.d
- ./logs:/logs
volumes:
ldap-data:
ldap-config:
See the OpenLDAP Docker documentation for Kubernetes deployment guides, Helm charts, and production best practices.
This repository includes GitHub Actions workflows for continuous integration and publishing:
| Workflow | Trigger | Description |
|---|---|---|
validate.yml | PR to main | Linting, basic connectivity, security scan |
integration-test.yml | PR to main or develop | Full integration test suite |
docker-publish.yml | Tag push | Build and publish to Docker Hub and GHCR |
The integration test suite validates:
Run them locally from the use-cases/ directory.
environment:
- ENABLE_MEMBEROF=true
Allows queries like: (memberOf=cn=admins,ou=Groups,dc=example,dc=com)
environment:
- ENABLE_AUDIT_LOG=true
volumes:
- ./logs:/logs
View audit trail: docker exec openldap cat /logs/audit.log
environment:
- ENABLE_PASSWORD_POLICY=true
Enforces: min 8 chars, 5 history, lockout after 5 failures
Example deployments for different scenarios:
| Use Case | Description |
|---|---|
docker-secrets | Secure password management using Docker secrets instead of plaintext environment variables |
overlay-features | Integration test for memberOf, password policy, and audit log overlays |
tls-enabled | Integration test for TLS/SSL with StartTLS and LDAPS |
idempotency-test | Integration test for restart idempotency and data persistence |
vibhuvi-com-singlenode | Single-node deployment example |
vibhuvioio-com-singlenode | Alternative single-node configuration |
oiocloud-com-multinode | 3-node multi-master replication cluster |
password-policy-test | Password policy testing environment |
Full documentation is available at vibhuvioio.com/openldap-docker:
| Guide | Description |
|---|---|
| Getting Started | Quick start, first user creation |
| Configuration | Full environment variable reference |
| Replication | Multi-master HA cluster setup |
| Overlays | memberOf, password policy, audit log |
| Security | TLS, ACLs, production hardening |
| Monitoring | cn=Monitor, health checks, backups |
Multi-master replication uses simple bind authentication with the admin password stored in cleartext within the OpenLDAP configuration database (cn=config). Anyone with read access to cn=config can view these credentials.
Mitigation:
MIT License
This project uses automated security scanning:
| Tool | Purpose |
|---|---|
| Trivy | Container vulnerability scanning |
| cosign | Image signing with Sigstore |
| Syft | SBOM generation |
Please report security vulnerabilities by opening a GitHub Issue or emailing [email protected].
Developed by Vibhuvi OiO
Content type
Image
Digest
sha256:62e087cd0…
Size
80.6 MB
Last updated
3 months ago
docker pull vibhuvioio/openldap