A container with openldap installation
  • Dockerfile 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-02-17 09:43:07 -08:00
.gitignore Add .gitignore 2025-02-17 09:43:07 -08:00
container-compose.yml Add Readme and docker file and compose file 2025-01-30 19:43:28 -08:00
Dockerfile Add Readme and docker file and compose file 2025-01-30 19:43:28 -08:00
misc.ldif Add missing schemas, and show how to initialized replicated server 2025-01-31 19:33:57 -08:00
postfix.ldif Add missing schemas, and show how to initialized replicated server 2025-01-31 19:33:57 -08:00
readme.md Add missing schemas, and show how to initialized replicated server 2025-01-31 19:33:57 -08:00
replication.ldif Basic config for replication 2025-01-31 18:12:08 -08:00
samba.ldif Add missing schemas, and show how to initialized replicated server 2025-01-31 19:33:57 -08:00

This container runs openldap. This container assumes that you have a backup of ldap database that you want to load to it.

It is assumed that you are NOT running podman as root here.

At this time the container does not support ldaps.

Create backup of the database

slapcat -n 0 > config.ldif
slapcat -n 1 > data.ldif

Container isolation [optional]

To isolate users for different containers, run it with userns = auto. Note that this requires slapd running as a root inside of the container (and that's how the container is configured)

$ cat ~/.config/containers/containers.conf
[containers]
userns = "auto"

Launch container

podman-compose up --build

Add container to auto start

podman generate systemd --new server_ldap_1 >  ~/.config/systemd/user/server_ldap_1.service

Loading the data after first startup

Open the container's terminal (generally don't do it, this is only require for loading data for the first time and hopefully never again :) ):


$ podman container ls
CONTAINER ID  IMAGE                         COMMAND               CREATED         STATUS             PORTS                     NAMES
29cdd59c65fc  localhost/server_ldap:latest  -h ldap://0.0.0.0...  15 minutes ago  Up 15 minutes ago  0.0.0.0:11389->11389/tcp  server_ldap_1

$ podman exec -it 29cdd59c65fc /bin/sh
slapadd -n 0 -F /etc/openldap/slapd.d -l /data/config.ldif
slapadd -n 1 -F /etc/openldap/slapd.d -l /data/data.ldif

Compatibility issues:

The olcModulePath had to be modified in the config.ldif:

olcModulePath: /usr/lib/openldap

And similarly, data directory needs to be modified as well:

olcDataDirectory: /data

Configure replication (and add the right schema)

slapadd -n 0 -F /etc/openldap/slapd.d -l /data/replication.ldif

Adding the schemas:

slapadd -n 0 -l /etc/openldap/schema/core.ldif
slapadd -n 0 -l /etc/openldap/schema/cosine.ldif
slapadd -n 0 -l /etc/openldap/schema/inetorgperson.ldif
slapadd -n 0 -l /etc/openldap/schema/nis.ldif
slapadd -n 0 -l /data/samba.ldif
slapadd -n 0 -l /data/postfix.ldif
slapadd -n 0 -l /data/misc.ldif