Files
HiveGrid-Wireframes/hivegrid-cloud/infra/authentik/traefik.labels.yml
T

67 lines
3.7 KiB
YAML

# Canonical Traefik label-set for the self-hosted Authentik IdP stack.
#
# This file is a YAML fragment (NOT a runnable compose by itself). The operator
# attaches the same labels to the `server` service via the Coolify-UI
# "Service Labels" panel when wiring the stack to Traefik; we ship them here
# in one place for review + traceability. Coolify-injected labels (project
# id, environment) are merged on top automatically.
#
# Coolify (v4) ships Traefik v3.6 with two entrypoints (`http`:80, `https`:443)
# and a default ACME cert-resolver named `letsencrypt`. The labels below match
# that convention; they exactly mirror the shape used by infra/sentry/.
#
# Host: auth.boiler.saas-ctrl.com -> DNS A record points at 46.225.5.93
# (created via Cloudflare API — see docs/operations/authentik-setup.md).
# ---- ROUTERS ----------------------------------------------------------------
# Primary HTTPS router — terminates TLS, forwards to authentik-server:9000.
traefik.enable: "true"
traefik.docker.network: "coolify"
traefik.http.routers.authentik.rule: "Host(`auth.boiler.saas-ctrl.com`)"
traefik.http.routers.authentik.entrypoints: "https"
traefik.http.routers.authentik.tls: "true"
traefik.http.routers.authentik.tls.certresolver: "letsencrypt"
traefik.http.services.authentik.loadbalancer.server.port: "9000"
# HTTP -> HTTPS redirect (port 80 catches plain-HTTP hits and 308s them to TLS).
traefik.http.routers.authentik-http.rule: "Host(`auth.boiler.saas-ctrl.com`)"
traefik.http.routers.authentik-http.entrypoints: "http"
traefik.http.routers.authentik-http.middlewares: "authentik-https-redirect"
traefik.http.middlewares.authentik-https-redirect.redirectscheme.scheme: "https"
# ---- SECURITY HEADERS (recommended) ----------------------------------------
#
# Attach `authentik-secure-headers` to the router's `middlewares` list:
# traefik.http.routers.authentik.middlewares: "authentik-secure-headers"
#
# Authentik itself sets a reasonable CSP for its own UI; the headers below
# tighten the response at the edge. HSTS-preload is intentionally OFF until
# the operator confirms all dependent subdomains are HTTPS-only (HSTS-preload
# is a one-way commitment).
traefik.http.middlewares.authentik-secure-headers.headers.stsSeconds: "63072000"
traefik.http.middlewares.authentik-secure-headers.headers.stsIncludeSubdomains: "true"
traefik.http.middlewares.authentik-secure-headers.headers.stsPreload: "false"
traefik.http.middlewares.authentik-secure-headers.headers.contentTypeNosniff: "true"
traefik.http.middlewares.authentik-secure-headers.headers.browserXssFilter: "true"
traefik.http.middlewares.authentik-secure-headers.headers.frameDeny: "true"
traefik.http.middlewares.authentik-secure-headers.headers.referrerPolicy: "no-referrer"
# Authentik renders no third-party iframes; deny embedding the IdP UI entirely.
traefik.http.middlewares.authentik-secure-headers.headers.customResponseHeaders.X-Robots-Tag: "noindex, nofollow"
# ---- RATE-LIMIT MIDDLEWARE (recommended for /api/v3/flows/executor/*) ------
#
# Authentik has an internal brute-force policy (see bootstrap/blueprints/
# 02-policies.yaml — 5 failed/min IP-lockout for 15min). The Traefik
# rate-limit is a defence-in-depth layer that catches credential-stuffing
# bursts BEFORE they reach Authentik's flow executor. Attach to the router by
# appending `authentik-ratelimit` to the router's `middlewares` list when
# applying both at once:
#
# traefik.http.routers.authentik.middlewares: "authentik-secure-headers,authentik-ratelimit"
traefik.http.middlewares.authentik-ratelimit.ratelimit.average: "60"
traefik.http.middlewares.authentik-ratelimit.ratelimit.burst: "120"
traefik.http.middlewares.authentik-ratelimit.ratelimit.period: "1m"