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
|
|
@ -20,6 +20,8 @@ let
|
|||
k8sNode = deployCfg.k8s;
|
||||
podAuth = import ./lib/bao-pod-auth.nix;
|
||||
|
||||
storeAuth = import ./lib/store-auth.nix;
|
||||
|
||||
shared = import ./lib/swarm-bao-shared.nix { inherit config lib pkgs; };
|
||||
inherit (shared)
|
||||
atticFactLeaves
|
||||
|
|
@ -360,6 +362,24 @@ let
|
|||
}
|
||||
];
|
||||
|
||||
# The unit that publishes the stores' listener credentials
|
||||
# (`swarm-bao-store-auth`, ./k8s/store-credentials.nix): it creates each
|
||||
# credential when the store holds none and reads it back, `create` without
|
||||
# `update`, so a stored value is never replaced. One principal for both
|
||||
# stores, a leaf each.
|
||||
storeAuthWriters = [
|
||||
{
|
||||
name = "swarm-store-auth";
|
||||
cn = baoDeploy.storeAuthCommonName;
|
||||
policyText =
|
||||
lib.concatMapStrings (store: createReadStanza "${credentialMountPath}/data/${storeAuth.leaf store}")
|
||||
[
|
||||
"victorialogs"
|
||||
"victoriametrics"
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
# The role name IS the policy name, as for the three service principals
|
||||
# above: the role attaches the policy by spelling it identically, and one
|
||||
# string for both objects removes the way they drift apart.
|
||||
|
|
@ -511,6 +531,8 @@ in
|
|||
|
||||
systemd.services.swarm-bao-forge-publisher-policy = readerPolicyUnit "write the forge's controller-token-publisher bao policy and cert-auth role" forgePublisherWriters;
|
||||
|
||||
systemd.services.swarm-bao-store-auth-policy = readerPolicyUnit "write the Victoria stores' credential publisher's bao policy and cert-auth role" storeAuthWriters;
|
||||
|
||||
# The pods' login: the `jwt` auth mount's config and one role per
|
||||
# in-cluster service. The mount exists once `swarm-bao-granter-role` has
|
||||
# run with a bootstrap token that carries `sys/auth/jwt-k8s`;
|
||||
|
|
|
|||
Loading…
Reference in a new issue