Home

Awesome

OpenLDAP Docker Image for testing

This Docker image provides an OpenLDAP Server for testing LDAP applications, i.e. unit tests. The server is initialized with the example domain planetexpress.com with data from the Futurama Wiki.

Parts of the image are based on the work from Nick Stenning docker-slapd and Bertrand Gouny docker-openldap.

The Flask extension flask-ldapconn use this image for unit tests.

Features

Usage

docker pull ghcr.io/rroemhild/docker-test-openldap:master
docker run --rm -p 10389:10389 -p 10636:10636 ghcr.io/rroemhild/docker-test-openldap:master

Testing

# List all Users
ldapsearch -H ldap://localhost:10389 -x -b "ou=people,dc=planetexpress,dc=com" -D "cn=admin,dc=planetexpress,dc=com" -w GoodNewsEveryone "(objectClass=inetOrgPerson)"

# Request StartTLS
ldapsearch -H ldap://localhost:10389 -Z -x -b "ou=people,dc=planetexpress,dc=com" -D "cn=admin,dc=planetexpress,dc=com" -w GoodNewsEveryone "(objectClass=inetOrgPerson)"

# Enforce StartTLS
ldapsearch -H ldap://localhost:10389 -ZZ -x -b "ou=people,dc=planetexpress,dc=com" -D "cn=admin,dc=planetexpress,dc=com" -w GoodNewsEveryone "(objectClass=inetOrgPerson)"

# Enforce StartTLS with self-signed cert
LDAPTLS_REQCERT=never ldapsearch -H ldap://localhost:10389 -ZZ -x -b "ou=people,dc=planetexpress,dc=com" -D "cn=admin,dc=planetexpress,dc=com" -w GoodNewsEveryone "(objectClass=inetOrgPerson)"

Exposed ports

Exposed volumes

LDAP structure

dc=planetexpress,dc=com

AdminSecret
cn=admin,dc=planetexpress,dc=comGoodNewsEveryone

ou=people,dc=planetexpress,dc=com

cn=Hubert J. Farnsworth,ou=people,dc=planetexpress,dc=com

AttributeValue
objectClassinetOrgPerson
cnHubert J. Farnsworth
snFarnsworth
descriptionHuman
displayNameProfessor Farnsworth
employeeTypeOwner
employeeTypeFounder
givenNameHubert
jpegPhotoJPEG-Photo (630x507 Pixel, 26780 Bytes)
mailprofessor@planetexpress.com
mailhubert@planetexpress.com
ouOffice Management
titleProfessor
uidprofessor
userPasswordprofessor

cn=Philip J. Fry,ou=people,dc=planetexpress,dc=com

AttributeValue
objectClassinetOrgPerson
cnPhilip J. Fry
snFry
descriptionHuman
displayNameFry
employeeTypeDelivery boy
givenNamePhilip
jpegPhotoJPEG-Photo (429x350 Pixel, 22132 Bytes)
mailfry@planetexpress.com
ouDelivering Crew
uidfry
userPasswordfry

cn=John A. Zoidberg,ou=people,dc=planetexpress,dc=com

AttributeValue
objectClassinetOrgPerson
cnJohn A. Zoidberg
snZoidberg
descriptionDecapodian
displayNameZoidberg
employeeTypeDoctor
givenNameJohn
jpegPhotoJPEG-Photo (343x280 Pixel, 26438 Bytes)
mailzoidberg@planetexpress.com
ouStaff
titlePh. D.
uidzoidberg
userPasswordzoidberg

cn=Hermes Conrad,ou=people,dc=planetexpress,dc=com

AttributeValue
objectClassinetOrgPerson
cnHermes Conrad
snConrad
descriptionHuman
employeeTypeBureaucrat
employeeTypeAccountant
givenNameHermes
mailhermes@planetexpress.com
ouOffice Management
uidhermes
userPasswordhermes

cn=Turanga Leela,ou=people,dc=planetexpress,dc=com

AttributeValue
objectClassinetOrgPerson
cnTuranga Leela
snTuranga
descriptionMutant
employeeTypeCaptain
employeeTypePilot
givenNameLeela
jpegPhotoJPEG-Photo (429x350 Pixel, 26526 Bytes)
mailleela@planetexpress.com
ouDelivering Crew
uidleela
userPasswordleela

cn=Bender Bending Rodríguez,ou=people,dc=planetexpress,dc=com

AttributeValue
objectClassinetOrgPerson
cnBender Bending Rodríguez
snRodríguez
descriptionRobot
employeeTypeShip's Robot
givenNameBender
jpegPhotoJPEG-Photo (436x570 Pixel, 26819 Bytes)
mailbender@planetexpress.com
ouDelivering Crew
uidbender
userPasswordbender

cn=Amy Wong+sn=Kroker,ou=people,dc=planetexpress,dc=com

Amy has a multi-valued DN

AttributeValue
objectClassinetOrgPerson
cnAmy Wong
snKroker
descriptionHuman
givenNameAmy
mailamy@planetexpress.com
ouIntern
uidamy
userPasswordamy

cn=admin_staff,ou=people,dc=planetexpress,dc=com

AttributeValue
objectClassGroup
cnadmin_staff
membercn=Hubert J. Farnsworth,ou=people,dc=planetexpress,dc=com
membercn=Hermes Conrad,ou=people,dc=planetexpress,dc=com

cn=ship_crew,ou=people,dc=planetexpress,dc=com

AttributeValue
objectClassGroup
cnship_crew
membercn=Turanga Leela,ou=people,dc=planetexpress,dc=com
membercn=Philip J. Fry,ou=people,dc=planetexpress,dc=com
membercn=Bender Bending Rodríguez,ou=people,dc=planetexpress,dc=com

JAAS configuration

In case you want to use this OpenLDAP server for testing with a Java-based application using JAAS and the LdapLoginModule, here's a working configuration file you can use to connect.

other {
  com.sun.security.auth.module.LdapLoginModule REQUIRED
    userProvider="ldap://localhost:10389/ou=people,dc=planetexpress,dc=com"
    userFilter="(&(uid={USERNAME})(objectClass=inetOrgPerson))"
    useSSL=false
    java.naming.security.principal="cn=admin,dc=planetexpress,dc=com"
    java.naming.security.credentials="GoodNewsEveryone"
    debug=true
    ;
};

This config uses the admin credentials to connect to the OpenLDAP server and to submit the search query for the user that enters their credentials. As username the uid attribute of each entry is used.