mirror of
https://gitlab.archlinux.org/archlinux/infrastructure.git
synced 2026-11-29 19:54:47 +01:00
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>
78 lines
2.4 KiB
YAML
78 lines
2.4 KiB
YAML
matrix_max_upload_size: 100M
|
|
matrix_nginx_config:
|
|
- name: draupnir
|
|
port: 8010
|
|
locations:
|
|
- path: "~ ^/_matrix/client/(r0|v3)/rooms/([^/]*)/report/(.*)$"
|
|
pass: "/api/1/report/$2/$3"
|
|
add_cors: true
|
|
- name: federation_reader
|
|
port: 8011
|
|
locations:
|
|
- "~ ^/_matrix/federation/v1/version$"
|
|
- "~ ^/_matrix/federation/v1/event/"
|
|
- "~ ^/_matrix/federation/v1/state/"
|
|
- "~ ^/_matrix/federation/v1/state_ids/"
|
|
- "~ ^/_matrix/federation/v1/backfill/"
|
|
- "~ ^/_matrix/federation/v1/get_missing_events/"
|
|
- "~ ^/_matrix/federation/v1/publicRooms"
|
|
- "~ ^/_matrix/federation/v1/query/"
|
|
- "~ ^/_matrix/federation/v1/make_join/"
|
|
- "~ ^/_matrix/federation/v1/make_leave/"
|
|
- "~ ^/_matrix/federation/(v1|v2)/send_join/"
|
|
- "~ ^/_matrix/federation/(v1|v2)/send_leave/"
|
|
- "~ ^/_matrix/federation/v1/make_knock/"
|
|
- "~ ^/_matrix/federation/v1/send_knock/"
|
|
- "~ ^/_matrix/federation/(v1|v2)/invite/"
|
|
- "~ ^/_matrix/federation/v1/event_auth/"
|
|
- "~ ^/_matrix/federation/v1/timestamp_to_event/"
|
|
- "~ ^/_matrix/federation/v1/exchange_third_party_invite/"
|
|
- "~ ^/_matrix/federation/v1/user/devices/"
|
|
- "~ ^/_matrix/key/v2/query"
|
|
- "~ ^/_matrix/federation/v1/hierarchy/"
|
|
- "~ ^/_matrix/federation/v1/send/"
|
|
- name: media_repository
|
|
port: 8013
|
|
locations:
|
|
- "~ ^/_matrix/media/"
|
|
- "~ ^/_matrix/client/v1/media/"
|
|
- "~ ^/_matrix/federation/v1/media/"
|
|
- "~ ^/_synapse/admin/v1/purge_media_cache$"
|
|
- "~ ^/_synapse/admin/v1/room/.*/media.*$"
|
|
- "~ ^/_synapse/admin/v1/user/.*/media.*$"
|
|
- "~ ^/_synapse/admin/v1/media/.*$"
|
|
- "~ ^/_synapse/admin/v1/quarantine_media/.*$"
|
|
- "~ ^/_synapse/admin/v1/users/.*/media$"
|
|
- name: mas
|
|
port: 8009
|
|
locations:
|
|
- "~ ^/_matrix/client/(.*)/(login|logout|refresh)"
|
|
- name: homeserver
|
|
port: 8008
|
|
locations:
|
|
- "/_matrix"
|
|
- "/_synapse"
|
|
- name: ircmedia
|
|
port: 8014
|
|
locations:
|
|
- path: "/ircmedia/"
|
|
pass: "/"
|
|
|
|
matrix_metrics_endpoints:
|
|
- name: synapse.homeserver
|
|
port: 8019
|
|
- name: synapse.appservice
|
|
port: 8020
|
|
- name: synapse.federation_reader
|
|
port: 8021
|
|
- name: synapse.federation_writer
|
|
port: 8022
|
|
- name: synapse.media_repository
|
|
port: 8023
|
|
- name: irc-bridge
|
|
port: 8024
|
|
path: metrics
|
|
- name: mas
|
|
port: 8025
|
|
path: metrics
|