Home Server › Containers

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.

Running LLDAP as a lightweight homelab directory service

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:

CriterionOpenLDAP / FreeIPALLDAP
Memory usageHundreds of MB to GB~20–30 MB (Rust binary)
Admin UIExternal (e.g., phpLDAPadmin)Built-in modern web UI
Schema managementManual LDIF & object classes (inetOrgPerson, posixAccount)Opinionated, ready out of the box
ScopeEnterprise PAM/Kerberos/POSIXWeb 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 isolated lldap database 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_SEED backed 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 & ScopeExample Services
adminFull infrastructure controlPortainer, Uptime Kuma, Nginx Proxy Manager
developerSource code and CI/CD accessGitea, Gitea Actions Runner
guestRead-only or shared knowledge base accessOutline 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:

  1. Groups tab: Create admin, developer, and guest.
  2. Users tab:
    • Create your primary account with email, display name, and password, then assign it to admin, developer, and guest.
    • For family members or collaborators, create dedicated accounts and assign only guest so they never see infrastructure portals.

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 admin password to Authelia or other LDAP clients, create a read-only service user in LLDAP and add it to the built-in lldap_strict_readonly group so it can query users and groups without write privileges.
  • Plaintext LDAP vs. LDAPS: Running plain ldap://lldap:3890 is fine strictly inside an internal: true Docker 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_SEED and LLDAP_JWT_SECRET generated with openssl rand -hex 32 and backed up
    • Port 3890 not published to the host; restricted to identity_backend (internal: true)
    • LLDAP connected to the dedicated lldap PostgreSQL database
    • RBAC groups (admin, developer, guest) created and verified via ldapsearch

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.

This post is licensed under CC BY 4.0 by the author.