Quick Start: LDAP

Quick Start: LDAP

If you want to use bitnamic/openldap,
please follow this Quick Start: LDAP by Bitnami.

Prerequisite

Traefik on HTTP

OR

Traefik on HTTPS

If HTTP, remove the tls: {} in dynamic configuration

Preparation

compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
version: Compose specification

services:
ldap:
image: osixia/openldap
restart: always
environment:
- LDAP_ORGANISATION=Chaos Inc.
# if LDAP_DOMAIN=chaos.io, the login DN will be "cn=admin,dc=chaos,dc=io"
# LDAP_DOMAIN default value is "example.org"
# so default login DN is "cn=admin,dc=example,dc=org"
- LDAP_DOMAIN=chaos.io
- LDAP_ADMIN_PASSWORD=secret
volumes:
- ldap:/var/lib/ldap
- slapd:/etc/ldap/slapd.d
networks:
- traefik-net

ldapadmin:
image: osixia/phpldapadmin
restart: always
environment:
- PHPLDAPADMIN_LDAP_HOSTS=ldap
# if configure https by traefik, you need to configure the following two lines
# if not, remove them
- VIRTUAL_HOST=ldap.x.internal
- PHPLDAPADMIN_HTTPS=false
networks:
- traefik-net
volumes:
ldap:
slapd:

networks:
traefik-net:
external: true

ldap.yml in dir dynamic-conf

You should touch ldap.yml in traefik dir dynamic-conf.

For much more information, please reference the Prerequisite.

1
2
3
4
5
6
7
8
9
10
11
12
13
http:
routers:
ldap:
rule: "Host(`ldap.x.internal`)"
service: "ldap"
tls: { }

services:
ldap:
loadBalancer:
servers:
- url: "http://ldapadmin"

Config domain parse

1
echo "127.0.0.1 ldap.x.internal\n" >> /etc/hosts

Run

1
2
3
docker compose up -d
# docker compose -p ldap up -d
# docker compose -f ./compose.yml -p ldap up -d

Access: https://ldap.x.internal