parent
0fc77df1a9
commit
8e09f8360a
47 changed files with 98 additions and 1026 deletions
|
|
@ -22,25 +22,18 @@ let
|
|||
runGroup
|
||||
;
|
||||
|
||||
# The queue's two old `swarm.nats` paths that still rename; dropping either
|
||||
# shim fails the eval. No store identity, which the first case below relies on.
|
||||
natsOldPath = shared.natsOldPath;
|
||||
# No store identity, which the first case below relies on.
|
||||
natsQueueOnly = shared.natsQueueOnly;
|
||||
|
||||
# Seventh split slice, plus slice 10's two authelia packages. Of slice 7's
|
||||
# movers only `usersFile` has a rename entry — the other two are `readOnly`,
|
||||
# and a rename module contributes a definition, which a read-only option
|
||||
# refuses; see ./host-modules/deploy.nix. `package` and `bridgePackage` are
|
||||
# ordinary options, so they do carry one. The two arms
|
||||
# below have different jobs. `usersFile` tests the rename; the nats one tests
|
||||
# that a reader pointed at the `deploy` namespace still renders the derived
|
||||
# path — seven of those reads go through an alias a path-shaped grep
|
||||
# cannot see.
|
||||
autheliaOldPath = hive {
|
||||
# The IdP and the queue on one host. A reader of authelia's host paths has to
|
||||
# follow the `deploy` namespace; seven of those reads go through an alias a
|
||||
# path-shaped grep cannot see.
|
||||
autheliaAndNats = hive {
|
||||
deploy.authelia.enable = true;
|
||||
deploy.nats.enable = true;
|
||||
swarm.authelia.usersFile = "/var/lib/test-authelia/users.yml";
|
||||
swarm.authelia.package = pkgs.emptyDirectory;
|
||||
swarm.authelia.bridgePackage = pkgs.emptyDirectory;
|
||||
deploy.authelia.usersFile = "/var/lib/test-authelia/users.yml";
|
||||
deploy.authelia.package = pkgs.emptyDirectory;
|
||||
deploy.authelia.bridgePackage = pkgs.emptyDirectory;
|
||||
# Renders the publisher, which reads the host client-secret dir.
|
||||
deploy.swarm-secret-publisher.baoClientCertFile = "/etc/pki/publisher.pem";
|
||||
deploy.swarm-secret-publisher.baoClientKeyFile = "/etc/pki/publisher-key.pem";
|
||||
|
|
@ -297,9 +290,9 @@ let
|
|||
{
|
||||
name = "authelia and nats declare no scrape target on a host with no collector";
|
||||
ok =
|
||||
!(autheliaOldPath.services.hyperhive.deploy.swarm-otel.enable)
|
||||
&& !(autheliaOldPath.services.hyperhive.swarm.otel.scrapeTargets ? authelia)
|
||||
&& !(autheliaOldPath.services.hyperhive.swarm.otel.scrapeTargets ? nats);
|
||||
!(autheliaAndNats.services.hyperhive.deploy.swarm-otel.enable)
|
||||
&& !(autheliaAndNats.services.hyperhive.swarm.otel.scrapeTargets ? authelia)
|
||||
&& !(autheliaAndNats.services.hyperhive.swarm.otel.scrapeTargets ? nats);
|
||||
}
|
||||
{
|
||||
# The xkey and the responder's OIDC client secret are read only from
|
||||
|
|
@ -308,7 +301,7 @@ let
|
|||
# minted one.
|
||||
name = "a queue with no responder store identity is refused at eval, one with a leaf is not";
|
||||
ok =
|
||||
refusedWithoutIdentity natsOldPath
|
||||
refusedWithoutIdentity natsQueueOnly
|
||||
&& !(refusedWithoutIdentity natsWithStoreIdentity)
|
||||
&& !(refusedWithoutIdentity natsOnStoreHost);
|
||||
}
|
||||
|
|
@ -327,10 +320,10 @@ let
|
|||
# this key would still evaluate cleanly — the only reader that would
|
||||
# notice is a publisher whose row exceeds upstream's much smaller
|
||||
# default, and by then it is a dropped row, not an eval failure.
|
||||
# Piggybacks on the pre-rename nats fixture above, which already
|
||||
# Piggybacks on the queue-only fixture above, which already
|
||||
# renders this container's full config.
|
||||
name = "the queue's payload ceiling is set, not inherited from the server's default";
|
||||
ok = natsOldPath.containers.swarm-nats.config.services.nats.settings.max_payload == 8388608;
|
||||
ok = natsQueueOnly.containers.swarm-nats.config.services.nats.settings.max_payload == 8388608;
|
||||
}
|
||||
{
|
||||
# What keeps a callout request inside one principal: the responder is
|
||||
|
|
@ -351,7 +344,7 @@ let
|
|||
&& !(settings ? system_account)
|
||||
)
|
||||
[
|
||||
natsOldPath
|
||||
natsQueueOnly
|
||||
natsOnStoreHost
|
||||
];
|
||||
}
|
||||
|
|
@ -375,7 +368,7 @@ let
|
|||
&& !(c.services.nats.settings.authorization.auth_callout ? xkey)
|
||||
)
|
||||
[
|
||||
natsOldPath
|
||||
natsQueueOnly
|
||||
natsOnStoreHost
|
||||
];
|
||||
}
|
||||
|
|
@ -384,7 +377,7 @@ let
|
|||
# responder with it: the responder requires the server, so a server that
|
||||
# failed to start left the responder inactive rather than failed.
|
||||
name = "starting the queue's server starts its responder";
|
||||
ok = lib.elem "nats.service" (responderOf natsOldPath).wantedBy;
|
||||
ok = lib.elem "nats.service" (responderOf natsQueueOnly).wantedBy;
|
||||
}
|
||||
{
|
||||
# The keys are created before anything needs them, by the responder's
|
||||
|
|
@ -480,7 +473,7 @@ let
|
|||
ok =
|
||||
let
|
||||
exec =
|
||||
natsOldPath.containers.swarm-nats.config.systemd.services.swarm-nats-auth.serviceConfig.ExecStart;
|
||||
natsQueueOnly.containers.swarm-nats.config.systemd.services.swarm-nats-auth.serviceConfig.ExecStart;
|
||||
in
|
||||
!(lib.hasInfix "--agent-publish-subject " exec);
|
||||
}
|
||||
|
|
@ -491,7 +484,7 @@ let
|
|||
name = "the responder grants a verified agent its own hive-free subjects";
|
||||
ok =
|
||||
let
|
||||
exec = (responderOf natsOldPath).serviceConfig.ExecStart;
|
||||
exec = (responderOf natsQueueOnly).serviceConfig.ExecStart;
|
||||
in
|
||||
lib.hasInfix "--agent-token-publish-subject '$$SWARM.term.{agent}'" exec
|
||||
&& lib.hasInfix "--agent-token-publish-subject '$$SWARM.agent-state.{agent}'" exec
|
||||
|
|
@ -503,7 +496,7 @@ let
|
|||
name = "the responder grants a verified agent its own icon key";
|
||||
ok =
|
||||
let
|
||||
exec = (responderOf natsOldPath).serviceConfig.ExecStart;
|
||||
exec = (responderOf natsQueueOnly).serviceConfig.ExecStart;
|
||||
in
|
||||
lib.hasInfix "--agent-token-publish-subject '$$KV.agent-icons.{agent}'" exec;
|
||||
}
|
||||
|
|
@ -514,7 +507,7 @@ let
|
|||
name = "a verified agent's grant is exactly its own subjects, and its JetStream API subjects read its own schedule, inference and permissions keys";
|
||||
ok =
|
||||
let
|
||||
args = lib.splitString " " (responderOf natsOldPath).serviceConfig.ExecStart;
|
||||
args = lib.splitString " " (responderOf natsQueueOnly).serviceConfig.ExecStart;
|
||||
granted = lib.concatLists (
|
||||
lib.imap0 (
|
||||
i: a:
|
||||
|
|
@ -685,7 +678,7 @@ let
|
|||
# through an `autheliaCfg` alias, where a path-shaped grep does not see it.
|
||||
name = "a consumer of authelia's host client-secret dir renders it from the deploy namespace";
|
||||
ok =
|
||||
autheliaOldPath.systemd.paths.swarm-secret-publish.pathConfig.PathChanged
|
||||
autheliaAndNats.systemd.paths.swarm-secret-publish.pathConfig.PathChanged
|
||||
== "/var/lib/nixos-containers/swarm-authelia/var/lib/authelia-swarm/oidc-clients";
|
||||
}
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue