fix(rosenpass): per-interface PSK rotation metrics so Link B is observed
rosenpass-metrics.sh hashed wg0 only, so Link B (rpi wg-remote <-> linode wg0) could stall - the Pi's residential public address moving, or the UPnP mapping for UDP 9999 being dropped - while every Link A series stayed healthy. Iterate over an interface list, keep one state file per interface, and emit age/last-change per interface. wg0's series keep the same names and labels, so existing dashboards and the Link A alerts are unchanged; RosenpassPskRotationStalled already keys on (node, interface) and therefore starts covering wg-remote with no rule change. A host without the interface (siriussec) simply skips it.
This commit is contained in:
parent
2134f5a1d6
commit
acdfdd7975
2 changed files with 73 additions and 56 deletions
|
|
@ -1,7 +1,8 @@
|
|||
# Rosenpass monitoring (host exporters for Link A)
|
||||
# Rosenpass monitoring (host exporters for Link A and Link B)
|
||||
|
||||
Rosenpass rotates the WireGuard preshared key on **Link A** (`rpi` wg0
|
||||
`10.10.0.1` ↔ `siriussec` wg0 `10.10.0.2`) about every two minutes. WireGuard
|
||||
`10.10.0.1` ↔ `siriussec` wg0 `10.10.0.2`) and on **Link B** (`rpi` wg-remote
|
||||
`10.20.0.2` ↔ `linode` wg0 `10.20.0.1`) about every two minutes. WireGuard
|
||||
keeps using the last PSK it was given, so if the exchange dies the tunnel stays
|
||||
**up** and silently stops being post-quantum. These files make that state
|
||||
visible in Prometheus.
|
||||
|
|
@ -41,20 +42,29 @@ Arch (siriussec).
|
|||
|
||||
```
|
||||
rosenpass_unit_active{node="rpi|siriussec"} 0|1
|
||||
rosenpass_psk_rotation_age_seconds{node=...,interface="wg0"}
|
||||
rosenpass_psk_rotation_last_change_timestamp_seconds{node=...,interface="wg0"}
|
||||
rosenpass_psk_rotation_age_seconds{node=...,interface="wg0|wg-remote"}
|
||||
rosenpass_psk_rotation_last_change_timestamp_seconds{node=...,interface="wg0|wg-remote"}
|
||||
```
|
||||
|
||||
The script hashes the output of `wg show wg0 preshared-keys` and stores only
|
||||
the SHA-256 digest plus the last-change timestamp in
|
||||
`/var/lib/rosenpass-exporter/last-hash` (root-only). When the digest changes the
|
||||
timestamp advances; otherwise only the age metric grows. **Key material is
|
||||
never printed, logged or persisted.** The timer's own journal therefore carries
|
||||
no key bytes — do not "improve" the script by echoing the listing.
|
||||
One series set per interface: `wg0` is Link A and `wg-remote` is Link B, and an
|
||||
interface absent on that host (wg-remote on siriussec, where it does not exist)
|
||||
is skipped. `RosenpassPskRotationStalled` is interface-agnostic
|
||||
(`max by (node, interface) ... > 900`), so a stalled Link B pages as soon as the
|
||||
`wg-remote` series exists — which is why hashing only `wg0` left Link B
|
||||
unobserved.
|
||||
|
||||
`wg0` unreadable (interface down, no `CAP_NET_ADMIN`) leaves the age metric
|
||||
unchanged rather than resetting it; `rosenpass_unit_active` and the `absent()`
|
||||
arms of the alerts cover that case, so a broken exporter still pages.
|
||||
The script hashes the output of `wg show <interface> preshared-keys` and stores
|
||||
only the SHA-256 digest plus the last-change timestamp in
|
||||
`/var/lib/rosenpass-exporter/last-hash-<interface>` (root-only, one file per
|
||||
interface so a Link B rotation is never recorded as a Link A one). When the
|
||||
digest changes the timestamp advances; otherwise only the age metric grows.
|
||||
**Key material is never printed, logged or persisted.** The timer's own journal
|
||||
therefore carries no key bytes — do not "improve" the script by echoing the
|
||||
listing.
|
||||
|
||||
An interface unreadable (down, no `CAP_NET_ADMIN`) emits no series for that
|
||||
interface rather than resetting its age; `rosenpass_unit_active` and the
|
||||
`absent()` arms of the alerts cover that case, so a broken exporter still pages.
|
||||
|
||||
## Verify
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue