feat(base): allow a loopback forward for the keycloak admin api #598

Sammanfogat
supernaut sammanfogade 2 incheckningar från feat/sshd-keycloak-admin-forward in i main 2026-10-08 19:21:02 +00:00
Ägare

OpenTofu reaches the Keycloak admin API over an SSH local forward from the operator machine (ADR 0015 amendment, bitborg/bitborg-docs#135). sshd forbids all TCP forwarding today.

What

  • sshd_bitborg.conf.j2: a final Match User admin block with AllowTcpForwarding local and PermitOpen 127.0.0.1:{{ keycloak_admin_forward_port }}. Agent and stream-local forwarding stay off.
  • The block renders only on the services host and only where keycloak_enabled is true. It defaults to false, so prod sshd is unchanged until cutover. The monitoring VM never gets it.
  • group_vars/all/vars.yml: keycloak_enabled: false, keycloak_admin_forward_port: 18080. The keycloak role (#570) reuses both.
  • roles/base/tasks/main.yml: asserts on sshd -T -C output. The admin user may forward only to that port where Keycloak is enabled. Another user, and the admin user elsewhere, stay at no.
  • Runbook: the tunnel command.

Verified

  • Rendered template, sshd -t -f in Debian 13 for both groups. sshd -T -C shows allowtcpforwarding local and permitopen 127.0.0.1:18080 for admin, no for other users and on monitoring.
  • Gate rendering: services host with keycloak_enabled=false has no Match block, true has it, monitoring never.
  • prettier, markdownlint, check-renovate-annotations.py.

Not verified

  • ansible-lint did not run locally. CI runs it.
  • The new assert tasks have not run in a playbook. They match the sshd -T output above.

Refs #571

OpenTofu reaches the Keycloak admin API over an SSH local forward from the operator machine (ADR 0015 amendment, bitborg/bitborg-docs#135). sshd forbids all TCP forwarding today. ## What - `sshd_bitborg.conf.j2`: a final `Match User admin` block with `AllowTcpForwarding local` and `PermitOpen 127.0.0.1:{{ keycloak_admin_forward_port }}`. Agent and stream-local forwarding stay off. - The block renders only on the services host and only where `keycloak_enabled` is true. It defaults to false, so prod sshd is unchanged until cutover. The monitoring VM never gets it. - `group_vars/all/vars.yml`: `keycloak_enabled: false`, `keycloak_admin_forward_port: 18080`. The keycloak role (#570) reuses both. - `roles/base/tasks/main.yml`: asserts on `sshd -T -C` output. The admin user may forward only to that port where Keycloak is enabled. Another user, and the admin user elsewhere, stay at `no`. - Runbook: the tunnel command. ## Verified - Rendered template, `sshd -t -f` in Debian 13 for both groups. `sshd -T -C` shows `allowtcpforwarding local` and `permitopen 127.0.0.1:18080` for admin, `no` for other users and on monitoring. - Gate rendering: services host with `keycloak_enabled=false` has no Match block, `true` has it, monitoring never. - prettier, markdownlint, `check-renovate-annotations.py`. ## Not verified - ansible-lint did not run locally. CI runs it. - The new assert tasks have not run in a playbook. They match the `sshd -T` output above. Refs #571
supernaut lade till 2 incheckningar 2026-10-08 19:18:24 +00:00
supernaut schemalade den här ändringsförfrågan för automatisk sammanfogning när alla kontroller lyckas 2026-10-08 19:19:54 +00:00
supernaut sammanfogade incheckning 9a0848734d till main 2026-10-08 19:21:02 +00:00
supernaut tog bort grenen feat/sshd-keycloak-admin-forward 2026-10-08 19:21:02 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-infra!598
Ingen beskrivning angiven.