# lldap

## Overview
The lldap stack is a Docker Swarm configuration for the Lightweight Directory Access Protocol (LDAP) service in NetGrimoire. It provides a web-based user interface and an LDAP server, exposing port 17170 for the web UI and 3890 for LDAP.

---

## Architecture
| Service | Image | Port | Role |
|---------|-------|------|------|
- **Host:** docker4
- **Network:** netgrimoire
- **Exposed via:** ldap.netgrimoire.com
- **Homepage group:** Authentication

---

## Build & Configuration

### Prerequisites
To build and deploy the lldap stack, ensure you have Docker Swarm configured on your manager node (znas) and worker nodes (docker4).

### Volume Setup
```bash
mkdir -p /DockerVol/lldap/data
chown postgres:postgres /DockerVol/lldap/data
```

### Environment Variables
```bash
# generate: openssl rand -hex 32
PUID=1964
PGID=1964
LLDAP_LDAP_BASE_DN="dc=netgrimoire,dc=com"
LLDAP_DOMAIN=netgrimoire.com
LLDAP_LDAP_USER_PASS=F@lcon13
LLDAP_JWT_SECRET=lougu9MjGLmLp1SPDkkCBsQm-MdHpGGuOn-wW7FRWRdzglIn1nJRyBQkQ7HDcDh0
LLDAP_KEY_SEED=Kss_fNlMBH3XRo9aYHo_pI9gWQecQ1v3-yYzULckoWUm-iKIkV2DMygPYyKaN-u_
```

### Deploy
```bash
cd services/swarm/stack/lldap
set -a && source .env && set +a
docker stack config --compose-file lldap-stack.yml > resolved.yml
docker stack deploy --compose-file resolved.yml lldap
rm resolved.yml
docker stack services lldap
```

### First Run
After deployment, verify the LLDAP service is running and accessible via the web UI.

---

## User Guide

### Accessing lldap
| Service | URL | Purpose |
|---------|-----|---------|
- **Host:** ldap.netgrimoire.com
- **Port:** 17170 (web UI)
- **Port:** 3890 (LDAP)

### Primary Use Cases
Configure LLDAP for your users and manage user accounts, groups, and permissions.

### NetGrimoire Integrations
This service integrates with the NetGrimoire dashboard to provide a central location for managing LDAP configurations and user identities.

---

## Operations

### Monitoring
[kuma monitors from kuma.* labels]
```bash
docker stack services lldap
docker service logs -f lldap
```

### Backups
Critical backups should be performed regularly to ensure data integrity. Use the following Docker Compose command:
```bash
docker-compose up --build --no-deps -d backup
```
Reconstructing the database from backups is a critical operation that requires special care.

---

## Common Failures
| Symptom | Cause | Fix |
|---------|-------|-----|
- Error authenticating with LLDAP | Insufficient permissions or incorrect configuration. | Verify correct PUID/PGID and LDAP credentials. |
- Unable to connect to web UI | Web UI not accessible due to Caddy issues. | Check Caddy logs for errors. |
- Unable to connect to LDAP | LDAP server not listening on port 3890. | Restart the LLDAP service or check configuration files. |

---

## Changelog

| Date | Commit | Summary |
|------|--------|---------|
| 2026-04-30 | 4628ea4c | Initial documentation creation |
| 2026-04-30 | fc4617a1 | Initial build and deployment configuration |
| 2026-04-30 | 3c8190d1 | Added environment variables for LLDAP |
| 2026-04-30 | 99e9dd41 | Updated Docker Compose command for backup |
| 2026-04-30 | 3ab644ff | Improved error handling for failed connections |

---

## Notes
Generated by Gremlin on 2026-04-30T19:02:50.195Z
Source: swarm/lldap.yaml
Review User Guide and Changelog sections