1ecba543aa
## Why
The old bare `sonarr`/`radarr` Services are gone, but arrproxy still ran the v0.3.x built-in default topology pointing at non-existent `sonarr`/`radarr` upstreams and mounted dead `sonarr-apikey`/`radarr-apikey` Secrets. This cuts the front door over to arrproxy v0.4.0 tier routing so the adult (fafflix, `/3aa168`) and kids (cheeztv, `/3df803`) *arr instances are reachable again, with per-tier group authorization.
## Changes
- Bump `arrproxy-api` and `arrproxy-ui` images to `v0.4.0`.
- Add `arrproxy-tiers` ConfigMap (`ARRPROXY_TIERS_FILE`): `fafflix` + `cheeztv` tiers, each with sonarr/radarr upstreams, route hash, key subdir and group grants. Adults (`akP-media-fafflix`) reach both tiers all methods; kids (`akP-media-cheeztv`) reach only cheeztv, GET/HEAD. `legacyRoutes:false` retires the unprefixed routes.
- Because arrproxy strips `/<hash>` and proxies `/<app>/...`, each upstream URL carries the `/<hash>` path segment so the joined upstream path (`/3aa168/sonarr/...`) matches the *arr's own UrlBase.
- Mount the tiers file and rework the projected keys volume to the real per-instance `{sonarr,radarr}-{adult,kids}-apikey` Secrets under `<keyDir>/<app>` (`adult/*`, `kids/*`); refresh reloader annotations.
- oauth2-proxy: route `/3aa168` and `/3df803` to arrproxy-api (drop dead `/sonarr` `/radarr` `/prowlarr`; prowlarr is served directly), and widen `SKIP_AUTH_REGEX` to `^/[^/]+/[^/]+/api` for the hash-prefixed tier api paths.
Group headers keep flowing via the existing Authentik `ak_groups` claim -> oauth2-proxy `X-Forwarded-Groups` mechanism. Validated with `kustomize build` + repo kubeconform (88/88 valid). No new Vault seeds required — the per-instance apikey Secrets already exist.
Reviewed-on: #416
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
61 lines
3.6 KiB
YAML
61 lines
3.6 KiB
YAML
---
|
|
# Non-secret oauth2-proxy configuration (client_id/secret/cookie_secret come from
|
|
# the oauth-credentials Secret). oauth2-proxy is the single auth front for the
|
|
# arrstack: it authenticates the UI and the token API against Authentik, and path-
|
|
# routes to the arrproxy-ui / arrproxy-api upstreams. /<app>/api is exempted from
|
|
# auth (SKIP_AUTH_REGEX) so *arr clients presenting a per-user token reach the api
|
|
# directly; the api then validates the token. Everything else requires the oauth
|
|
# session and receives identity via X-Forwarded-* / X-Auth-Request-* headers.
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: arrproxy-oauth2-env
|
|
namespace: arrstack
|
|
annotations:
|
|
argocd.argoproj.io/sync-wave: "2"
|
|
data:
|
|
OAUTH2_PROXY_HTTP_ADDRESS: "0.0.0.0:4180"
|
|
OAUTH2_PROXY_PROVIDER: "oidc"
|
|
# Authentik arrstack app discovery issuer (served by the internal unkin.net CA;
|
|
# trusted via PROVIDER_CA_FILES below). CONFIRM the slug matches the Authentik
|
|
# application (terraform-authentik PR #18).
|
|
OAUTH2_PROXY_OIDC_ISSUER_URL: "https://identity.unkin.net/application/o/arrstack/"
|
|
OAUTH2_PROXY_REDIRECT_URL: "https://arrstack.unkin.net/oauth2/callback"
|
|
# Longest-prefix wins: /api and the per-tier hash routes (/3aa168, /3df803) go
|
|
# to arrproxy-api, everything else (the SPA + static assets) to arrproxy-ui.
|
|
# Tier routes carry /<hash>/<app>/...; the bare /sonarr /radarr /prowlarr
|
|
# upstreams are retired (legacy routes off; prowlarr is served directly).
|
|
OAUTH2_PROXY_UPSTREAMS: "http://arrproxy-ui.arrstack.svc.cluster.local:8080/,http://arrproxy-api.arrstack.svc.cluster.local:8080/api/,http://arrproxy-api.arrstack.svc.cluster.local:8080/3aa168/,http://arrproxy-api.arrstack.svc.cluster.local:8080/3df803/"
|
|
OAUTH2_PROXY_SCOPE: "openid email profile ak_groups"
|
|
# Populate session.Groups from the Authentik ak_groups claim; pass-user-headers
|
|
# then emits it as a single comma-joined X-Forwarded-Groups header.
|
|
OAUTH2_PROXY_OIDC_GROUPS_CLAIM: "ak_groups"
|
|
# Forward identity + groups to arrproxy-api as X-Forwarded-{User,Email,Groups}
|
|
# (the api reads these; ARRPROXY_GROUPS_HEADER=X-Forwarded-Groups). NOTE:
|
|
# set-xauthrequest is intentionally NOT set -- it only populates auth_request
|
|
# *response* headers, which never reach an --upstreams-proxied backend.
|
|
OAUTH2_PROXY_PASS_USER_HEADERS: "true"
|
|
# Bypass auth for the tier *arr proxy API (/<hash>/<app>/api...) and the
|
|
# machine-mint admin route (/api/admin/...). The first matches
|
|
# /3aa168/sonarr/api (two path segments before /api, since tier routes are
|
|
# hash-prefixed); the second matches /api/admin/ only -- both routed to the
|
|
# arrproxy-api upstream by the tier and catch-all /api/ prefixes above.
|
|
# /api/admin/ is protected by arrproxy's OWN ARRPROXY_ADMIN_TOKEN bearer
|
|
# (OpenBao on the VMs reaches it via the ingress), so it is intentionally
|
|
# oauth-skipped. /api/tokens and /api/me are NOT matched and stay
|
|
# oauth-authenticated.
|
|
OAUTH2_PROXY_SKIP_AUTH_REGEX: "^/[^/]+/[^/]+/api,^/api/admin/"
|
|
OAUTH2_PROXY_EMAIL_DOMAINS: "*"
|
|
# Authentik hardcodes email_verified=false in the id_token; without this
|
|
# oauth2-proxy rejects the session ("email ... isn't verified") -> 500 on
|
|
# /oauth2/callback. Authorization is enforced downstream via ak_groups, so
|
|
# accepting the unverified email here is safe.
|
|
OAUTH2_PROXY_INSECURE_OIDC_ALLOW_UNVERIFIED_EMAIL: "true"
|
|
OAUTH2_PROXY_COOKIE_SECURE: "true"
|
|
OAUTH2_PROXY_COOKIE_DOMAINS: "arrstack.unkin.net"
|
|
OAUTH2_PROXY_WHITELIST_DOMAINS: "arrstack.unkin.net"
|
|
OAUTH2_PROXY_REVERSE_PROXY: "true"
|
|
OAUTH2_PROXY_PROVIDER_CA_FILES: "/etc/ssl/combined/ca-certificates.crt"
|
|
OAUTH2_PROXY_CODE_CHALLENGE_METHOD: "S256"
|
|
OAUTH2_PROXY_SKIP_PROVIDER_BUTTON: "true"
|