Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/nix/host-modules/lib/store-auth.nix
atlas f54aae7927 the log and metrics stores ask every request for a credential the gateway supplies
Each store runs with -httpAuth.* and a credential from the secret store, published to the namespace as a Secret by the host. The gateway's locations send it after auth_request has passed, and the collector's scrape and push take the same one, so a process on the node that bypasses the gateway is refused.
2026-11-27 21:30:12 +01:00

31 lines
1.4 KiB
Nix

# What the Victoria stores' listener credential is, where it lives, and who
# names it. The store's pod, the gateway's vhost and the unit that mints and
# publishes it (../k8s/store-credentials.nix) all spell it from here.
#
# The credential is the HTTP Basic login every route of the store's listener
# asks for (`-httpAuth.username` and `-httpAuth.password`). The password is a
# leaf of the swarm secret store, created by that unit when the store holds
# none. The pod reads it from the Secret `secretName`; nginx sends it in the
# `Authorization` header that `nginxFile` sets.
rec {
# The Basic login's user name, the same for every store.
user = "swarm-store";
# The credential id the store's unit loads and the key of the Secret that
# holds the password.
credentialId = "store-auth";
# Under KV v2's `secret/` mount, as `bao kv` takes it. `store` is
# `victorialogs` or `victoriametrics`.
leaf = store: "swarm/services/${store}/store-auth";
# On the host, a directory only root reads: the password the Secret is made from,
# and the nginx file the gateway's locations include.
dir = "/var/lib/swarm-store-auth";
passwordFile = store: "${dir}/${store}.password";
nginxFile = store: "${dir}/${store}.conf";
# The Secret the store's pod loads its credentials from
# (../k8s/render.nix names it `<service>-credentials`).
secretName = store: "swarm-${store}-credentials";
}