configurable container running LDAP
Go to file
2025-09-15 12:04:01 -04:00
dockerfile base ldapdock dockerfile 2025-09-12 09:12:45 -04:00
README.md Update README.md 2025-09-15 12:04:01 -04:00

ldapdock

a configurable container running openLDAP

steps to run the openLDAP server on an systemd-less image container, optional steps are marked with conditional

build ldapdock

> docker build -t ldapdock /path/to/dockerfile

conditionalafter build, check the docker image has been created properly with the given REPOSITORY name

> docker images
REPOSITORY    TAG       IMAGE ID       CREATED       SIZE
ldapdock      latest    0e4a1521b346   6 hours ago   138MB

run into the container setting up the LDAP server and the hostname

> docker run -h example.com -i -t ldapdock /bin/bash

Inside the ldapdock image

start the openLDAP daemon server

> service slapd start
 * Starting OpenLDAP slapd                        [ OK ]

conditional edit base configuration of openLDAP server

> vim /etc/ldap/ldap.conf

create a password for openLDAP root user

> slappasswd
New password:
Re-enter new password:
{SSHA}hashpwd

Base administrative Tasks for openLDAP

create a file setting up our default rootDN and our hostname (change dc=example,dc=com as needed)

> vim change_root.ldif
dn: olcDatabase={1}mdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=admin,dc=example,dc=com

now save this changes in the main database

> ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f change_root.ldif

create a file setting up our default rootPW (change {SSHA}hashpwd with our previous password)

> vim change_password.ldif
dn: olcDatabase={1}mdb,cn=config
changetype: modify
replace: olcRootPW
olcRootPW: {SSHA}hashpwd

now apply our new password for the main database

> ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f change_password.ldif
modifying entry "olcDatabase={1}mdb,cn=config"

we are done with our openLDAP root configuration and can begin creating new LDAP directories (.ldif files)