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.
This commit is contained in:
parent
b909456a3e
commit
5177b13004
7 changed files with 333 additions and 0 deletions
|
|
@ -11,6 +11,10 @@ resources:
|
|||
- prune-alerts.yaml
|
||||
# Flow-loss gate + material-loss alerts for the Hubble sensor (audit F10).
|
||||
- hubble-loss-gate.yaml
|
||||
# Rosenpass unit-state + PSK-rotation alerts for Link A (rpi <-> siriussec).
|
||||
# Series come from a host textfile exporter (infrastructure/networking/rosenpass/),
|
||||
# so silently missing data is itself an alert.
|
||||
- rosenpass.yaml
|
||||
# Nightly consistent sqlite snapshot of Grafana's dashboards/alerts/users.
|
||||
- grafana-backup.yaml
|
||||
- dashboards
|
||||
|
|
|
|||
94
monitoring/controllers/home/rosenpass.yaml
Normal file
94
monitoring/controllers/home/rosenpass.yaml
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
# Rosenpass (post-quantum PSK rotation) -> Prometheus
|
||||
#
|
||||
# Link A (rpi wg0 10.10.0.1 <-> siriussec wg0 10.10.0.2) runs rosenpass 0.2.3
|
||||
# as a host systemd unit on both ends, rotating that WireGuard peer's
|
||||
# preshared key roughly every two minutes. Nothing about the *tunnel* depends
|
||||
# on it working: WireGuard keeps using the last PSK it received, so a dead or
|
||||
# stalled exchange leaves the link up and silently non-post-quantum. These two
|
||||
# alerts are the only thing that notices.
|
||||
#
|
||||
# Why a host script and not a collector: the
|
||||
# kube-prometheus-stack-prometheus-node-exporter DaemonSet is distroless and
|
||||
# has no --collector.textfile.directory (only /host/proc, /host/sys and
|
||||
# /host/root are mounted), while --collector.systemd needs dbus plumbing it
|
||||
# does not have. So /usr/local/sbin/rosenpass-metrics.sh on rpi and siriussec
|
||||
# (committed under infrastructure/networking/rosenpass/, driven by
|
||||
# rosenpass-metrics.timer every 60 s) writes the textfile, and the
|
||||
# prometheus-node-exporter block in values.yaml turns the collector on.
|
||||
#
|
||||
# Series, emitted per host, never containing key material (the PSK set is only
|
||||
# SHA-256 hashed, in a root-only state file):
|
||||
# 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"}
|
||||
#
|
||||
# Both rules carry an absent() arm deliberately: a metric that simply stops
|
||||
# arriving (timer disabled, script broken, node-exporter down, scrape lost)
|
||||
# must alert, because "nothing happened" is exactly what a healthy rotation
|
||||
# looks like from Prometheus' side. The absent arms name the two hosts that run
|
||||
# the timer so linode — which has node-exporter but no rosenpass — does not page.
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: rosenpass
|
||||
namespace: monitoring
|
||||
labels:
|
||||
release: kube-prometheus-stack
|
||||
spec:
|
||||
groups:
|
||||
- name: rosenpass
|
||||
rules:
|
||||
- alert: RosenpassDown
|
||||
expr: |
|
||||
(
|
||||
max by (node) (rosenpass_unit_active) == 0
|
||||
)
|
||||
or
|
||||
(
|
||||
absent(rosenpass_unit_active{node="rpi"})
|
||||
or
|
||||
absent(rosenpass_unit_active{node="siriussec"})
|
||||
)
|
||||
for: 5m
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: "Rosenpass is not active on {{ $labels.node }}"
|
||||
description: >-
|
||||
The unit on {{ $labels.node }} is not reporting active, or the
|
||||
series is missing entirely (timer, script or scrape gone).
|
||||
WireGuard on Link A keeps working on the last preshared key, so
|
||||
traffic gives no hint — the tunnel has silently stopped being
|
||||
post-quantum until this is fixed. On that host check
|
||||
`systemctl status rosenpass` and
|
||||
`systemctl list-timers rosenpass-metrics.timer`, then
|
||||
`cat /var/lib/node-exporter/textfile/rosenpass.prom`. Do not
|
||||
restart rosenpass on only one end: a one-sided restart leaves the
|
||||
pair disagreeing until the next rekey.
|
||||
- alert: RosenpassPskRotationStalled
|
||||
expr: |
|
||||
(
|
||||
max by (node, interface) (rosenpass_psk_rotation_age_seconds) > 900
|
||||
)
|
||||
or
|
||||
(
|
||||
absent(rosenpass_psk_rotation_age_seconds{node="rpi", interface="wg0"})
|
||||
or
|
||||
absent(rosenpass_psk_rotation_age_seconds{node="siriussec", interface="wg0"})
|
||||
)
|
||||
for: 10m
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: >-
|
||||
No rosenpass PSK rotation on {{ $labels.node }} {{ $labels.interface }}
|
||||
for over 15 minutes
|
||||
description: >-
|
||||
Rotation runs about every two minutes, so a preshared-key set that
|
||||
has not changed in 15 minutes means the exchange has stalled
|
||||
(peer unreachable, unit wedged) or the metric has gone missing.
|
||||
The link still passes traffic on the last key, which is why this
|
||||
is otherwise invisible. Check `systemctl status rosenpass` and
|
||||
`journalctl -u rosenpass -n 30` on both rpi and siriussec, and
|
||||
confirm the Pi still admits 9999/udp from 192.168.1.179
|
||||
(`sudo ufw status | grep 9999`).
|
||||
|
|
@ -255,6 +255,33 @@ prometheus-node-exporter:
|
|||
# to linode. node-exporter is a read-only host-metrics DaemonSet (hostPath
|
||||
# /proc + /sys, host network); it adds ~700 series per node, well inside the
|
||||
# 8GB retentionSize cap, and rpi's PreferNoSchedule taint does not exclude it.
|
||||
#
|
||||
# Textfile collector: rosenpass-metrics.sh on rpi/siriussec writes
|
||||
# /var/lib/node-exporter/textfile/rosenpass.prom and the DaemonSet serves it
|
||||
# from /metrics (alerts: monitoring/controllers/home/rosenpass.yaml, host
|
||||
# units: infrastructure/networking/rosenpass/). The image is distroless with
|
||||
# no collector enabled, so the flag below is what turns it on.
|
||||
#
|
||||
# extraArgs REPLACES the subchart default list — Helm replaces lists, it does
|
||||
# not merge them. The two filesystem exclusions are copied verbatim from
|
||||
# prometheus-node-exporter 4.60.1 (the subchart pinned by kube-prometheus-stack
|
||||
# 92.14.0); dropping them would add every container mountpoint to
|
||||
# node_filesystem_* and change the disk alerts.
|
||||
extraArgs:
|
||||
- --collector.textfile.directory=/host/textfile
|
||||
- --collector.filesystem.mount-points-exclude=^/(dev|proc|sys|run/containerd/.+|var/lib/docker/.+|var/lib/kubelet/.+)($|/)
|
||||
- --collector.filesystem.fs-types-exclude=^(autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|iso9660|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs|erofs)$
|
||||
extraVolumes:
|
||||
- name: textfile
|
||||
hostPath:
|
||||
path: /var/lib/node-exporter/textfile
|
||||
# DirectoryOrCreate: nodes with no rosenpass timer (linode) still get a
|
||||
# mountable empty directory instead of a CreateContainerConfigError.
|
||||
type: DirectoryOrCreate
|
||||
extraVolumeMounts:
|
||||
- name: textfile
|
||||
mountPath: /host/textfile
|
||||
readOnly: true
|
||||
resources:
|
||||
requests:
|
||||
cpu: 20m
|
||||
|
|
|
|||
Loading…
Reference in a new issue