feat(monitoring): Rosenpass unit-state + PSK-rotation alerts for Link A #84

Merged
sirius merged 2 commits from wt/t_20e420af into master 2026-12-03 07:22:42 +00:00
Owner

Makes a dead or wedged Rosenpass on Link A (rpi wg0 10.10.0.1 ↔ siriussec wg0 10.10.0.2) visible. Today the exchange can stop and nothing notices: WireGuard keeps using the last preshared key, so the tunnel stays up and silently stops being post-quantum.

What

infrastructure/networking/rosenpass/ (host config, not Flux-reconciled)

  • rosenpass-metrics.sh — POSIX sh, run by rosenpass-metrics.timer every 60 s as root on rpi and siriussec only. Writes /var/lib/node-exporter/textfile/rosenpass.prom atomically (tmp+mv) with:
    • rosenpass_unit_active{node="<host>"}
    • rosenpass_psk_rotation_age_seconds{node,interface="wg0"}
    • rosenpass_psk_rotation_last_change_timestamp_seconds{node,interface="wg0"}
      The wg show wg0 preshared-keys output is piped straight into sha256sum; only the digest + last-change timestamp are stored (/var/lib/rosenpass-exporter/last-hash, root-only). No key material is printed, logged or persisted.
  • rosenpass-metrics.service / .timer with ProtectSystem=strict, StateDirectory=; deliberately no Requires=/After= on rosenpass.service — the recorder must keep reporting while the unit it watches is dead.

monitoring/controllers/home/values.yaml — inside prometheus-node-exporter:: --collector.textfile.directory=/host/textfile, hostPath /var/lib/node-exporter/textfile (DirectoryOrCreate, so linode keeps starting), read-only mount. The chart's image is distroless with no textfile collector and --collector.systemd needs dbus, hence the host script.

monitoring/controllers/home/rosenpass.yaml — PrometheusRule labelled release: kube-prometheus-stack:

  • RosenpassDown: max by (node) (rosenpass_unit_active) == 0 for 5 m, warning
  • RosenpassPskRotationStalled: max by (node, interface) (rosenpass_psk_rotation_age_seconds) > 900 for 10 m, warning
  • both carry absent() arms naming rpi/siriussec, so a missing series (timer off, script broken, scrape gone) alerts instead of reading as healthy — and linode, which has node-exporter but no rosenpass, does not page.

Verification done on this branch (pre-merge)

  • kubectl kustomize monitoring/controllers/home → exit 0, 5 PrometheusRules in the output including rosenpass.
  • promtool check rules on the rendered spec.groups (in-cluster pod, prometheus v3.15.1 image) → SUCCESS: 2 rules found.
  • helm template of the pinned chart (kube-prometheus-stack 92.14.0 / node-exporter 4.60.1) shows the three args (textfile dir + the two default filesystem excludes, re-stated because Helm replaces lists, not merges) plus the textfile volume/mount.
  • Host script installed and running on both ends: timer active (waiting), .prom file contains all three series with rosenpass_unit_active 1 and a fresh timestamp.

Not verifiable until this merges

Series present in Prometheus, either alert actually firing, and Alertmanager → Telegram delivery. Flux only reconciles master, so nothing here is live yet.

Out of scope: Link B / Linode / Phase C, any change to rosenpass itself, Grafana dashboard.

Makes a dead or wedged Rosenpass on **Link A** (rpi `wg0` 10.10.0.1 ↔ siriussec `wg0` 10.10.0.2) visible. Today the exchange can stop and nothing notices: WireGuard keeps using the last preshared key, so the tunnel stays up and silently stops being post-quantum. ## What **`infrastructure/networking/rosenpass/`** (host config, not Flux-reconciled) - `rosenpass-metrics.sh` — POSIX `sh`, run by `rosenpass-metrics.timer` every 60 s as root on rpi and siriussec only. Writes `/var/lib/node-exporter/textfile/rosenpass.prom` atomically (tmp+mv) with: - `rosenpass_unit_active{node="<host>"}` - `rosenpass_psk_rotation_age_seconds{node,interface="wg0"}` - `rosenpass_psk_rotation_last_change_timestamp_seconds{node,interface="wg0"}` The `wg show wg0 preshared-keys` output is piped straight into `sha256sum`; only the digest + last-change timestamp are stored (`/var/lib/rosenpass-exporter/last-hash`, root-only). No key material is printed, logged or persisted. - `rosenpass-metrics.service` / `.timer` with `ProtectSystem=strict`, `StateDirectory=`; deliberately no `Requires=`/`After=` on `rosenpass.service` — the recorder must keep reporting while the unit it watches is dead. **`monitoring/controllers/home/values.yaml`** — inside `prometheus-node-exporter:`: `--collector.textfile.directory=/host/textfile`, hostPath `/var/lib/node-exporter/textfile` (`DirectoryOrCreate`, so linode keeps starting), read-only mount. The chart's image is distroless with no textfile collector and `--collector.systemd` needs dbus, hence the host script. **`monitoring/controllers/home/rosenpass.yaml`** — `PrometheusRule` labelled `release: kube-prometheus-stack`: - `RosenpassDown`: `max by (node) (rosenpass_unit_active) == 0` for 5 m, warning - `RosenpassPskRotationStalled`: `max by (node, interface) (rosenpass_psk_rotation_age_seconds) > 900` for 10 m, warning - both carry `absent()` arms naming rpi/siriussec, so a missing series (timer off, script broken, scrape gone) alerts instead of reading as healthy — and linode, which has node-exporter but no rosenpass, does not page. ## Verification done on this branch (pre-merge) - `kubectl kustomize monitoring/controllers/home` → exit 0, 5 PrometheusRules in the output including `rosenpass`. - `promtool check rules` on the rendered `spec.groups` (in-cluster pod, prometheus v3.15.1 image) → `SUCCESS: 2 rules found`. - `helm template` of the pinned chart (kube-prometheus-stack 92.14.0 / node-exporter 4.60.1) shows the three args (textfile dir + the two default filesystem excludes, re-stated because Helm replaces lists, not merges) plus the textfile volume/mount. - Host script installed and running on both ends: timer `active (waiting)`, `.prom` file contains all three series with `rosenpass_unit_active 1` and a fresh timestamp. ## Not verifiable until this merges Series present in Prometheus, either alert actually firing, and Alertmanager → Telegram delivery. Flux only reconciles `master`, so nothing here is live yet. Out of scope: Link B / Linode / Phase C, any change to rosenpass itself, Grafana dashboard.
Rosenpass rotates the Link A preshared key (rpi wg0 10.10.0.1 <->
siriussec wg0 10.10.0.2) about every two minutes, but WireGuard keeps
using the last key it received: a dead or wedged exchange leaves the
tunnel up and silently non-post-quantum, with no alerting signal.

node-exporter here is distroless without the textfile collector (and
without the dbus plumbing --collector.systemd needs), so observe the
host directly:

- infrastructure/networking/rosenpass/: POSIX sh script run by a 60 s
  systemd timer on rpi and siriussec that writes
  /var/lib/node-exporter/textfile/rosenpass.prom. It exports
  rosenpass_unit_active, rosenpass_psk_rotation_age_seconds and
  rosenpass_psk_rotation_last_change_timestamp_seconds; the PSK listing
  is only ever sha256'd, never logged or persisted.
- values.yaml: enable --collector.textfile.directory and mount the
  hostPath (DirectoryOrCreate, so linode's node-exporter still starts).
  extraArgs replaces the subchart defaults, so the two filesystem
  exclusions are repeated verbatim.
- rosenpass.yaml: RosenpassDown (5 m) and RosenpassPskRotationStalled
  (age > 900 s, 10 m), both warning, both with absent() arms so a
  missing series alerts instead of reading as healthy.

Host units are installed out of band (see the directory README); the
GitOps side needs a merge before Prometheus loads the rules.
sirius merged commit 2134f5a1d6 into master 2026-12-03 07:22:42 +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!84
No description provided.