Commit Graph
6 Commits
Author SHA1 Message Date
claude-botandClaude Opus 5.5 89771995b3 fix(authentik-gate-sync): PATCH proxy providers with the full body
ci/woodpecker/pr/ci-scripts-test Pipeline was successful
A drifted proxy provider was PATCHed with only the drifted fields.
ProxyProviderSerializer.validate (providers/proxy/api.py, 2026.8.3)
checks internal_host against mode from the request attrs alone,
defaulting mode to proxy, so a flow-only PATCH fails with 400
"Internal host cannot be empty when forward auth is disabled." Seen
live after #1285: 8 gates could not move to the new flows and stayed on
their old ones.

The fake Authentik in the tests now applies the same validation, and a
test covers a flow change on an existing gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 10:46:53 +02:00
claude-botandClaude Opus 5.5 67a1eb2ba5 feat(authentik): move every app onto the SSO login (stage 2)
Stage 2 of unifying the auth flows, after the llama and paperless trial
of stage 1 was confirmed:

- Brand authentik.srv.renner.uno: flow_authentication =
  sso-authentication (was NULL, i.e. the slug-first
  default-authentication-flow with password + MFA). Every provider
  without its own authentication_flow logs in through it, PVE and PBS
  included.
- The 7 blueprint OIDC providers (Home Assistant, NetBird,
  Audiobookshelf, Immich, Gitea, Grafana, Matrix MAS): authentication
  flow unset (brand), authorization implicit consent.
- authentik-gate-sync: default authorization flow implicit consent, via
  DEFAULT_AUTHORIZATION_FLOW on the Deployment and in the code; the
  per-gate login/authorization annotations are dropped. Paperless keeps
  paperless-authorization.

Every flow referenced here already exists, so the gate controller does
not hit the missing-flow removal seen in stage 1. Stage 3 removes the
passkey-only flows once nothing references them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 10:41:17 +02:00
claude-botandClaude Opus 5.5 50b0aafdf2 feat(authentik-gate-sync): publish the route's address as the source Ingress status
ci/woodpecker/pr/ci-scripts-test Pipeline was successful
ci/woodpecker/pr/ci-manifests-test Pipeline was successful
Like any ingress controller, authentik-gate-sync now owns the load-balancer
status of the Ingresses of its class: each pass it copies the address Traefik
reports for the generated route onto the source Ingress, and clears it while
the gate has no route. Previously the migrated Ingresses kept the address
Traefik wrote before their class changed, which Traefik never clears.

Status publishing is non-fatal (logged), so it never holds or removes a gate.
RBAC gains ingresses/status; the change is additive, so the order in which
Flux applies RBAC and the new image does not matter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 21:54:09 +02:00
claude-botandClaude Opus 5.5 d549f9234f fix(authentik-gate-sync): keep named targetPorts named in the gate CNPs
A named targetPort was resolved to a number through the Service's
EndpointSlices, so with no ready endpoints (app restarting, crashlooping)
the gate counted as invalid: its route was removed and its Authentik
objects torn down, to be rebuilt once the pods came back. Cilium accepts
named ports in toPorts and resolves them against the selected pods'
container ports, so the name now goes into both CNPs as-is and the gate no
longer depends on the backend being up. The EndpointSlice read (and its
RBAC) is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 21:20:47 +02:00
claude-botandClaude Opus 5.5 38cd002385 fix(authentik-gate-sync): address review — lookups, ownership, fail-closed access
ci/woodpecker/pr/ci-scripts-test Pipeline was successful
ci/woodpecker/pr/ci-manifests-test Pipeline was successful
- Proxy providers are filtered by name__iexact (plain name= is ignored and
  returned the first provider alphabetically).
- Applications are retrieved by slug, never listed: the list endpoint is
  policy-filtered for the token's user and cached per user regardless of
  filters. Cleanup finds owned apps through the proxy provider list and
  confirms meta_publisher + provider one by one.
- Group gates bind an expression policy (ak_is_group_member by name, the name
  as a repr() literal) instead of the group: deleting a group cascades its
  bindings away and would open the app, the policy keeps denying. New bindings
  are created before stale ones are removed.
- Per-gate errors no longer abort the pass; a gate whose Ingress is invalid
  loses its route immediately. Network errors become ApiError.
- Gate names carry a hash of namespace/name: unambiguous and bounded to fit
  label values and ak-outpost-<name>.
- Teardown removes only an outpost serving exactly the gate's provider; a
  provider orphaned by an interrupted teardown is adopted on recreation.
- Role gains the expression-policy permissions; tests cover the Authentik
  reconcile against an in-memory API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 20:51:15 +02:00
claude-botandClaude Opus 5.5 bbb1582bcf feat(authentik): authentik-gate ingress class controller
Adds authentik-gate-sync, an in-house controller (ci/images/authentik-gate-sync,
stdlib Python like netbird-service-sync) that implements an `authentik-gate`
IngressClass. An Ingress of that class names its real backend; the controller
turns it into an Authentik proxy gate and wires the upstream ingress provider:

- Authentik: proxy provider, application (meta_publisher marks ownership),
  outpost on the local Kubernetes connection, optional group binding.
- App namespace: ExternalName Service <ingress>-gate -> outpost, Traefik
  Ingress <ingress>-gate (source hosts/paths/TLS/labels/annotations, backend
  swapped, cert-manager annotations dropped so only the source issues), and a
  CNP admitting only this outpost to the backend pods.
- authentik namespace: CNP letting the outpost reach only those pods.

Annotations: auth.renner.uno/group (members managed in Authentik; none = any
user), /login-flow, /authorization-flow (default passkey-stepup-authorization),
/skip-path. Fail closed: the Traefik route is applied last and removed when the
gate's config is invalid (missing group/flow/backend); transient API errors
leave the gate as the last good pass left it.

The API token is zero-touch: an ESO Password generator (CreatedOnce) feeds
both the controller and AUTHENTIK_GATE_SYNC_TOKEN on server/worker, which the
new gate-sync blueprint sets as the key of a non-expiring token for a
service account whose role covers only gate objects.

No existing gate moves yet; llama is migrated in a follow-up once this runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 20:39:50 +02:00