Watch
0
0
Fork
You've already forked hyperhive
0

fetch the self-check's password as a systemd credential

This commit is contained in:
atlas 2026-10-28 13:07:15 +01:00 • committed by mara
commit fd63b402e1

View file

@ -800,6 +800,28 @@ let
noService.systemd.services.hive-priv-cache-facts.environment.BAO_CLIENT_CERT
== "/etc/pki/bao-hive.pem";
}
{
# Control: the lookup finds the sibling root unit of the same shape. The
# squid self-check's password is read under this hive's own identity and
# lands where only root reads it, as the credential `squid-selfcheck`
# imports.
name = "the squid self-check credential is read by a root oneshot under this hive's own identity into the credstore";
ok =
let
u = units.squid-selfcheck-credential;
in
lib.hasInfix "secret/swarm/hives/h1/squid-selfcheck" u.script
&& !(lib.hasInfix "swarm/hives/h2" u.script)
&& lib.hasInfix "/run/credstore/hive-squid.selfcheck" u.script
&& lib.hasInfix "atomic_write_secret 0400 root:root" u.script
&& u.environment.BAO_CLIENT_CERT == units.hive-priv-cache-facts.environment.BAO_CLIENT_CERT
&& u.environment.BAO_CLIENT_KEY == units.hive-priv-cache-facts.environment.BAO_CLIENT_KEY
&& u.serviceConfig.Type == "oneshot"
&& !(remainsAfterExit u)
&& allLocal.systemd.timers ? squid-selfcheck-credential
&& !(noIdentity.systemd.services ? squid-selfcheck-credential)
&& !(noIdentity.systemd.timers ? squid-selfcheck-credential);
}
{
name = "hive-priv is told the cache's address by the host's configuration";
ok =