Docker quickly builds LDAP server

Keywords: Linux Docker


OpenLdap can provide powerful centralized account management and authorization, but its powerful function depends on the integration of multiple plug-ins. In order to facilitate the compilation and deployment of OpenLdap, I made a docker image and recorded its usage through this article.

Document environment

  • Test environment for the code in this document

    OpenLdap Docker deployment

Get image

docker push nginxbar/ldapsso:0.1

Container start

docker run -p 389:389 -p 636:636 --name ldapsso --detach nginxbar/ldapsso:0.1

Custom ldap domain

The default ldap domain of the image is nginxbar, the root domain is dc=nginxbar,dc=com, and the custom domain can be modified as follows

docker run -p 389:389 -p 636:636 \
    -e DOMAIN=ldapsso \
    -e BASE_DN=dc=ldapsso,dc=com \
    --name ldapsso --detach nginxbar/ldapsso:0.1

Change administrator and password

Modify the administrator account and password through the environment variables ADMIN and config ﹣ pass

docker run -p 389:389 -p 636:636 \
    -e ADMIN=superadmin \
    -e CONFIG_PASS=admin \
    --name ldapsso --detach nginxbar/ldapsso:0.1

AD domain integration

The image has been configured with the AD integrated environment. When using it, you only need to configure the relevant parameters of the AD domain.

docker run -p 389:389 -p 636:636 \
      -e \
      -e AD_BASE_DN=DC=office,DC=nginxbar,dc=com \
      -e AD_BIND_DN=CN=admin,CN=Users,DC=office,DC=nginxbar,dc=com \
      -e AD_PASSWD=abcdefg --detach nginxbar/ldapsso:0.1

Password change

The image integrates a self modifying password web program, which is directly accessed through port 8080.

docker run -p 389:389 -p 636:636 -p 8080:8080 --name ldapsso --detach nginxbar/ldapsso:0.1

Docker compose script

version: '3.3'
    hostname: ldapsso
    image: nginxbar/ldapsso:0.1
    container_name: ldapsso
      - 389:389
      - 636:636
      - 8080:8080
      - HOSTNAME=localhost
      - LOG_LEVEL=256
      - ADMIN=root
      - CONFIG_PASS=admin
      - DOMAIN=ldapsso
      - BASE_DN=dc=ldapsso,dc=com
      - AD_BASE_DN=DC=office,DC=nginxbar,DC=com
      - AD_BIND_DN=CN=admin,CN=Users,DC=office,DC=nginxbar,dc=com
      - AD_PASSWD=abcdefg

Reference documents

Posted by NZ_Kiwis on Wed, 29 Apr 2020 08:28:31 -0700