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:
parent
4aa0a4cc2a
commit
25e59b8d96
2 changed files with 26 additions and 22 deletions
|
|
@ -1948,6 +1948,10 @@ pkgs.testers.runNixOSTest {
|
||||||
for other in ("victoriametrics", "victorialogs"):
|
for other in ("victoriametrics", "victorialogs"):
|
||||||
assert stored != as_root(f"bao kv get -mount=secret -field=value swarm/services/{other}/store-auth").strip()
|
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
|
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()
|
secret = machine.succeed(f"kubectl -n {NS} get secret swarm-grafana-credentials -o jsonpath='{{.data.store-auth}}' | base64 -d").strip()
|
||||||
assert secret == stored
|
assert secret == stored
|
||||||
assert stored not in machine.succeed(f"cat {MANIFESTS}/{GRAFANA}.yaml"), "the manifest holds no credential"
|
assert stored not in machine.succeed(f"cat {MANIFESTS}/{GRAFANA}.yaml"), "the manifest holds no credential"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue