Files
frigate_w_audio/authelia/configuration.yml
T
Claude 1b4c9298e1 Update authelia stack: 4 auth cases, full Caddyfile, improved docs
Keeps this as a standalone authelia+fail2ban stack (no Frigate services).

Changes:
- docker-compose.yml: fail2ban depends_on authelia with service_healthy
  condition so authelia.log exists before fail2ban tries to bind-mount it;
  add inline note about pre-creating the log file
- authelia/configuration.yml: expand access_control comment block to cover
  all 4 cases (added Case 3: app keeps own auth + Authelia as 2FA gate,
  and Case 4: app handles auth alone); clearer per-case commented rules
- caddy/Caddyfile (replaces snippet.example.caddyfile): complete Caddyfile
  with all 4 auth-case examples; (accesslog) imported in every block so
  fail2ban caddy-4xx jail covers all subdomains, not just gated ones;
  full inline docs for enabling Frigate proxy auth
- README.md: expand "Which sites" from 3 to 4 cases; add proxy-auth service
  compatibility table (Frigate, Grafana, Gitea, Nextcloud, HA, Portainer
  etc.); clarify fail2ban covers all sites via single caddy-4xx jail;
  add touch authelia/authelia.log to first-run; add troubleshooting entries
  for authelia.log bind-mount directory bug and fail2ban chain verification

https://claude.ai/code/session_012eTokAaGiZo7aGt1T2W9BC
2026-04-26 02:46:42 +00:00

169 lines
6.4 KiB
YAML

---
###############################################################################
# Authelia configuration
#
# - File-based user database (no LDAP)
# - SQLite local storage (no Redis, no MySQL/Postgres)
# - Filesystem notifier (writes "emails" to /config/notifications/...)
# - Argon2id password hashing
# - Per-domain access policies under access_control.rules
#
# Secrets are NOT in this file. They are loaded from files mounted at
# /secrets via the AUTHELIA_*_FILE env vars in docker-compose.yml.
#
# After editing, validate before restarting:
# docker compose run --rm authelia authelia validate-config --config /config/configuration.yml
###############################################################################
theme: 'dark'
server:
address: 'tcp://0.0.0.0:9091'
buffers:
read: 8192
write: 8192
log:
level: 'info'
format: 'text' # fail2ban filter expects text format -- don't change to json
file_path: '/config/authelia.log'
keep_stdout: true # also log to stdout for `docker logs`
identity_validation:
reset_password:
jwt_lifespan: '5 minutes'
jwt_algorithm: 'HS256'
# jwt_secret loaded via AUTHELIA_IDENTITY_VALIDATION_RESET_PASSWORD_JWT_SECRET_FILE
totp:
disable: false
issuer: 'example.com' # CHANGE: your root domain (shown in authenticator app)
algorithm: 'sha1'
digits: 6
period: 30
authentication_backend:
password_change:
disable: false
password_reset:
disable: false
refresh_interval: '5 minutes'
file:
path: '/config/users_database.yml'
password:
algorithm: 'argon2'
argon2:
variant: 'argon2id'
iterations: 3
memory: 65536
parallelism: 4
key_length: 32
salt_length: 16
# ---------------------------------------------------------------------------
# Access control
#
# default_policy: deny -- every domain Caddy forward_auths here must have
# an explicit rule. Domains with no `import authelia` in Caddy never reach
# Authelia at all, so the deny doesn't apply to them.
#
# Policies:
# bypass Authelia waves the request through (used for the portal)
# one_factor password only
# two_factor password + TOTP
#
# ---------------------------------------------------------------------------
# WHICH SITES NEED A RULE HERE?
#
# There are four ways a site can relate to Authelia:
#
# CASE 1 -- App has NO built-in auth (e.g. Pi doorbell PTT page).
# -> Rule required + `import authelia` in Caddy.
# -> Authelia is the ONLY login. Use two_factor for hardware-control pages.
#
# CASE 2 -- App has built-in auth AND supports trusted-header proxy auth
# (Frigate 0.14+, Grafana, Gitea, Nextcloud, Home Assistant ...).
# -> Rule required + `import authelia` in Caddy + disable the app's login
# form in its own config (see README.md per-app instructions).
# -> Single Authelia login covers both access AND the app's user/role
# mapping via Remote-User / Remote-Groups headers.
#
# CASE 3 -- App has built-in auth and CANNOT switch to proxy auth, but you
# still want a 2FA gate in front of it (extra security layer).
# -> Rule required + `import authelia` in Caddy.
# -> User logs into Authelia (2FA) THEN into the app's own login form.
# Two separate logins -- the app auth is unchanged.
# -> Useful for: router admin pages, NAS UIs, any legacy app.
#
# CASE 4 -- App handles its own auth and you don't want Authelia involved.
# -> NO rule here + NO `import authelia` in Caddy.
# -> Traffic skips Authelia entirely; the app handles everything.
# ---------------------------------------------------------------------------
access_control:
default_policy: 'deny'
rules:
# The Authelia portal itself is always bypass.
- domain: 'auth.example.com' # CHANGE
policy: 'bypass'
# -------------------------------------------------------------------
# CASE 1: No app auth -- Authelia is the only gate.
# The Pi doorbell PTT page has no built-in authentication.
# two_factor is appropriate -- this URL controls a speaker in your house.
# -------------------------------------------------------------------
# - domain: 'doorbell.example.com' # CHANGE
# policy: 'two_factor'
# -------------------------------------------------------------------
# CASE 2: App supports trusted-header proxy auth -- replace app login.
# Frigate 0.14+: set `auth.enabled: False` and configure `proxy:` in
# frigate_config/config.yml (see README.md "Switching Frigate to Authelia").
# Single login: Authelia authenticates, Frigate reads Remote-User/Groups.
# -------------------------------------------------------------------
# - domain: 'cam.example.com' # CHANGE
# policy: 'two_factor'
# -------------------------------------------------------------------
# CASE 3: App keeps its own auth; Authelia adds a 2FA gate in front.
# The app's login form is still shown after Authelia passes the request.
# User logs into Authelia (2FA) then into the app separately.
# -------------------------------------------------------------------
# - domain: 'nas.example.com' # CHANGE/REMOVE example
# policy: 'two_factor'
# CASE 4: No rule here, no `import authelia` in Caddy. App handles auth.
session:
# secret loaded via AUTHELIA_SESSION_SECRET_FILE
cookies:
- name: 'authelia_session'
domain: 'example.com' # CHANGE: your root domain
authelia_url: 'https://auth.example.com' # CHANGE
default_redirection_url: 'https://example.com' # CHANGE
expiration: '1 hour'
inactivity: '5 minutes'
remember_me: '1 month'
same_site: 'lax'
# In-app rate limiting. Locks the user account after repeated failures.
# fail2ban is the second line of defense: it bans the source IP.
# Together: Authelia locks the *user*, fail2ban bans the *IP*.
regulation:
max_retries: 3
find_time: '2 minutes'
ban_time: '5 minutes'
storage:
# encryption_key loaded via AUTHELIA_STORAGE_ENCRYPTION_KEY_FILE
local:
path: '/config/db.sqlite3'
# Filesystem notifier -- password reset / new device emails get written to
# a file you can `tail -f`. Swap to `smtp:` when you wire up a real
# transactional sender (see README.md "Switching the notifier to SMTP").
notifier:
disable_startup_check: false
filesystem:
filename: '/config/notifications/notification.txt'