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
|
|
@ -170,7 +170,7 @@ let
|
|||
_: u: (u.environment.BAO_CLIENT_CERT or null) == granterCertFile
|
||||
) baoGrantWithConsumers.systemd.services;
|
||||
|
||||
# The twenty-two units that write a `swarm-*` grant, by name, for the
|
||||
# The twenty-three units that write a `swarm-*` grant, by name, for the
|
||||
# discovery control below.
|
||||
grantingUnitNames = [
|
||||
"swarm-bao-controller-policy"
|
||||
|
|
@ -198,6 +198,7 @@ let
|
|||
"swarm-bao-stt-policy"
|
||||
"swarm-bao-attic-policy"
|
||||
"swarm-bao-archive-policy"
|
||||
"swarm-bao-store-auth-policy"
|
||||
];
|
||||
|
||||
# Comment lines dropped first: both the HCL and the scripts explain
|
||||
|
|
@ -1146,24 +1147,24 @@ let
|
|||
}
|
||||
{
|
||||
# A store host without the granter's pair writes its grants some other
|
||||
# way, so none of the twenty-two units may exist. Without this arm
|
||||
# way, so none of the twenty-three units may exist. Without this arm
|
||||
# `lib.mkIf haveGranter` could be dropped from any of them and every other
|
||||
# case here would still pass.
|
||||
name = "without the granter's pair none of the twenty-two granting units render";
|
||||
name = "without the granter's pair none of the twenty-three granting units render";
|
||||
ok =
|
||||
let
|
||||
s = baoGranterOptOut.systemd.services;
|
||||
in
|
||||
lib.all (unit: !(s ? ${unit})) (grantingUnitNames ++ [ "swarm-bao-granter-role" ])
|
||||
# The control: the same store with the pair renders all twenty-two.
|
||||
# The control: the same store with the pair renders all twenty-three.
|
||||
&& lib.all (unit: baoGrantHere.systemd.services ? ${unit}) grantingUnitNames;
|
||||
}
|
||||
{
|
||||
# 🩸 What replaced the silent skip. With no bootstrap token the twenty-two
|
||||
# 🩸 What replaced the silent skip. With no bootstrap token the twenty-three
|
||||
# still render, and a refused granter fails them with the step that fixes it.
|
||||
# A store host that never named a token is told to name one, since the
|
||||
# unit that sets the granter up renders only where it has.
|
||||
name = "a store host without a bootstrap token renders the twenty-two, each failing loudly with the one-time step";
|
||||
name = "a store host without a bootstrap token renders the twenty-three, each failing loudly with the one-time step";
|
||||
ok =
|
||||
let
|
||||
s = baoGranterNoToken.systemd.services;
|
||||
|
|
@ -2242,6 +2243,38 @@ let
|
|||
in
|
||||
lib.hasInfix "/stt.pem ]" s && lib.hasInfix "swarm-stt \"\" clientAuth" s;
|
||||
}
|
||||
{
|
||||
# Create without update: the first value stored is the one every later
|
||||
# run reads, and no run replaces it. The two leaves are the stores'.
|
||||
name = "the store credential publisher's grant is create and read on the two stores' credentials and nothing else, and the PKI unit signs its leaf";
|
||||
ok =
|
||||
let
|
||||
s = baoGrantHere.systemd.services.swarm-bao-store-auth-policy.script;
|
||||
grants = grantsIn s;
|
||||
pki = baoGrantHere.systemd.services.swarm-bao-pki.script;
|
||||
in
|
||||
(grantFor grants "secret/data/swarm/services/victorialogs/store-auth").caps == [
|
||||
"create"
|
||||
"read"
|
||||
]
|
||||
&&
|
||||
(grantFor grants "secret/data/swarm/services/victoriametrics/store-auth").caps == [
|
||||
"create"
|
||||
"read"
|
||||
]
|
||||
&& lib.length grants == 2
|
||||
&& lib.hasInfix "auth/cert/certs/swarm-store-auth" s
|
||||
&& lib.hasInfix "allowed_common_names=swarm-store-auth" s
|
||||
&& lib.hasInfix "token_policies=swarm-store-auth" s
|
||||
&& lib.hasInfix "/store-auth.pem ]" pki
|
||||
&& lib.hasInfix "swarm-store-auth \"\" clientAuth" pki
|
||||
# Nothing else names either leaf, and the list is not empty for want of
|
||||
# a match: the publisher's own unit is the one it finds.
|
||||
&&
|
||||
lib.filter (
|
||||
u: lib.hasInfix "/store-auth" baoGrantHere.systemd.services.${u}.script
|
||||
) grantingUnitNames == [ "swarm-bao-store-auth-policy" ];
|
||||
}
|
||||
{
|
||||
name = "the PKI unit signs the notification router's leaf under its own subject";
|
||||
ok =
|
||||
|
|
@ -2677,8 +2710,8 @@ let
|
|||
}
|
||||
{
|
||||
# What makes the case above mean something: discovery by the granter's
|
||||
# certificate reaches all twenty-two units, and each yields calls.
|
||||
name = "the granter-policy check sees all twenty-two granting units, and parses calls from each";
|
||||
# certificate reaches all twenty-three units, and each yields calls.
|
||||
name = "the granter-policy check sees all twenty-three granting units, and parses calls from each";
|
||||
ok =
|
||||
lib.sort lib.lessThan (lib.attrNames granterUnits) == lib.sort lib.lessThan grantingUnitNames
|
||||
&& lib.all (u: baoCalls u.script != [ ]) (lib.attrValues granterUnits)
|
||||
|
|
|
|||
Loading…
Reference in a new issue