Watch
0
0
Fork
You've already forked hyperhive
0

swarm-otel: scrape the authenticated targets only once the collector has its client secret

An empty secret file made the prometheus receiver request a token for each published target every scrape; authelia's per-address limit then refused every client behind that address. Without a secret the collector starts on the config minus those jobs. full-setup asserts the limiter never fired.
This commit is contained in:
atlas 2026-11-23 12:15:37 +01:00 • committed by mara
commit 480855dfaf

View file

@ -332,3 +332,25 @@ with subtest("the agents are deployed and need a login"):
2400,
["swarm-controller", "hive-c0re"],
)
with subtest(
"authelia's token endpoint never rate-limited a client while the swarm came up"
):
# Per source address, the limiter refuses once an address has been refused enough times, so
# one client POSTing without a usable secret locks every other client behind that address out.
# The control is a refusal this test causes from the host: the same journal query has to find it.
TOKEN_JOURNAL = (
"journalctl --machine=swarm-authelia -u authelia-swarm.service --no-pager -o cat "
'| grep -F \'"path":"/api/oidc/token"\''
)
machine.succeed(
"curl --silent --insecure -u nobody:wrong -d grant_type=client_credentials "
f"https://auth.{os.environ['FULL_SETUP_SWARM_DOMAIN']}/api/oidc/token"
)
machine.wait_until_succeeds(
f'{TOKEN_JOURNAL} | grep -F \'"remote_ip":"127.0.0.1"\''
)
limited = machine.execute(f"{TOKEN_JOURNAL} | grep -F 'Rate Limit Exceeded'")[1]
assert limited == "", (
"authelia rate-limited the token endpoint:\n" + limited[-3000:]
)