swarm-otel: scrape authelia through its published name
Authelia's metrics were scraped over loopback, declared only on a host running both authelia and the collector, so a split deploy collected none. Its target is now declared on every host as `https://<swarm.authelia.domain>/metrics`, next to forgejo's, and authelia's vhost serves `= /metrics` behind the same collector auth subrequest as the forge's. The loopback entry is gone, so a single host still scrapes authelia once, now by name. The forge-only `metricsRule` becomes `metricsRules`, derived from every `publishedScrapeTargets` entry. Each target gets the collector-scoped `one_factor` rule followed by an unconditional `deny`. The `deny` is needed because authelia 4.39 skips a rule whose `subject` does not match and moves on. With nothing after the collector rule, any other authenticated session reached `default_policy = one_factor` and was admitted. That was already true of the forge's `/metrics`, and this change closes it there too. Part of #5205
This commit is contained in:
parent
1219091788
commit
393e84afd0
4 changed files with 194 additions and 42 deletions
|
|
@ -43,24 +43,17 @@ in
|
|||
authelia's documentation finds what they expect.
|
||||
|
||||
A separate port from {option}`port` because it is a separate
|
||||
listener with a different audience: the main one is proxied by
|
||||
the gateway and reachable from the swarm, this one is scraped by
|
||||
the collector on this host and by nothing else.
|
||||
listener with a different audience: the main one serves logins and
|
||||
is reachable from the swarm, this one carries no authentication of
|
||||
its own. The swarm collector scrapes it, from whichever host it
|
||||
runs on, as `https://''${domain}/metrics`: the gateway's
|
||||
`= /metrics` location proxies to this port only after authelia
|
||||
has accepted the collector's token for that URL.
|
||||
|
||||
⚠️ Every swarm container shares the host network namespace, so
|
||||
two services defaulting to the same port do not conflict at build
|
||||
time — one simply loses at runtime, with nothing in any log. Check
|
||||
a new value against the others before changing this.
|
||||
|
||||
::: {.note}
|
||||
Loopback means this endpoint is only reachable by a collector on
|
||||
the *same host*, so the scrape target is declared only when one is
|
||||
enabled here. Run the swarm's collector elsewhere and authelia's
|
||||
metrics are simply not collected — no error, and nothing in a log
|
||||
to say so. Making them reachable across hosts is a different piece
|
||||
of work: the endpoint would have to be published under a name,
|
||||
with a certificate and an audience.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue