feat(rosenpass): wg-remote absent() arm + UPnP mapping metric and alert #86

Merged
sirius merged 1 commit from wt/t_a2c54837 into master 2026-12-03 07:54:08 +00:00
Owner

What

Two Rosenpass monitoring gaps left open by the Link B rollout (t_0f20d04d), both on Link B (rpi wg-remote 10.20.0.2 ↔ linode wg0 10.20.0.1).

1. absent() arm for the disappeared wg-remote series

RosenpassPskRotationStalled's absent arm only named rpi/wg0 and siriussec/wg0, so if the Pi's metrics timer or script died the wg-remote series vanished and nothing paged — the exact case the arm exists for. Added absent(rosenpass_psk_rotation_age_seconds{node="rpi", interface="wg-remote"}). Deliberately no siriussec/wg-remote arm: that interface does not exist there.

2. rosenpass_upnp_mapping_present{node="rpi"} + RosenpassUpnpMappingLost

The Pi's only inbound path for the Link B exchange is a permanent UPnP mapping UDP 9999 -> 192.168.1.125:9999 (the router has no admin panel). rosenpass-upnp.timer re-asserts it every 15 min but only logged to the journal when it could not:

  • rosenpass-upnp.sh now stamps its result to /run/rosenpass-upnp.present (1/0) on every run.
  • rosenpass-metrics.sh reads that file into rosenpass_upnp_mapping_present{node="rpi"} and rosenpass_upnp_last_check_timestamp_seconds{node="rpi"} (the state file's mtime). It does not call upnpc — that would poll the IGD 1440×/day. A host without the state file (siriussec) emits neither series.
  • New RosenpassUpnpMappingLost (warning, 10m) fires on value 0, on a state file older than 30 minutes (stopped timer / hung IGD — so a stale 1 cannot keep reading healthy), or on absent().

Testing (per infrastructure/networking/rosenpass/README.md § Testing the rules without merging)

kubectl run-style pod with quay.io/prometheus/prometheus:v3.15.1-distroless (the live Prometheus image):

$ /bin/promtool check rules /etc/promtool/rosenpass-rules.yaml
Checking /etc/promtool/rosenpass-rules.yaml
  SUCCESS: 3 rules found

$ /bin/promtool test rules /etc/promtool/rosenpass-tests.yaml
  SUCCESS

The promtool test rules file is generated from rosenpass.yaml itself (annotations copied, so expectations cannot drift) and covers six scenarios:

  1. healthy — no alerts;
  2. rosenpass_unit_active{node="rpi"} 0 — only RosenpassDown{node="rpi"} fires;
  3. wg0 age 1800 and the wg-remote series missing — two RosenpassPskRotationStalled alerts, one per arm (this is the new one);
  4. every rosenpass series missing — all absent arms fire (2 unit + 3 interface + 1 UPnP), linode never appears;
  5. mapping reported missing — RosenpassUpnpMappingLost{node="rpi"};
  6. present=1 but last check >30 min old — RosenpassUpnpMappingLost{node="rpi"}.

The test file stays out of the repo (per the README it duplicates the annotation strings), but the generator is reproducible from rosenpass.yaml.

Scope

Host-script changes are installed on rpi only (the metric only exists there); siriussec runs the same file and skips both series because it has no state file. No key material anywhere — the metrics script still hashes only.

## What Two Rosenpass monitoring gaps left open by the Link B rollout (t_0f20d04d), both on Link B (`rpi wg-remote 10.20.0.2 ↔ linode wg0 10.20.0.1`). **1. `absent()` arm for the disappeared `wg-remote` series** `RosenpassPskRotationStalled`'s absent arm only named `rpi/wg0` and `siriussec/wg0`, so if the Pi's metrics timer or script died the `wg-remote` series vanished and nothing paged — the exact case the arm exists for. Added `absent(rosenpass_psk_rotation_age_seconds{node="rpi", interface="wg-remote"})`. Deliberately **no** `siriussec/wg-remote` arm: that interface does not exist there. **2. `rosenpass_upnp_mapping_present{node="rpi"}` + `RosenpassUpnpMappingLost`** The Pi's only inbound path for the Link B exchange is a permanent UPnP mapping `UDP 9999 -> 192.168.1.125:9999` (the router has no admin panel). `rosenpass-upnp.timer` re-asserts it every 15 min but only logged to the journal when it could not: - `rosenpass-upnp.sh` now stamps its result to `/run/rosenpass-upnp.present` (`1`/`0`) on every run. - `rosenpass-metrics.sh` reads that file into `rosenpass_upnp_mapping_present{node="rpi"}` and `rosenpass_upnp_last_check_timestamp_seconds{node="rpi"}` (the state file's mtime). It does **not** call `upnpc` — that would poll the IGD 1440×/day. A host without the state file (`siriussec`) emits neither series. - New `RosenpassUpnpMappingLost` (warning, 10m) fires on value `0`, on a state file older than 30 minutes (stopped timer / hung IGD — so a stale `1` cannot keep reading healthy), or on `absent()`. ## Testing (per `infrastructure/networking/rosenpass/README.md` § *Testing the rules without merging*) `kubectl run`-style pod with `quay.io/prometheus/prometheus:v3.15.1-distroless` (the live Prometheus image): ``` $ /bin/promtool check rules /etc/promtool/rosenpass-rules.yaml Checking /etc/promtool/rosenpass-rules.yaml SUCCESS: 3 rules found $ /bin/promtool test rules /etc/promtool/rosenpass-tests.yaml SUCCESS ``` The `promtool test rules` file is generated from `rosenpass.yaml` itself (annotations copied, so expectations cannot drift) and covers six scenarios: 1. healthy — no alerts; 2. `rosenpass_unit_active{node="rpi"} 0` — only `RosenpassDown{node="rpi"}` fires; 3. `wg0` age 1800 **and** the `wg-remote` series missing — two `RosenpassPskRotationStalled` alerts, one per arm (this is the new one); 4. every rosenpass series missing — all absent arms fire (2 unit + 3 interface + 1 UPnP), linode never appears; 5. mapping reported missing — `RosenpassUpnpMappingLost{node="rpi"}`; 6. `present=1` but last check >30 min old — `RosenpassUpnpMappingLost{node="rpi"}`. The test file stays out of the repo (per the README it duplicates the annotation strings), but the generator is reproducible from `rosenpass.yaml`. ## Scope Host-script changes are installed on **rpi only** (the metric only exists there); `siriussec` runs the same file and skips both series because it has no state file. No key material anywhere — the metrics script still hashes only.
Link B (rpi wg-remote <-> linode wg0) depends on a permanent UPnP mapping
UDP 9999 -> 192.168.1.125:9999 for its inbound path, and the 15-minute
rosenpass-upnp.timer only logged to the journal when it could not re-assert
it. Two gaps closed:

* RosenpassPskRotationStalled gains absent(rosenpass_psk_rotation_age_seconds
  {node="rpi", interface="wg-remote"}). Without it a dead metrics timer or
  script on the Pi silently dropped the Link B series while the rule kept
  reading healthy. No siriussec/wg-remote arm: that interface does not exist
  there.

* rosenpass-upnp.sh now stamps its result to /run/rosenpass-upnp.present (1/0)
  and rosenpass-metrics.sh reads that file into rosenpass_upnp_mapping_present
  {node="rpi"} plus rosenpass_upnp_last_check_timestamp_seconds. The 60 s
  metrics timer never calls upnpc (that would poll the IGD 1440x/day); a host
  without the state file (siriussec) emits neither series. New
  RosenpassUpnpMappingLost alert fires on value 0, on a state file older than
  30 minutes (stopped timer / hung IGD, so a stale 1 cannot read healthy), or
  on a missing series.
sirius merged commit 32de4e04ef into master 2026-12-03 07:54:08 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/homek8s!86
No description provided.