Sign inSign up

alchen99/test-openldap

By alchen99

•Updated about 6 years ago

Prepopulated OpenLDAP server for testing

Image
0

396

alchen99/test-openldap repository overview

⁠OpenLDAP Docker Image for testing

This fork adds more LDAP groups and more tools to the Docker container.

DockerHub Badge

This 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

  • Initialized with data from Futurama
  • Support for TLS (snake oil cert on build)
  • memberOf overlay support
  • MS-AD Style Groups support
  • ~124MB images size (~40MB compressed)

⁠Usage

docker pull alchen99/test-openldap
docker run --privileged -d -p 389:389 alchen99/test-openldap

⁠Exposed ports

  • 389
  • 636

⁠Exposed volumes

  • /etc/ldap/slapd.d
  • /etc/ldap/ssl
  • /var/lib/ldap
  • /run/slapd

⁠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)
mail[email protected]⁠
mail[email protected]⁠
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)
mail[email protected]⁠
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)
mail[email protected]⁠
ouStaff
titlePh. D.
uidzoidberg
userPasswordzoidberg
⁠cn=Hermes Conrad,ou=people,dc=planetexpress,dc=com
AttributeValue
objectClassinetOrgPerson
cnHermes Conrad
snConrad
descriptionHuman
employeeTypeBureaucrat
employeeTypeAccountant
givenNameHermes
mail[email protected]⁠
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)
mail[email protected]⁠
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)
mail[email protected]⁠
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
mail[email protected]⁠
ouIntern
uidamy
userPasswordamy
⁠cn=dir_mgr,ou=people,dc=planetexpress,dc=com
AttributeValue
objectClassGroup
cndir_mgr
membercn=admin,dc=planetexpress,dc=com
⁠cn=admin,ou=people,dc=planetexpress,dc=com
AttributeValue
objectClassGroup
cnadmin
membercn=Hubert J. Farnsworth,ou=people,dc=planetexpress,dc=com
membercn=Hermes Conrad,ou=people,dc=planetexpress,dc=com
⁠cn=crew,ou=people,dc=planetexpress,dc=com
AttributeValue
objectClassGroup
cncrew
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
⁠cn=intern,ou=people,dc=planetexpress,dc=com
AttributeValue
objectClassGroup
cnintern
membercn=Amy Wong+sn=Kroker,ou=people,dc=planetexpress,dc=com
⁠cn=ship,ou=people,dc=planetexpress,dc=com
AttributeValue
objectClassGroup
cnship
membercn=Hubert J. Farnsworth,ou=people,dc=planetexpress,dc=com
membercn=Philip J. Fry,ou=people,dc=planetexpress,dc=com
membercn=John A. Zoidberg,ou=people,dc=planetexpress,dc=com
membercn=Hermes Conrad,ou=people,dc=planetexpress,dc=com
membercn=Turanga Leela,ou=people,dc=planetexpress,dc=com
membercn=Bender Bending Rodríguez,ou=people,dc=planetexpress,dc=com
membercn=Amy Wong+sn=Kroker,ou=people,dc=planetexpress,dc=com

⁠LDAP Search Tips

  • Search for all groups

    ldapsearch -LLL -h localhost -p 389 \
    -D 'cn=admin,dc=planetexpress,dc=com' \
    -w GoodNewsEveryone \
    -b 'ou=people,dc=planetexpress,dc=com' \
    '(&(objectclass=Group))' dn
    
  • Search for groups a user is a member of

    ldapsearch -LLL -h localhost -p 389 \
    -D 'cn=admin,dc=planetexpress,dc=com' \
    -w GoodNewsEveryone \
    -b 'ou=people,dc=planetexpress,dc=com' \
    '(&(description=Human)(sn=Fry)(objectclass=inetorgperson))' dn memberof
    

    Will result in the following:

    dn: cn=Philip J. Fry,ou=people,dc=planetexpress,dc=com
    memberOf: cn=ship_crew,ou=people,dc=planetexpress,dc=com
    memberOf: cn=ship,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/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.

Tag summary

Content type

Image

Digest

Size

39.2 MB

Last updated

about 6 years ago

docker pull alchen99/test-openldap