homek8s/infrastructure/networking/rosenpass/rosenpass-metrics.service
Lance Walters 5177b13004 feat(monitoring): alert on Rosenpass unit state and stalled PSK rotation
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.
2026-12-03 02:16:30 -05:00

23 lines
1,006 B
Desktop File

[Unit]
Description=Rosenpass health metrics for node-exporter (textfile collector)
Documentation=file:///usr/local/sbin/rosenpass-metrics.sh
# No Requires=/After= on rosenpass.service or [email protected] on purpose:
# the recorder has to keep running and keep exporting while the unit it watches
# is dead or the interface is down — a hard dependency would take the metric
# away exactly when it becomes the alert.
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/rosenpass-metrics.sh
User=root
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
# /var/lib/rosenpass-exporter (hash state) is created by systemd.
StateDirectory=rosenpass-exporter
# The textfile dir is shared with the node-exporter DaemonSet (hostPath). It is
# created by the install step; the leading `-` keeps the unit startable if a
# node has lost it (the node-exporter DirectoryOrCreate recreates it), instead
# of failing the whole unit with 226/NAMESPACE.
ReadWritePaths=-/var/lib/node-exporter/textfile