Running LLDAP as a lightweight homelab directory service
Deploy Rust-based LLDAP with Docker Compose, PostgreSQL, and an internal bridge network to centralize homelab user accounts and RBAC groups.
Maintaining separate logins across Portainer, Gitea, Outline, and monitoring tools quickly becomes a security headache. Here is how I deploy LLDAP with Docker Compose, back it with PostgreSQL, and isolate LDAP traffic on an internal Docker network.
Tested with LLDAP (
lldap/lldap:stable), Docker Compose v2, and PostgreSQL 17.
Why a homelab needs a lightweight directory
Once a homelab grows past three or four web apps—Portainer, Gitea, Outline, and dashboards—local per-app accounts fall apart fast:
- Changing a password means logging into half a dozen dashboards one by one
- Usernames drift across services because each app enforces different rules
- Offboarding a guest account is error-prone, leaving stale credentials behind
LDAP (Lightweight Directory Access Protocol) solves this by acting as a single source of truth for users and groups. The problem is that traditional directory servers like OpenLDAP, FreeIPA, and Active Directory are painful to run at homelab scale:
| Criterion | OpenLDAP / FreeIPA | LLDAP |
|---|---|---|
| Memory usage | Hundreds of MB to GB | ~20–30 MB (Rust binary) |
| Admin UI | External (e.g., phpLDAPadmin) | Built-in modern web UI |
| Schema management | Manual LDIF & object classes (inetOrgPerson, posixAccount) | Opinionated, ready out of the box |
| Scope | Enterprise PAM/Kerberos/POSIX | Web app authentication & RBAC groups |
LLDAP (Light LDAP) strips away legacy LDAP ceremony. Written in Rust, it speaks standard LDAP v3 for authentication queries, ships with a clean web UI for managing users and groups, and uses less than 30 MB of RAM.
When not to use LLDAP: LLDAP is intentionally scoped to web authentication and group lookups. Don’t pick it if you need full Linux host login (PAM/NSS with posixAccount UIDs/GIDs), Kerberos tickets, or Windows Group Policy—use FreeIPA or Samba AD for those workloads.
Architecture and internal network isolation
LLDAP exposes two ports: the web admin portal on 17170 and the LDAP protocol endpoint on 3890. There is no reason to expose port 3890 to the internet or even to the host network. Instead, I isolate LDAP queries on an internal: true Docker bridge network (identity_backend) shared exclusively with Authelia.
flowchart TD
subgraph Ingress["External Access"]
Client["Admin Browser"] --> NPM["Nginx Proxy Manager<br/>(id.namju.kim)"]
end
subgraph Identity["Identity Stack (Docker Compose)"]
NPM -->|"HTTPS Proxy (Port 17170)"| LLDAP["LLDAP<br/>(Rust Directory Engine)"]
subgraph PrivateNet["Internal Network: identity_backend (internal: true)"]
LLDAP ---|"LDAP v3 (Port 3890)"| Authelia["Authelia (SSO Portal)"]
end
end
subgraph DataTier["Database Tier: database_network"]
LLDAP -->|"Persistent Store"| PG["PostgreSQL (DB: lldap)"]
end
Three networks enforce clean boundaries:
proxy_network: Connects Nginx Proxy Manager to LLDAP’s web UI (https://id.namju.kim).identity_backend(internal: true): A pure internal Docker bridge with no default internet gateway. Plaintext LDAP traffic between Authelia and LLDAP never leaves the Docker host.database_network: Connects LLDAP to the isolatedlldapdatabase I provisioned in my shared PostgreSQL and Redis stack.
Docker Compose configuration and secrets
Here is the LLDAP service definition from identity/docker-compose.yaml:
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# identity/docker-compose.yaml (LLDAP excerpt)
name: identity
services:
lldap:
image: lldap/lldap:stable
container_name: lldap
restart: unless-stopped
environment:
TZ: Asia/Seoul
# LDAP Base DN and bootstrap admin account
LLDAP_LDAP_BASE_DN: "dc=namju,dc=kim"
LLDAP_LDAP_USER_DN: "admin"
LLDAP_LDAP_USER_EMAIL: "${LLDAP_ADMIN_EMAIL}"
LLDAP_LDAP_USER_PASS: "${LLDAP_ADMIN_PASSWORD:?required}"
# JWT signing secret and encryption seed (openssl rand -hex 32)
LLDAP_JWT_SECRET: "${LLDAP_JWT_SECRET:?required}"
LLDAP_KEY_SEED: "${LLDAP_KEY_SEED:?required}"
# Public web UI URL
LLDAP_HTTP_URL: "https://id.namju.kim"
# PostgreSQL connection string
LLDAP_DATABASE_URL: "postgres://lldap_user:${LLDAP_DB_PASSWORD}@postgres:5432/lldap"
volumes:
- lldap_data:/data
networks:
- proxy_network
- identity_backend
- database_network
healthcheck:
test:
- CMD
- /app/lldap
- healthcheck
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
volumes:
lldap_data:
networks:
proxy_network:
external: true
identity_backend:
driver: bridge
internal: true
database_network:
external: true
Generating cryptographic secrets
Generate two distinct 32-byte random hex strings with OpenSSL and store them in .env for LLDAP_JWT_SECRET and LLDAP_KEY_SEED:
1
2
openssl rand -hex 32 # LLDAP_JWT_SECRET
openssl rand -hex 32 # LLDAP_KEY_SEED
Keep
LLDAP_KEY_SEEDbacked up safely and never rotate it casually. LLDAP derives the encryption key for stored password hashes and secrets from this seed; changing it invalidates existing user credentials in PostgreSQL.
Modeling users and RBAC groups
After starting LLDAP and proxying https://id.namju.kim through Nginx Proxy Manager, log in with the bootstrap admin account and create a small set of role-based groups that downstream apps and Authelia can reference.
Standard group hierarchy
Group (cn) | Purpose & Scope | Example Services |
|---|---|---|
admin | Full infrastructure control | Portainer, Uptime Kuma, Nginx Proxy Manager |
developer | Source code and CI/CD access | Gitea, Gitea Actions Runner |
guest | Read-only or shared knowledge base access | Outline Wiki |
flowchart TD
subgraph Users["Users (uid)"]
U_Namju["uid=namju"]
U_Guest["uid=family_guest"]
end
subgraph Groups["LLDAP Groups (cn)"]
G_Admin["cn=admin"]
G_Dev["cn=developer"]
G_Guest["cn=guest"]
end
U_Namju --> G_Admin
U_Namju --> G_Dev
U_Namju --> G_Guest
U_Guest --> G_Guest
In the LLDAP web UI:
- Groups tab: Create
admin,developer, andguest. - Users tab:
- Create your primary account with email, display name, and password, then assign it to
admin,developer, andguest. - For family members or collaborators, create dedicated accounts and assign only
guestso they never see infrastructure portals.
- Create your primary account with email, display name, and password, then assign it to
Verifying health and LDAP queries
Start the container and confirm its built-in healthcheck reports healthy:
1
2
3
4
5
6
# Start LLDAP
docker compose up -d lldap
# Check container health status
docker inspect --format='{{json .State.Health.Status}}' lldap
# Expected output: "healthy"
Next, verify that LDAP v3 queries succeed from inside the isolated identity_backend network using a temporary ldapsearch container:
1
2
3
4
5
6
docker run --rm --network identity_backend osixia/openldap:latest \
ldapsearch -x -H ldap://lldap:3890 \
-b "dc=namju,dc=kim" \
-D "uid=admin,ou=people,dc=namju,dc=kim" \
-w "your_admin_password" \
"(uid=namju)"
If the output returns the user’s DN (uid=namju,ou=people,dc=namju,dc=kim) along with their memberOf group entries, LLDAP is ready to serve downstream authentication requests.
Production caveats and checklist
- Use a dedicated bind account for SSO: Rather than handing the
adminpassword to Authelia or other LDAP clients, create a read-only service user in LLDAP and add it to the built-inlldap_strict_readonlygroup so it can query users and groups without write privileges. - Plaintext LDAP vs. LDAPS: Running plain
ldap://lldap:3890is fine strictly inside aninternal: trueDocker bridge on a single host. If another physical machine ever needs to query LLDAP across a LAN, enable LDAPS (LLDAP_LDAPS_OPTIONS__ENABLED=true) with valid TLS certificates. - Pre-launch checklist:
LLDAP_KEY_SEEDandLLDAP_JWT_SECRETgenerated withopenssl rand -hex 32and backed up- Port
3890not published to the host; restricted toidentity_backend(internal: true) - LLDAP connected to the dedicated
lldapPostgreSQL database - RBAC groups (
admin,developer,guest) created and verified vialdapsearch
With LLDAP acting as the central user directory, the next step is putting an SSO portal in front of every web app—see setting up SSO and Forward Auth with Authelia and Nginx Proxy Manager.