hyperhive/nix/host-modules
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas f778122f5a matrix: mint the appservice sender token in the matrix container
A swarm runs one homeserver and a homeserver has one appservice sender
account, so "mint it once" is a property of the thing being minted
rather than something a lock has to enforce. That is what makes this
account the one to move first: no trigger route, no controller change
and no agent list — a boot-time oneshot beside tuwunel is the whole
mechanism.

`swarm-matrix-minter` runs inside `containers.hive-matrix`, which
already holds the appservice token: the rendered registration is bound
in read-only because that is how tuwunel is handed it. What the
container lacked was an identity of its own, so this adds one — a leaf
from the store's CA with a grant of exactly one path, not the hive's
leaf, which reads every secret in the store.

Both ends of the credential ship here. The minter reads the path it
publishes to before it touches the homeserver, and returning on a
non-empty read IS the "only once"; `hive-c0re`'s `ensure_hive_user`
reads the same path, authenticating with the hive name already in
`HYPERHIVE_HIVE_NAME`. The existing mint-then-`M_USER_IN_USE`-login
ladder stays as the fallback for a store that is empty, unconfigured or
unreachable, which is every swarm deployed before this — so nothing
needs backfilling and nothing breaks if the rest of the sequence never
lands.

The credential is not an admin credential, and is not named like one.
It is the access token of the appservice registration's own
`sender_localpart` — `@hive:<server_name>`, an account the homeserver
creates for itself when it loads the registration. The store path is
`swarm/services/matrix/sender-token`, the host path is
`matrix/access-token`, and the homeserver no longer runs an
`admin_execute` promotion for that account at boot. Everything the hive
provisions with it — the Space, the chat room, their hierarchy and join
rules, the invites — rides on being the creator of those rooms at power
level 100, not on homeserver admin; there is no Synapse admin API here
to need, tuwunel has none.

Two operations do need an admin *sender* and therefore stop working:
`hivectl matrix promote-user` and `hivectl matrix reset-password`, both
`!admin …` messages into `#admins:<server>`, plus the password-reset
recovery path that an agent with a lost password file falls back to.
They are swarm-level operations and are left failing loudly rather than
served by an over-privileged token every other call site would also
carry. The sweep's own admin-rights check and self-repair go with them:
an account that is deliberately not an admin has nothing to check.

`ephemeral = false` stays, and hive root can still read the container's
filesystem. Accepted: what this buys is identity separation — no hive
*process* holds or reads the appservice token — not physical isolation.

Refs #4345
2026-09-20 22:07:16 +02:00
..
hive-c0re nix: give the gateway, resolver and bridge their own enable 2026-09-19 13:53:10 +02:00
hive-forge nix: give the gateway, resolver and bridge their own enable 2026-09-19 13:53:10 +02:00
hive-gateway docs(gateway): describe nginx as per-host, not a deployment-wide singleton 2026-09-19 13:58:10 +02:00
lib swarm: extract the name guards, so the module just says what is forbidden 2026-08-31 18:50:15 +02:00
swarm-grafana/dashboards swarm-grafana: sort logstore bargauge panels by value 2026-09-20 20:02:42 +02:00
default.nix matrix: mint the appservice sender token in the matrix container 2026-09-20 22:07:16 +02:00
deploy.nix swarm-controller: make socketPath readOnly instead of asserting it 2026-09-17 19:27:30 +02:00
glue-bao-tls.nix matrix: mint the appservice sender token in the matrix container 2026-09-20 22:07:16 +02:00
glue-controller-bao-identity.nix swarm-controller: hand the daemon the authority hives are issued from 2026-09-10 00:25:07 +02:00
glue-grafana-oidc-client.nix swarm-grafana: deliver the OIDC client secret through the secret store 2026-09-13 19:57:28 +02:00
glue-matrix-bao-token.nix matrix: remove the registration token 2026-09-15 19:58:10 +02:00
glue-matrix-minter-bao-identity.nix matrix: mint the appservice sender token in the matrix container 2026-09-20 22:07:16 +02:00
glue-queue-agent-credential.nix matrix: remove the registration token 2026-09-15 19:58:10 +02:00
glue-secret-publisher-bao-identity.nix swarm: publish minted OIDC client secrets into the swarm store 2026-09-12 11:22:33 +02:00
glue-swarm-otel-oidc-client.nix swarm-otel: deliver the OIDC client secret through the secret store 2026-09-14 00:58:58 +02:00
hive-ci.nix nix: give the gateway, resolver and bridge their own enable 2026-09-19 13:53:10 +02:00
hive-matrix.nix matrix: mint the appservice sender token in the matrix container 2026-09-20 22:07:16 +02:00
hive-network.nix nix: give the gateway, resolver and bridge their own enable 2026-09-19 13:53:10 +02:00
hive-priv.nix docs: restructure into topic subdirectories, collapse duplicated index 2026-09-02 01:55:37 +02:00
hive-tls.nix docs: restructure into topic subdirectories, collapse duplicated index 2026-09-02 01:55:37 +02:00
hyperhive.nix docs: restructure into topic subdirectories, collapse duplicated index 2026-09-02 01:55:37 +02:00
local-defaults.nix bao: write the swarm controller's policy from inside the store 2026-09-07 18:43:09 +02:00
otel.nix nix: give the gateway, resolver and bridge their own enable 2026-09-19 13:53:10 +02:00
stylix-theme.nix swarm-ui: apply the operator's stylix theme, same as the dashboard already does 2026-08-24 14:28:25 +02:00
swarm-authelia.nix nix: derive hive identities and the token endpoint from the swarm, not this host 2026-09-19 14:31:19 +02:00
swarm-bao.nix matrix: mint the appservice sender token in the matrix container 2026-09-20 22:07:16 +02:00
swarm-ca.nix swarm-ca: state the store-is-world-readable rule once, not three times 2026-09-02 09:03:35 +02:00
swarm-container-resolver.nix fix(#3363): swarm containers write their own resolver file 2026-08-17 17:30:15 +02:00
swarm-controller.nix nix: drop the central-toggle conjunct from four compound gates 2026-09-19 10:48:12 +02:00
swarm-grafana.nix grafana: move logLevelRules implementation notes to docs 2026-09-20 17:39:04 +02:00
swarm-nats.nix nix: give the gateway, resolver and bridge their own enable 2026-09-19 13:53:10 +02:00
swarm-otel.nix otel: map journald PRIORITY onto a severity at every journald receiver 2026-09-20 14:23:56 +02:00
swarm-peers-removed.nix docs+nix: fix stale certFingerprint/HYPERHIVE_PEERS references (hyperhive#3294) 2026-08-15 19:56:11 +02:00
swarm-required-services.nix nix: give the gateway, resolver and bridge their own enable 2026-09-19 13:53:10 +02:00
swarm-secret-publisher.nix matrix: publish the appservice token from the swarm, not just read it 2026-09-15 20:57:49 +02:00
swarm-snapshot-store.nix deploy: move the wireguard mesh out of the namespace hives read 2026-09-07 14:24:52 +02:00
swarm-ui.nix nix: give the gateway, resolver and bridge their own enable 2026-09-19 13:53:10 +02:00
swarm-victorialogs.nix nix: give the gateway, resolver and bridge their own enable 2026-09-19 13:53:10 +02:00
swarm-victoriametrics.nix nix: give the gateway, resolver and bridge their own enable 2026-09-19 13:53:10 +02:00
swarm-wireguard.nix deploy: move the wireguard mesh out of the namespace hives read 2026-09-07 14:24:52 +02:00
swarm.nix matrix: mint the appservice sender token in the matrix container 2026-09-20 22:07:16 +02:00