matrix: drop the per-hive appservice and its unused token
Every hive's homeserver loaded a per-hive `hyperhive` appservice
registration, and the swarm minted and delivered an as_token for it
through bao. No client presented that token: swarm-controller creates
every `@hive-<hive>` sender and every agent account with the swarm
appservice token (hive_sender.rs, agent_token.rs), and no Rust code read
the per-hive one.
Removed, with everything that existed only to serve it:
- hive-matrix.nix: the `hyperhive` registration, its activation-time
render, the host bind mount of /var/lib/hyperhive/matrix-appservice,
its LoadCredential entry, and the internal options
`deploy.matrix.appserviceTokenFile` / `appserviceRegistrationScript`.
tuwunel now loads only the swarm registration.
- glue-matrix-bao-token.nix and its `swarm-bao-matrix-token` unit.
- glue-bao-tls.nix: the matrix-token leaf and its defaults.
- swarm-bao.nix: the `swarm-matrix-token-<hive>` roles and policies
(`swarm-bao-matrix-token-policy`), and the options
`deploy.bao.matrixTokenClient{Cert,Key}File` and
`matrixTokenCommonNamePrefix`, now mkRemovedOptionModule.
- swarm-secret-publisher.nix: the per-hive token mint and its state dir.
- swarm.nix: the reserved `<matrixTokenCommonNamePrefix>-<hive>` CN.
- swarm-secret-client: `matrix::appservice_token_path`.
The swarm registration (swarm-matrix-ctl, swarm-controller) is untouched.
Comments and docs that pointed at the removed glue file now point at
glue-queue-agent-credential.nix, which has the same reader shape.
Refs #4428
This commit is contained in:
parent
e4b170f8c6
commit
48067d07e8
31 changed files with 362 additions and 1233 deletions
|
|
@ -38,19 +38,18 @@ const ENV_DIR: &str = "MATRIX_APPSERVICE_DIR";
|
|||
/// The registration's `sender_localpart`: the account the homeserver creates
|
||||
/// for it and the one `admin_execute` promotes.
|
||||
const ENV_SENDER: &str = "MATRIX_APPSERVICE_SENDER";
|
||||
/// The user namespace regex, rendered by nix beside the hive registration's.
|
||||
/// The user namespace regex, rendered by nix.
|
||||
const ENV_USER_REGEX: &str = "MATRIX_APPSERVICE_USER_REGEX";
|
||||
/// Role on the store's `cert` auth mount that [`publish`] logs in with.
|
||||
const ENV_CERT_ROLE: &str = "MATRIX_APPSERVICE_CERT_ROLE";
|
||||
|
||||
/// The registration's `id`. Distinct from the hive registration's
|
||||
/// (`hyperhive`): tuwunel refuses two registrations with one id.
|
||||
/// The registration's `id`.
|
||||
const ID: &str = "swarm";
|
||||
/// File names inside [`ENV_DIR`]. `REGISTRATION` is what tuwunel loads.
|
||||
const AS_TOKEN: &str = "as-token";
|
||||
const HS_TOKEN: &str = "hs-token";
|
||||
const REGISTRATION: &str = "swarm.yaml";
|
||||
/// Random bytes per token, as the hive registration's renderer uses.
|
||||
/// Random bytes per token.
|
||||
const TOKEN_BYTES: usize = 32;
|
||||
|
||||
/// Read a required variable.
|
||||
|
|
@ -115,11 +114,11 @@ fn write_secret(path: &Path, contents: &str) -> Result<()> {
|
|||
std::fs::rename(&tmp, path).with_context(|| format!("renaming onto {}", path.display()))
|
||||
}
|
||||
|
||||
/// The registration, in the shape `hive-matrix.nix` renders the hive's.
|
||||
/// The registration tuwunel loads.
|
||||
///
|
||||
/// `exclusive: false` for that file's reason: an exclusive namespace does not
|
||||
/// widen what this appservice may do, it refuses everyone else — and the hive
|
||||
/// registration covers the same names until it is retired.
|
||||
/// `exclusive: false` for the reason `hive-matrix.nix` gives at
|
||||
/// `appserviceUserRegex`: an exclusive namespace does not widen what this
|
||||
/// appservice may do, it refuses everyone else.
|
||||
fn registration_yaml(sender: &str, regex: &str, as_token: &str, hs_token: &str) -> String {
|
||||
format!(
|
||||
"id: {ID}\n\
|
||||
|
|
|
|||
Loading…
Reference in a new issue