hyperhive/nix/module-eval
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas f1445b4c8b swarm-bao: give each hive-cert consumer its own bao identity
Four units read one path each out of the store, and all four logged in
holding `deploy.bao.clientCertFile` — the hive's own leaf. Bao identifies
a principal by the subject of the certificate it presents, so four
readers behind one certificate were ONE principal, and the only grant
expressible was the union of what the four need: read on
`swarm/agents/*`, `swarm/hives/<hive>/*` and `swarm/services/*`. The unit
fetching Grafana's OIDC client secret could fetch every agent credential
in the swarm; the one fetching this hive's matrix token could fetch
Grafana's. Least privilege was not misconfigured here, it was
unrepresentable.

Each now holds a leaf, a cert-auth role and a policy of its own, and each
policy is the single `secret/data/…` path that unit's own script names —
spelled to the leaf, not to a prefix, the way matrix-ctl's already is.
Following the four exemplars in-tree rather than building a mechanism:
`signLeaf` mints the leaves, `swarm-bao.nix` writes the roles from the
bootstrap token, the consumers name their own pair.

Two of the four are written PER HIVE and two are not, which is the shape
of the paths rather than a preference. A matrix appservice token and a
queue credential live under `swarm/hives/<name>/` and every hive runs a
reader for its own, so one role for all of them would have to be granted
`hives/*` — letting one hive read another's, a reach no hive has today.
An OIDC client secret lives under `swarm/services/<client-id>/` and a
swarm registers each exactly once, so one role each is enough. The
per-hive subjects are `<prefix>-<hive>` and swarm.nix reserves every
composed spelling as a hive name, so a hive cannot be named into another
hive's role.

The shared leaf stays: hive-c0re still passes it into its container, the
`bao` CLI wrapper still defaults to it, and the three
`glue-*-bao-identity.nix` files derive the PKI directory from it.

module-eval-bao-grants gains a negative arm per principal — each pins the
three stanzas the hive's leaf carried and the two wildcards a later
widening would reach for, so a policy that grows fails here rather than
in a store. Plus the consuming side: repointing a unit back at the hive's
leaf would evaluate, deploy and log in, and silently restore the union.

A hive that reads a store on another machine now places one leaf per
principal instead of one shared by four. That cost is the point, and
docs/swarm/secrets.md lists the pairs.
2026-09-23 10:11:42 +02:00
..
agent-icon.nix nix: split module-eval into per-subsystem checks 2026-09-20 04:25:54 +02:00
agent-matrix.nix nix: split module-eval into per-subsystem checks 2026-09-20 04:25:54 +02:00
agent-memory.nix nix: split module-eval into per-subsystem checks 2026-09-20 04:25:54 +02:00
agent-otel.nix module-eval: assert the severity table once, not once per tier 2026-09-20 14:23:56 +02:00
agent-plugins.nix nix: split module-eval into per-subsystem checks 2026-09-20 04:25:54 +02:00
agent-queue-bao.nix agent: fetch this agent's own swarm-queue credential from the store 2026-09-21 20:44:52 +02:00
bao-basics.nix nix: split module-eval into per-subsystem checks 2026-09-20 04:25:54 +02:00
bao-controller.nix nix: split module-eval into per-subsystem checks 2026-09-20 04:25:54 +02:00
bao-grants.nix swarm-bao: give each hive-cert consumer its own bao identity 2026-09-23 10:11:42 +02:00
bao-matrix-reader.nix swarm-bao: give each hive-cert consumer its own bao identity 2026-09-23 10:11:42 +02:00
bao-otel-collector.nix nix: the store's own collector scrapes its metrics listener 2026-09-21 17:19:52 +02:00
core-toggle.nix nix: split module-eval into per-subsystem checks 2026-09-20 04:25:54 +02:00
grafana.nix swarm-bao: give each hive-cert consumer its own bao identity 2026-09-23 10:11:42 +02:00
hive-otel.nix nix: split module-eval into per-subsystem checks 2026-09-20 04:25:54 +02:00
journald-severity.nix module-eval: assert the severity table once, not once per tier 2026-09-20 14:23:56 +02:00
lib.nix module-eval: assert the severity table once, not once per tier 2026-09-20 14:23:56 +02:00
matrix-core.nix nix: split module-eval into per-subsystem checks 2026-09-20 04:25:54 +02:00
name-guards.nix swarm-bao: give each hive-cert consumer its own bao identity 2026-09-23 10:11:42 +02:00
nats-authelia.nix nix: address the swarm IdP by its domain, not by who runs it 2026-09-21 18:14:28 +02:00
secret-publisher.nix nix: the store's own collector scrapes its metrics listener 2026-09-21 17:19:52 +02:00
swarm-otel-core.nix swarm-bao: give each hive-cert consumer its own bao identity 2026-09-23 10:11:42 +02:00
swarm-otel-identity.nix nix: split module-eval into per-subsystem checks 2026-09-20 04:25:54 +02:00
swarm-services-switch.nix nix: split module-eval into per-subsystem checks 2026-09-20 04:25:54 +02:00