Files
infrastructure/group_vars/all/vault_postgres.yml
Jan Alexander Steffens (heftig)andAntigravity 5e461e81b3 matrix: Add matrix-authentication-service
Staff Role Restriction (Keycloak)
---------------------------------

Because matrix-authentication-service lacks an equivalent to Synapse's
attribute_requirements (and claims_imports only runs during initial
registration/linking, so it would not block offboarded users on later
logins), enforce the Staff role requirement directly in Keycloak before
any OIDC tokens or client sessions are issued:

- Add a `staff_only` client scope (`include_in_token_scope = false`) and
  attach it as a default scope on `openid_matrix_mas` so users cannot
  strip it from the authorization request.

- In `Arch Browser`, wrap Cookie, Identity Provider Redirector, and
  Password+2FA in a REQUIRED `Browser Auth Subflow`, followed by a
  CONDITIONAL `Browser Staff Role Check Subflow` combining
  `conditional-client-scope` (`staff_only`), `conditional-user-role`
  (`Staff`, negated), and `deny-access-authenticator`. Wrapping the auth
  steps ensures SSO cookie reuse still hits the role check.

- In `Arch Post IPR Flow`, wrap the 2FA steps in a REQUIRED `IPR 2FA
  Subflow` and add the same conditional check (`IPR Staff Role Check
  Subflow`), since GitHub broker logins skip the rest of the browser
  flow. Non-Staff users can still sign into other clients via GitHub
  while being denied access to `openid_matrix_mas`.

Cutover Checklist
-----------------

1. Run `terraform init && terraform apply` in tf-stage1 (DNS for
   auth.matrix.archlinux.org) and tf-stage2 (Keycloak flows, scope, and
   openid_matrix_mas client).
2. Run the playbook tags/steps up to installing
   matrix-authentication-service, creating the mas DB, rendering
   /etc/matrix-authentication-service/config.yaml, and migrating the MAS
   DB (`mas-cli database migrate`), or deploy with Synapse stopped while
   migrating.
3. Stop synapse.service (and workers), run `mas-cli syn2mas check` and
   `mas-cli syn2mas migrate --dry-run` (checking
   /etc/matrix-authentication-service/config.yaml and
   /etc/synapse/homeserver.yaml before homeserver.yaml removes
   `oidc_providers`), then run the live `mas-cli syn2mas migrate`.
4. Run playbooks/matrix.archlinux.org.yml to switch homeserver.yaml,
   reload nginx, and start synapse + matrix-authentication-service
   + matrix-authentication-service-worker.
5. Test login with a Staff account and verify non-Staff accounts are
   denied via password+2FA, existing Keycloak SSO cookie, and GitHub
   broker login.

Co-Authored-By: Antigravity (Gemini 4 Neon) <noreply@google.com>
2026-11-29 01:20:03 +01:00

23 lines
1.7 KiB
YAML

$ANSIBLE_VAULT;1.1;AES256
35663037643064326434663866303934366337393236343237353239643634633462643266613766
3361363431386633616439303338326639643265393362350a363065363738373866653465356139
37383934303266363564383765376136656133366138326166646661643731393366376264323231
3362666335313838390a326334333631313065646139323964323835346664636661393135633961
30336261613131613137306161336362346232643962366534656431633533613731653834393737
61373137656439373663363736656661363731336238636462623665323664646635373336326438
30323035333630393733656166643939386364643461363365363365353162363033343666393336
65316664646163643333663136316335343832316634353134663737363138376636613435363865
34396132356636353365646366366262643364663761326634326539306364666538376362643436
30336561363530353232663532303565326533343535313938366161356661333238646537383932
66373637616537653438663034313536366162666433373432383262386465623261343233373863
33306532353234613764613035666638346466393366323465346362303062386330376433613361
35323966313132343364303231343463636161363332646638366662373634366435383932623464
31643661306461343563343065636566386561333665366332643333386663363934663233363430
32316562373130656664333833346633633432343062656534616465373365303134353537383439
63326339356365353862646664343839393739663538326364303362373465396162623261336564
36653566623032353135653633363635396536633732363264653838333362396439646562663464
65336136363137333635343435353031363935326436346631393364373631653165383731356238
37663935343438626466343861373934393237313262616136393836666636323035326539653531
32396431303737383734666232363639353663316639666639383033663933336334316538316631
61396163333665316232353865336365353433623931383166623063386232363465