Serve LDAPS, StartTLS and IPv6 from the dev LDAP

Production and the client's test server use ldaps://, so the dev server
now offers TLS as well: ldaps on 636 (localhost:3636) and StartTLS on
389, with both ports also published on [::1].

A throwaway CA and server certificate are generated on every start, with
the full CA extensions that Python 3.13+ strict verification requires.
The CA certificate is copied to dev/ldap/export/ca.crt (gitignored).
The server certificate covers localhost, the service names and ::1, but
not 127.0.0.1, so tests can show that hostname mismatches are
rejected.
This commit is contained in:
sajeyks 2026-11-10 14:54:20 +03:00
commit b9c043dcd4
5 changed files with 42 additions and 5 deletions

View file

@ -1,6 +1,8 @@
# Dev dependencies only. The Django app runs natively (no container) and
# talks to LDAP on ldap://localhost:3389 and, if DATABASE_HOST=localhost is
# set, to PostgreSQL on localhost:5433 (SQLite is used otherwise).
# talks to LDAP on ldap://localhost:3389 (StartTLS) and ldaps://localhost:3636,
# and, if DATABASE_HOST=localhost is set, to PostgreSQL on localhost:5433
# (SQLite is used otherwise). The LDAP CA certificate is written to
# dev/ldap/export/ca.crt on every start.
#
# docker compose -f docker-compose.dev.yml up -d --build
# docker compose -f docker-compose.dev.yml up -d --force-recreate ldap # reset data
@ -12,6 +14,11 @@ services:
LDAP_ADMIN_PASSWORD: admin
ports:
- "127.0.0.1:3389:389"
- "127.0.0.1:3636:636"
- "[::1]:3389:389"
- "[::1]:3636:636"
volumes:
- ./dev/ldap/export:/export
postgres:
image: postgres:18-alpine