Watch
0
0
Fork
You've already forked hyperhive
0

give Grafana's include file the gateway group's mode in the test and docs

The credential unit already writes every store's nginx file as root:nginx 0640,
and grafana.conf is one of them. The credentials page gives it the same modes
and the test checks them, and that the gateway's user reads the file and not
the password.
This commit is contained in:
atlas 2026-11-28 09:56:27 +01:00
commit 25e59b8d96

View file

@ -1948,6 +1948,10 @@ pkgs.testers.runNixOSTest {
for other in ("victoriametrics", "victorialogs"):
assert stored != as_root(f"bao kv get -mount=secret -field=value swarm/services/{other}/store-auth").strip()
assert machine.succeed(f"cat {GRAFANA_PASSWORD}").strip() == stored
# The gateway's user reads the include file and not the password, as for the stores'.
assert machine.succeed(f"stat -c '%a %U %G' {GRAFANA_PASSWORD} {GRAFANA_CONF}").split("\n")[:2] == ["600 root root", "640 root nginx"]
machine.succeed(f"runuser -u nginx -- cat {GRAFANA_CONF}")
machine.fail(f"runuser -u nginx -- cat {GRAFANA_PASSWORD}")
secret = machine.succeed(f"kubectl -n {NS} get secret swarm-grafana-credentials -o jsonpath='{{.data.store-auth}}' | base64 -d").strip()
assert secret == stored
assert stored not in machine.succeed(f"cat {MANIFESTS}/{GRAFANA}.yaml"), "the manifest holds no credential"