escenitech/ldap

By escenitech

Updated over 5 years ago

An Alpine Openldap server with Microsoft Active Directory Schema for Docker

Image
0

634

An Alpine Openldap server with Microsoft AD Schema for Docker

The Lightweight Directory Access Protocol (LDAP) is an open, vendor-neutral, industry standard application protocol for accessing and maintaining distributed directory information services over an Internet Protocol (IP) network.

This image is based on Alpine Linux and OpenLDAP. Loads a minimal Microsoft schema to simulate an Active Directory.

Inspired by:

Customisation

Override the following environment variables when running the docker container to customise LDAP:

VARIABLEDESCRIPTIONDEFAULT
ORGANISATION_NAMEOrganisation nameEscenitMedia
ORGANISATION_UNITOrganisation UnitPeople
SUFFIXOrganisation distinguished namedc=localhoste,dc=com
ROOT_USERRoot usernameManager
ROOT_PWRoot passwordpassword
USER_UIDInitial user's uideloy-escenit.com
USER_SIDInitial user's sidS-1-5-21-3650320818-366320969-327257714
USER_GIVEN_NAMEInitial user's given nameEloy
USER_SURNAMEInitial user's surnameGómez
USER_EMAILInitial user's emaileloy@escenit.com
USER_PWInitial user's passwordpassword

Run

You may also just pull and run the image hosted on Docker Hub

docker run -d -p 389:389 escenitech/ldap

Custom ldif files

*.ldif files can be used to add lots of people to the organisation on startup.

Copy ldif files to /ldif and the container will execute them. This can be done either by extending this Dockerfile with your own:

FROM escenitech/ldap
COPY users.ldif users.ldif
RUN slapadd -v -l /users.ldif

Sample users.ldif:

dn: uid=victor-escenit.com,ou=People,dc=localhost,dc=com
objectClass: inetOrgPerson
objectClass: securityPrincipal
uid: victor-escenit.com
sAMAccountName: victor-escenit.com
objectSid: S-1-5-21-3650320818-366320969-327257715
cn: Víctor Zurriaga
displayName: Víctor Zurriaga
givenName: Victor
sn: Zurriaga
mail: victor@escenit.com
userPassword: password

Useful LDAP commands

Add new entities:

ldapadd -x -c -H ldap://localhost:389 -D "cn=Manager,dc=localhost,dc=com" -w password -f <new_file.ldif>

Search:

ldapsearch -H ldap://localhost:389 -D "cn=Manager,dc=localhost,dc=com" -w password -b dc=localhost,dc=com -s sub "(&(objectclass=inetOrgPerson)(mail=eloy@escenit.com))" "*"

cn=Manager,dc=localhost,dc=com
secret

Docker Pull Command

docker pull escenitech/ldap