fix(#3384): source the queue policy's principals from the modules that mint them
The auth-callout responder decides what an admitted client may publish
from two strings: the prefix marking a hive client, and the client id
allowed to read every hive's key. Both were literals in three places --
swarm-authelia.nix mints "hive-${name}", swarm-controller.nix defines
"swarm-controller", and the responder carried its own copies as clap
defaults because swarm-nats.nix passed neither.
Each producer now publishes its value as a readOnly option and the
responder's ExecStart reads them, so the agreement is one evaluation
rather than three strings that happen to be equal. Same pattern the
module already uses for `--account`, and the same argument
swarm-authelia.nix gives for publishing `machine` and `unit`.
Worth the change because the failure is silent and misattributed:
rename either principal and the responder starts denying the one that
stopped matching, a denial reaches a NATS client as a timeout rather
than an error, and a hive that is refused looks exactly like a hive
that has not reported yet.
This commit is contained in:
parent
2e9ce53a32
commit
e0e5823080
3 changed files with 54 additions and 2 deletions
|
|
@ -91,7 +91,7 @@ let
|
|||
# declared entries and not on these, which is an eval error reachable
|
||||
# only once hive identities are on.
|
||||
hiveClients = lib.mapAttrsToList (name: _: {
|
||||
id = "hive-${name}";
|
||||
id = "${cfg.hiveClientPrefix}${name}";
|
||||
description = "HyperHive hive ${name}";
|
||||
kind = "machine";
|
||||
redirectUris = [ ];
|
||||
|
|
@ -508,6 +508,26 @@ in
|
|||
# the call site: the machine and unit names are derived from
|
||||
# `instance` here, so a second copy elsewhere is a second thing to
|
||||
# keep in step, and the one that drifts is the one nobody tests.
|
||||
hiveClientPrefix = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
readOnly = true;
|
||||
default = "hive-";
|
||||
description = ''
|
||||
Prefix of the OAuth2 client id minted for each hive in
|
||||
`services.hyperhive.swarm.hives` — the client for hive `alpha` is
|
||||
`${config.services.hyperhive.swarm.authelia.hiveClientPrefix}alpha`.
|
||||
Read-only for the same reason as `machine` and `unit`: it is what
|
||||
this module produces, published so a consumer does not carry a
|
||||
second copy.
|
||||
|
||||
The consumer that matters is the queue's auth-callout responder,
|
||||
which decides *which hive* a connection is by stripping this
|
||||
prefix off the introspected client id. Split the two spellings and
|
||||
every hive is denied — as a timeout, indistinguishable from a hive
|
||||
that simply has not reported.
|
||||
'';
|
||||
};
|
||||
|
||||
machine = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
readOnly = true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue