No description
  • TypeScript 66.2%
  • Shell 29.5%
  • Dockerfile 4.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nick Kratzke 43b0665033
All checks were successful
CI/CD / Build & push pocket-id image (push) Successful in 15s
CI/CD / Deploy to Dockhand (push) Successful in 14s
refactor: switch identity provider from Authelia to Pocket ID
Passkey-first OIDC (pocketid/pocket-id v2.19.2) replaces Authelia:

- single container, all config via env vars (no config file, no seed):
  APP_URL=https://auth.barbara8.de, INTERNAL_APP_URL=Tailscale base for
  server-side token/JWKS calls, TRUST_PROXY=Caddy's Tailscale IP,
  air-gapped (no version checks/analytics/icon lookups)
- image is a 1:1 mirror of the official image (org-registry house rule),
  pinned in docker/Dockerfile; upgrade = bump the FROM tag
- one runtime secret (ENCRYPTION_KEY) replaces the four Authelia ones;
  bootstrap re-seeds the stack (the isSecret set is replaced)
- first admin account is created once via POST /api/signup/setup, then the
  user adds a passkey in the portal; recovery via one-time-access-token CLI
- forward-auth is gone (Authelia-specific): other services sign in as OIDC
  clients instead (discovery: https://auth.barbara8.de/.well-known/openid-configuration)

No data migration: Authelia's user/2FA state is dropped; the Pocket ID
instance starts fresh on the new pocketid_data volume.
2026-11-03 16:24:01 +01:00
.forgejo/workflows refactor: switch identity provider from Authelia to Pocket ID 2026-11-03 16:24:01 +01:00
bootstrap refactor: switch identity provider from Authelia to Pocket ID 2026-11-03 16:24:01 +01:00
docker refactor: switch identity provider from Authelia to Pocket ID 2026-11-03 16:24:01 +01:00
.gitignore feat: Authelia SSO portal (auth.barbara8.de) 2026-10-31 14:00:54 +01:00
.mise.toml feat: Authelia SSO portal (auth.barbara8.de) 2026-10-31 14:00:54 +01:00
README.md refactor: switch identity provider from Authelia to Pocket ID 2026-11-03 16:24:01 +01:00

auth — homelab identity provider (Pocket ID)

Pocket ID passkey-first OIDC identity provider for the homelab, served at https://auth.barbara8.de.

  • Single container on UM890 (Dockhand env 3), stack auth, public via the caddy-ingress-controller (Pattern A labels).
  • Sign-in: passkeys (WebAuthn) — no passwords. Fallbacks: sign in from another device (QR), one-time login codes (admin-issued).
  • Persistence: named volume pocketid_data at /app/data — SQLite database (users, passkeys, OIDC clients, API keys, audit log) + uploads.
  • All configuration via environment variables (Pocket ID has no config file); the non-secret settings live in docker/docker-compose.yml.
  • Image: code.schwanke.it/home/auth/pocketid:<sha> — a 1:1 mirror of pocketid/pocket-id:v2.19.2 (house rule: service images live on code.schwanke.it). Upgrade Pocket ID by bumping the FROM tag in docker/Dockerfile + the POCKETID_TAG in the CI workflow, then push.

Replaced Authelia (2026-11-03). Old Authelia state (users/2FA) was not migrated — Pocket ID is passkey-first, so there was nothing portable; the initial admin account is created fresh below.

Layout

docker/Dockerfile          1:1 mirror of pocketid/pocket-id (pins the version)
docker/docker-compose.yml  source of truth for the Dockhand stack (all config)
docker/deploy.ts           two-step Dockhand deploy (upsert start:false -> deploy)
bootstrap/seed-stack.sh    ONE-TIME: generate ENCRYPTION_KEY, seed the stack

Secrets (Dockhand stack secret, isSecret:true)

Secret Purpose
ENCRYPTION_KEY Pocket ID's data-encryption key (token signing keys, …). Losing it = losing the IdP data. Never regenerate on a running instance without encryption-key-rotate.

A local copy lives in the gitignored secrets/credentials (0600). CI sends only the non-secret POCKETID_IMAGE ref; the secret is preserved.

First-time admin account (one-time)

Until the first user exists, the setup API/page is open:

curl -sk -X POST https://auth.barbara8.de/api/signup/setup \
  -H 'Content-Type: application/json' \
  -d '{"username":"nick","email":"nick@barbara8.de","firstName":"Nick","lastName":"Kratzke"}'

Then open https://auth.barbara8.de, sign in as nick, and click Add Passkey (that passkey is how you sign in from then on — the /setup API returns 409 once any user exists).

Users & groups (admin UI)

  • Administration → Users — add users (username/email/name), toggle Admin Privileges, disable accounts, delete.
  • New users get their first passkey via a login code (⋯ menu → Login Code → one-time sign-in link, 1 h) or a signup link (Create Signup Token).
  • Administration → User Groups — groups gate which OIDC clients a user may sign in to; apps receive groups in the groups claim (request the groups scope).
  • Administration → OIDC Clients — connect apps (client ID/secret, callback URLs, allowed groups, consent settings). Discovery URL: https://auth.barbara8.de/.well-known/openid-configuration.
  • Administration → API Keys — API keys for automation (POST /api/users, …).
  • Audit log: Administration → Audit Logs (sign-ins, IP + location — locations need a MaxMind key, currently off).

Connecting an app (OIDC)

App field Value
Issuer / authority https://auth.barbara8.de
Discovery https://auth.barbara8.de/.well-known/openid-configuration
Scopes openid profile email (+ groups for roles)

Tailscale apps can skip the public domain entirely: the discovery doc advertises token/userinfo/JWKS at http://100.96.0.81:18093 (INTERNAL_APP_URL) — use that base URL for server-side token calls between Tailscale services, https://auth.barbara8.de for browsers.

Day-2 operations (run on UM890)

# stack state / logs via Dockhand:
curl -sk -H "Authorization: Bearer $DH_TOKEN" \
  "https://container.schwanke.it/api/stacks?env=3" | jq '.[] | select(.name=="auth")'
curl -sk -H "Authorization: Bearer $DH_TOKEN" \
  "https://container.schwanke.it/api/containers?env=3" | jq '.[] | select(.name|startswith("auth"))'

# container (service name: pocket-id -> container auth-pocket-id-1):
docker exec auth-pocket-id-1 /app/pocket-id version
docker logs -f auth-pocket-id-1

# recovery: lost passkey -> one-time sign-in link (1 h):
docker exec auth-pocket-id-1 /app/pocket-id one-time-access-token nick

# key / signing-key rotation:
docker exec auth-pocket-id-1 /app/pocket-id encryption-key-rotate --help
docker exec auth-pocket-id-1 /app/pocket-id key-rotate

# backup (SQLite + uploads) — the whole data directory:
docker run --rm -v auth_pocketid_data:/app/data -v "$PWD":/backup pocketid/pocket-id:v2.19.2 \
  sh -c 'tar czf /backup/pocket-id-backup-$(date +%F).tar.gz -C /app data'

# verify public:
curl -sk https://auth.barbara8.de/.well-known/openid-configuration

Bootstrap (one-time, out-of-band)

# generate ENCRYPTION_KEY + seed the Dockhand stack (replaces the old
# Authelia secret set with just ENCRYPTION_KEY):
bash bootstrap/seed-stack.sh

Then push to main — CI mirrors the image + deploys — then create the admin account (section above). Re-running bootstrap/seed-stack.sh is idempotent (re-reads the existing key).

Known limitations

  • No SMTP configured: email-based login codes / password-less email recovery are unavailable (recovery = login codes via the admin UI or the one-time-access-token CLI).
  • No GeoLite2 (no MAXMIND_LICENSE_KEY): audit log shows IPs without locations.
  • forward_auth (Caddy forward-auth) is gone with Authelia — protect other services with OIDC clients instead.