Plan: Epinio's Dex connector against this platform's identity providers
IMPLEMENTATION RULES: Before implementing this plan, read and follow:
- WORKFLOW.md - The implementation process
- PLANS.md - Plan structure and best practices
Status: Verified live end to end for the Authentik connector on BOTH platforms — Rancher Desktop (urb-agents#2056, #2057, 1.6.258) and Proxmox (urb-agents#2058, 1.6.260): real sign-in, a real epinio login token exchange, push, deploy, expose, and a user outside any mapped group correctly walled off. Okta is out of scope for now (needs a real tenant). GitHub connector verified short of browser login.
Goal: wire Epinio's own bundled Dex to up to three identity providers (GitHub,
Authentik, Okta), each mapping its own groups/teams to namespace roles, instead of
Epinio's default basic auth. Referenced by name in 625-setup-epinio.yml since that
playbook first shipped — this is the piece it always deferred.
Migration source: urb-agents#1909/#1911's Epinio PoC on a lab test cluster —
gates 17 (GitHub) and 18 (Authentik, Okta), proven live there. Full gate-by-gate record:
INVESTIGATE-host-epinio-rollout.md in terchris/home. Migrated via urb-agents#2040.
Related: PLAN-service-epinio-001-install, PLAN-service-epinio-004-object-storage
Created: 2026-10-27
Generalized from one hardcoded setup into real parameters
The PoC proved this against one specific GitHub org/teams and one specific Authentik
install's groups. None of that — org name, team names, group names, role mappings — is
generic UIS config; it is one install's own identity structure. Nothing from the PoC's
real values is committed here: each connector is enabled: false by default, and an
operator supplies the real structure via -e @vars-file.yml (the nested shape does not
fit flat -e k=v pairs). Only the OAuth client secrets go through the normal secrets
pipeline (EPINIO_DEX_GITHUB_CLIENT_SECRET etc.) — client IDs are not secret (GitHub's
own OAuth spec treats them as public) and are ordinary playbook vars instead.
The five Dex gotchas, found live during the PoC, baked in rather than left to be rediscovered
dex.connectors[].config.scopesreplaces the default set, not adds —profile/emailare listed explicitly alongsidegroupsin every connector, or Dex's callback fails on a missingnameclaim.- A generic
oidcconnector needsinsecureEnableGroups: truebefore anygroupsclaim is parsed at all, even when the scope is granted and present. - Dex only reads its connector config (a Secret, mounted as a volume) at startup — a
Helm values change needs an explicit
kubectl rollout restart deployment/dexafter, every time.627-setup-epinio-identity.yml's own restart task is unconditional, not gated on "did the config actually change" — confirmed live that a config change with no restart leaves the OLD connector list serving. - Okta's default authorization server sends no
email_verifiedclaim at all —insecureSkipEmailVerified: trueon that connector only. admin:<namespace>alone is not enough — Epinio's own API returns 403 on every call, including a bare namespace list, unless a bare"user"role is also granted. Every group in every connector getsuseralongside whateveradmin:<ns>roles it maps to.
The one genuinely new platform capability this needed: cross-namespace trust
Dex runs in the epinio namespace; Authentik's own TLS certificate (already real,
urb-agents#1917 bug #570) lives in the authentik namespace. Kubernetes Secrets cannot
cross namespaces on their own. New UIS service: reflector
(emberstack/kubernetes-reflector, Helm chart version 9.1.9, confirmed live against the
chart's own repo index 2026-10-27) — mirrors an annotated Secret into other namespaces,
kept in sync automatically on every renewal. 627-setup-epinio-identity.yml patches
Authentik's existing Certificate with the reflection annotations (only when the
authentik connector is enabled), reading the Certificate's current annotations first and
unioning the target namespace list rather than overwriting it — a second future
consumer of the same Certificate must not have its own namespace silently dropped by
this playbook re-running.
What was built
provision-host/uis/services/management/service-reflector.sh+ansible/playbooks/028-setup-reflector.yml/028-remove-reflector.yml— the new service, modeled directly onservice-external-secrets.sh's shape. Remove refuses if anything is still annotated for reflection, same precedent as external-secrets' own ClusterSecretStore check.ansible/playbooks/627-setup-epinio-identity.yml— validates each enabled connector's required fields and secret; when authentik is enabled, patches Authentik's Certificate (union, not overwrite), waits for the mirrored Secret to actually land, renders and merges the Epinio OAuth2/OIDC blueprint into the existingapp-slot1expansion slot (reusing the exact mechanism073-authentik-3-app-slot1-blueprint.yamlalready provides, the same wayservice-authentik-epinio-provider.ymldid during the PoC); rendersmanifests/627-epinio-identity-values.yaml.j2and applies it withhelm upgrade --reuse-values(merges on top of625-setup-epinio.yml's own domain/ TLS/storage values rather than resetting them); patches Dex's Deployment to mount the mirrored CA (chart has no values-level way to add this volume — confirmed viahelm show values); restarts Dex unconditionally; verifies Epinio still answers.manifests/627-epinio-identity-values.yaml.j2— thedex.connectors/rolesMappingHelm values, each connector block independently gated.manifests/627-epinio-authentik-blueprint.yaml.j2— the Authentik-side OAuth2Provider + Application, reusing the existing "Service Groups Mapping" scope mapping073-authentik-service-protection-blueprint.yaml.j2already creates, rather than declaring a second, duplicate one.- Three new secrets (
EPINIO_DEX_GITHUB_CLIENT_SECRET/_AUTHENTIK_CLIENT_SECRET/_OKTA_CLIENT_SECRET) in the standard secrets-templates pipeline. - Two new static tests, both mutation-tested:
test-epinio-identity-structure.sh(required-param gating, the union-not-overwrite logic, the unconditional restart,no_log,--reuse-values) and three new assertions intest-jinja-templates-render.sh(per-connector-combination rendering,rootCAs/insecureSkipEmailVerifiedland on the right connector only, the bareuserrole is never dropped).
Deliberately not consolidated into the existing generic protected_services oauth2 mechanism
073-authentik-service-protection-blueprint.yaml.j2 already has a generic type: oauth2
branch for any service in AUTH10_PROTECTED_SERVICES. It would in principle avoid a
second, bespoke blueprint file. Not used here, on purpose: that branch has no default
example anywhere in this repository and is unexercised by any currently-configured
service — this would be its first real use, and routing Epinio's own already-proven
(during the PoC) bespoke mechanism through it would mean trusting two unproven things at
once instead of one. Worth revisiting as a future consolidation once that generic path
has a real, tested consumer of its own.
Bug found live, fixed in PR #644: reflector collides with Epinio's own bundled copy
Epinio's own upstream Helm chart already bundles emberstack/reflector as a subchart
dependency (confirmed live: release epinio, chart reflector-10.0.58), including a
cluster-scoped ClusterRole literally named reflector. The standalone reflector
service (028-setup-reflector.yml, same upstream chart, pinned 9.1.9) tried to create a
ClusterRole with that same name under a different release, and Helm correctly refused
it. This is not a corner case — it is the exact combination this whole plan exists for
(anyone installing Epinio, then needing the Authentik connector's cross-namespace trust,
hits this every time). Fixed by detecting any already-running reflector controller
cluster-wide (its own design has no release-scoped RBAC — any controller watches
annotated Secrets cluster-wide regardless of which release deployed it) and skipping the
standalone install when one is already present. Found live by imac; not something they
attempted to resolve themselves (a design call, correctly left for this repo).
Validation
GitHub connector, met live except the interactive sign-in itself, 2026-10-27
(urb-agents#2044): imac used a real GitHub org/team, decoded the rendered dex-config
Secret directly (clientID/org/teams/redirectURI all correct, rolesMapping pairs user
unconditionally with the matched group's admin:<ns> role — gotcha 5's fix genuinely
present), confirmed Dex actually restarted and its own logs show the connector loading.
Not verified: an actual interactive sign-in through GitHub's consent screen — no
browser-automation tool was available in that environment, flagged explicitly rather than
claimed. The "no matching group → no roles" case is sound by construction (no catch-all
entry in the rendered rolesMapping) but is inference from the rendered config, not an
observed failed login.
Authentik connector — re-tested 2026-10-27 (urb-agents#2045), two more bugs found and
fixed, one bigger blocker found and NOT fixed here:
- The reflector/Epinio collision fix itself had a small bug in
028-setup-reflector.yml's own detection task: an unquoted jsonpath value brokeansible.builtin.command's own argument splitting. Fixed. With that fixed, imac confirmed the detection-and-skip design is genuinely correct, not just plausible: it found Epinio's bundled reflector controller and skipped cleanly, and — the real open question from before — decoding the actual mirrored Secret live confirmed Epinio's bundled instance does satisfy this plan's cross-namespace mirroring need in practice. - Dex's Deployment had no
hostAliasesfor a.localhostAuthentik hostname — the identical trap class asurb-agents#1928's originalforgejo.localhostbug, recurring in this new connector. Fixed the same proven way (640-setup-forgejo-runner.yml's own pattern: look up Traefik's ClusterIP, alias the hostname to it, only when that hostname actually ends in.localhost). - Past both of those, the connector is still blocked — not by anything in this
plan's own scope. Confirmed host-side and in-cluster identically (not an
in-cluster-specific issue), so it's purely a Traefik TLS/SNI question. A first fix
attempt (
tls.domains, based on reading a Traefik log line as a cert-selection mechanism) was retracted after imac re-tested it live with a full Traefik restart and got the identical wrong certificate — the log line turned out to be about a different Traefik concept (TLSOptionsresolution) entirely, confirmed by reading Traefik's own source. The real mechanism is still not found; see INVESTIGATE-system-traefik-incluster-sni for the full retraction and what live instrumentation is actually needed next.
Authentik connector — re-tested again 2026-10-28 (urb-agents#2051), the TLS blocker confirmed
fixed live, one more real bug found right behind it:
- The
TLSStoreworkaround (INVESTIGATE-system-traefik-incluster-sni.md) is confirmed working: fresh deploy on1.6.255, host-side and in-cluster SNI probes both return the realauthentik-server-tlscertificate instead of Traefik's default — matching serial/fingerprint exactly, not inferred. - Going further, with a real client_id/secret this time:
627-setup-epinio-identity.ymlitself reports success (Dex restarts with the real connector config), but the Authentik-side blueprint (manifests/627-epinio-authentik-blueprint.yaml.j2) silently never created the provider or application —BlueprintInstancesat atstatus: error,redirect_uris: This field is required.On this Authentik version (2025.10.3) that field is mandatory; the blueprint never set it. Fixed, reusing the exact shape already proven elsewhere in this repo (073-authentik-2-openwebui-blueprint.yaml.j2) and Dex's own redirect URI (shared across every connector, not a hand-duplicated copy) — covered by two new mutation-tested render assertions. - Re-verified live (
urb-agents#2054,1.6.256): the blueprint now applies (BlueprintInstancestatus: successful;epinio-appandepinio-providerexist with the correctredirect_uris). Both fixes above work together. - A third bug, right behind them: pushing into the real sign-in, Dex still could not open the
connector —
x509: certificate is valid for authentik.localhost - authentik.x - authentik.y.076-authentik-server-tls-certificate.yaml.j2builtdnsNameswith manual{%-dash whitespace control, which with Ansible'strim_blocksmerged every list item into ONE garbled SAN string, so no strict TLS client could ever match a hostname. Same bug class as635-forgejo.yaml.j2(urb-agents#2026). Fixed with plain block tags, and three new render assertions that check the parsed list (the template had none); a sweep found no other template with the pattern. - Verified live, end to end (
urb-agents#2056,1.6.258) — the first complete sign-in for this connector. The certificate'sdnsNamesis now a real three-entry list; Dex opens the connector with no x509 error; a scripted browser-equivalent flow (Dex/authas the realepinio-uiclient, through Authentik's identification and password stages, back through Dex's callback, code exchange at Dex's token endpoint) produced a real ID token that Dex and Epinio both accept. Epinio's own API then resolved the identity: the globaluserrole, and anadminrole scoped to a namespace the identity created. Test namespace deleted afterwards. Note: a token for theepinio-uiclient alone is correctly rejected by Epinio (expected audience "epinio-api"); the flow needs theaudience:server:client_id:epinio-apiscope, Dex's documented cross-client trust.
Okta connector: not attempted — no real Okta tenant available; shares the
Authentik-identical insecureEnableGroups/insecureSkipEmailVerified code path already
partially exercised by template inspection. Was never expected to hit the Traefik/SNI
issue above — Okta is a real external IdP, not reached through this platform's own
HostRegexp routing at all.
Verified live, the full workflow (urb-agents#2057, 1.6.258) — signing in, building and
deploying as an Authentik user, plus the isolation case:
- Real
epinio login: the CLI performed its own PKCE token exchange and wrote real tokens (audiencesepinio-apiandepinio-cli). It needs a browser or a person at a terminal, which is inherent to OIDC and not something to fix; imac left the real CLI process running and drove only the browser steps through Authentik's flow executor API. - Push, deploy, expose:
epinio pushbuilt and stored a real app (Paketo Node buildpack, x86),scripts/epinio/epinio-expose-route.shexposed it, and it answered on both Epinio's own ingress and the Traefik hostname route. The Garageepiniobucket grew after the push, so the data lands where it should. - A user in no mapped group: only the default
userrole, no groups claim at all, a 403 on the mapped namespace and its applications, and still able to create a namespace of their own. This closes the long-open "no matching group lands with no roles" question with an observed result.
Confirmed again on Proxmox (urb-agents#2058, 1.6.260) — the same chain, independently, on
the other real deployment target this repo supports. Same result: login → push → expose → Garage
worked for the mapped user, and the unmapped user was cleanly walled off. Two real bugs surfaced
and fixed as part of closing this out, both in 627-setup-epinio-identity.yml:
- it assumed Epinio's own Helm repo was still registered from
625-setup-epinio.yml's earlier run in the same container — true only until auis pullcontainer restart drops Helm's repo list. Now registered unconditionally before the identity helm upgrade (the module is idempotent). - its own post-change "Epinio still answers" check hard-failed on every
.localhostdeploy, even though Epinio was fine — the ansible controller has no route to cluster ClusterIPs at all for that domain, so the check could never pass from there. Matched to625-setup-epinio.yml's own equivalent check: advisory (ignore_errors), not a gate.
One operational note for whoever next automates a sign-in through Authentik's flow executor API
for testing (both ops and imac have now separately driven this headless, each hitting a different
part of it): the consent step's POST needs a Referer header, or Django's CSRF check rejects it
with "Referer checking failed - no Referer" even with a valid X-Authentik-CSRF header and cookie.
Invisible from a real browser, which always sends one.
How the role mapping actually behaves — read this before configuring it
Settled from Epinio's own source (internal/auth/role.go, v1.14.3), not inferred.
admin:workspace is literal role=admin, namespace=workspace syntax, split on :. It grants
admin on a namespace named exactly workspace, nothing else. It is not "admin of whatever
namespace this group creates", and this static form cannot express that.
- The default
userrole (everyone, mapped or not) hasnamespace_write, so anyone can create a namespace, but notapp_write. Creating your own namespace therefore does not let you deploy into it. imac's first push, into a namespace they had created, got403 user unauthorizedfor exactly this reason. - So with a mapping like
HQ -> admin:workspace, HQ members can deploy only into the sharedworkspacenamespace. This also settles an earlier doubt: theadminrole imac saw on a namespace they created was Epinio granting it to the creator, not the group mapping, which only ever applies to the namespace it names. - To give each team its own namespace, create those namespaces ahead of time and map each team's
group to
admin:<its-namespace>. There is no way yet to say "admin of any namespace I create".
Not proven, and not blocking:
- The token's
groupsclaim carried a duplicate entry (["HQ","HQ"]). imac cleared Authentik: the user has exactly one membership and the mapping expression cannot duplicate. It is consistent with Dex merging the ID token's claim with a second copy from userinfo, but that mechanism was not confirmed in Dex's source. Cosmetic as far as anyone can tell. - Okta, which needs a real tenant. Out of scope for now.
- Building on arm64 (ops' gate 16) is untested here; the verified build ran on x86.