swarm-bao: make the reader's identity declarable, not just the store's
`swarm-bao.nix` declared the store's half of the mTLS pair as options — `serverCertFile`, `serverKeyFile`, `clientCaFile` — and left the reader's half as a literal inside `glue-bao-tls.nix`, which only runs where `deploy.bao.enable` is set. A hive that did not host the store therefore could not read from it and could not be pointed at a certificate even when one had been placed by hand. Adds `clientCertFile`, `clientKeyFile` and `serverCaFile` beside their three server siblings, `mkDefault`ed by the glue to the leaf it already mints, and moves `glue-matrix-bao-token.nix` onto them. Its gate becomes "this host holds an identity" rather than "the store is a neighbour", and the unit ordering that names store-local units is now conditional -- `Requires=` on an absent unit fails the job. `serverCaFile` is separate from `clientCaFile` on purpose: one is the store choosing which readers to trust, the other a reader choosing which store to trust. Self-signing collapses them to one file, which is a property of that deployment and not of the pairing. Closes #3855.
This commit is contained in:
parent
d9937ee834
commit
694abf4439
6 changed files with 126 additions and 19 deletions
|
|
@ -268,6 +268,54 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
clientCertFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
example = "/var/lib/swarm-bao/client.pem";
|
||||
description = ''
|
||||
Certificate a **reader on this machine** presents to the store.
|
||||
|
||||
The counterpart to {option}`services.hyperhive.deploy.bao.clientCaFile`,
|
||||
which is the store's side of the same handshake. Only the store's side
|
||||
was declarable, so a hive that did not run the store had no way to be
|
||||
pointed at a certificate even when one was placed for it.
|
||||
|
||||
On a hive that runs the store, a glue module supplies the leaf it minted,
|
||||
as a `mkDefault`. Everywhere else this is the credential an operator
|
||||
places by hand — the one secret that cannot come out of the store,
|
||||
because it is what opens it.
|
||||
|
||||
A path, never a value.
|
||||
'';
|
||||
};
|
||||
|
||||
clientKeyFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
example = "/var/lib/swarm-bao/client-key.pem";
|
||||
description = ''
|
||||
Private key for {option}`services.hyperhive.deploy.bao.clientCertFile`.
|
||||
Both or neither — a certificate with no key authenticates nothing.
|
||||
'';
|
||||
};
|
||||
|
||||
serverCaFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
example = "/var/lib/swarm-bao/ca.pem";
|
||||
description = ''
|
||||
Authority a **reader on this machine** validates the store's certificate
|
||||
against.
|
||||
|
||||
Not {option}`services.hyperhive.deploy.bao.clientCaFile` with the words
|
||||
rearranged: that one is the store choosing which readers to trust, this
|
||||
one is a reader choosing which store to trust. A deployment that
|
||||
self-signs both ends points them at the same file and reads that as
|
||||
confirmation they are interchangeable — they are not, and they diverge
|
||||
the moment either end gets a real CA.
|
||||
'';
|
||||
};
|
||||
|
||||
extraListenAddresses = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
|
|
|
|||
Loading…
Reference in a new issue