keycloak: admin console does not load through the sshd forward #644
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
priority
high
priority
low
priority
medium
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-infra#644
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "%!s()"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
What
The Keycloak admin console does not load through the sshd forward. Opening
http://127.0.0.1:18080/admin/master/console/spins, then shows:Seen on staging with image
26.8.0-3. The admin REST API through the same forward works.Why
KC_HOSTNAMEis the public URL (keycloak.container.j2). The console builds its URLs from it, so it loads the third-party-cookie check iframe fromhttps://id.stg.bitborg.se/realms/master/.... Caddy answers 404 for everything outside/realms/bitborg/*and/resources/*, so the iframe never posts its message.Today every realm change goes through OpenTofu or the admin API, so nothing depends on the console. It is still the fastest tool for break-glass inspection, and the runbook's "Reach the admin API" section does not say the console is unavailable.
Fix
Set
KC_HOSTNAME_ADMIN=http://127.0.0.1:18080so the console and its master-realm calls stay on the forward. The public edge stays as it is. Verify on staging that the console loads and signs in through the forward, and that the public hostname and issuer do not change.If the console is not wanted, say so in the runbook section instead.
Done when
issfor thebitborgrealm is unchanged.Partly explained by #647: the shared Caddy headers sent
X-Frame-Options: DENYon the Keycloak vhost, which blocked the console's same-origin cookie-check iframe. That fixed the account console onid.stg.The admin console through the forward is still a separate case. It is served from
127.0.0.1:18080but loads the iframe fromhttps://id.stg.bitborg.se, which is cross-origin, and Keycloak'sframe-ancestors 'self'blocks that.KC_HOSTNAME_ADMINremains the proposed fix.Status 2026-10-21, parked.
KC_HOSTNAME_ADMIN=http://127.0.0.1:18080is live on staging. The console HTML now hasauthUrl: http://127.0.0.1:18080, and thebitborgissuer is unchanged. The console still fails with "Timeout when waiting for 3rd party check iframe message".Cause: the console's
authServerUrlis stillhttps://id.stg.bitborg.se. The 3p-cookie iframe loads<authServerUrl>/realms/master/protocol/openid-connect/3p-cookies/step1.html, and Caddy serves only thebitborgrealm publicly, so that URL returns 404.Proposed fix, untested: set the master realm attribute
frontendUrltohttp://127.0.0.1:18080. Every master consumer in this repo (OpenTofu, the keycloak role's admin calls) already uses that URL. If a manual test on staging works, add it to the keycloak role next to theadminEventsExpirationtask.The manual test stopped at getting a token: a password grant for the temporary admin on
admin-clireturned noaccess_token. The error body was not read yet. Next: print the raw token response, or use theopentofuclient token fromscripts/keycloak-tofu-env.py staging.A temporary master admin from
bootstrap-admin usermay still exist on staging. Delete it.