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.
This commit is contained in:
parent
ba0df0ec82
commit
f54aae7927
1 changed files with 808 additions and 72 deletions
31
nix/host-modules/lib/store-auth.nix
Normal file
31
nix/host-modules/lib/store-auth.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# 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";
|
||||
}
|
||||
Loading…
Reference in a new issue