hyperhive/nix
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas 2f7d3e02e9 bao: write the swarm controller's policy from inside the store
Cert auth answers a role, so nothing in the swarm can authenticate to
the store until some role exists. Creating the first one therefore
cannot itself use a certificate — the credential has to come from
outside that cycle, and an operator places it.

`deploy.bao.bootstrapTokenFile` names that token. A one-shot unit inside
the store's container reads it and writes the `swarm-controller` policy;
`local-defaults.nix` supplies the path (never the file) on an all-local
deploy, since co-location makes only the location derivable. `bao
operator init` stays an operator action in every shape.

The unit runs in the container rather than on the host because writing
the first grant is a store-side operation: it reaches the store locally
and needs no client certificate. Gating it on the store being here is
therefore not the co-location assumption glue-matrix-bao-token.nix
warns about — a reader has to work from anywhere, the first write never
does.

Policy only, deliberately: a cert-auth role binds a certificate and the
controller has no bao identity yet — it holds no leaf and contains no
bao code at all. The two certificates that do exist are both wrong to
bind. `clientCertFile` is the store host's own reader leaf rather than
the controller's, and the CA that signed it also signs every other
reader's, so binding that would let any reader authenticate as the
controller. Whoever gives the controller an identity writes the role.

The grants are scoped to `hive-*`. Without the prefix the controller
could rewrite the policy that constrains it.

Two things the module-eval arms pin: the unit renders inside the
container with the token path in both its script and its
ConditionPathExists, and a host that names a token while running no
store gets neither the unit nor the host-side directory.

The capabilities were derived with `bao write -output-policy` rather
than written from memory, and the setup.md commands were run against a
real binary for shape before being written down.

Refs #3726.
2026-09-07 18:43:09 +02:00
..
agent-modules docs: matrix gateway vhost defaults to chat.<swarm-domain>, not matrix.<domain> 2026-09-07 16:53:22 +02:00
docs docs: restructure into topic subdirectories, collapse duplicated index 2026-09-02 01:55:37 +02:00
host-modules bao: write the swarm controller's policy from inside the store 2026-09-07 18:43:09 +02:00
packages deploy: move the wireguard mesh out of the namespace hives read 2026-09-07 14:24:52 +02:00
templates refactor: nix/host-modules + nix/agent-modules layout, update doc paths 2026-07-13 22:05:49 +02:00
checks.nix hive-forge: add markdown-docs generator and CI freshness check 2026-09-02 19:38:34 +02:00
devshell.nix types: let nix own the reserved-name blacklist 2026-08-27 16:36:42 +02:00
module-eval.nix bao: write the swarm controller's policy from inside the store 2026-09-07 18:43:09 +02:00
reserved-hive-fragments.nix swarm: extract the name guards, so the module just says what is forbidden 2026-08-31 18:50:15 +02:00
reserved-names.nix swarm: refuse hive names that CONTAIN a word identifiers are composed from 2026-08-31 18:50:15 +02:00
rust.nix docs(rust): the dep-cache comment no longer describes two consumers 2026-08-11 22:29:56 +02:00
sources.nix refactor: slim flake.nix into nix/ entry files 2026-07-13 20:55:43 +02:00
treefmt.nix treefmt: format the web files with prettier 2026-09-02 15:25:07 +02:00