feat(rosenpass): alert on a vanished Link B series and on the UPnP mapping
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.
This commit is contained in:
parent
5fc7cd4ead
commit
d1343bbbc3
4 changed files with 120 additions and 15 deletions
|
|
@ -15,11 +15,23 @@ set -uo pipefail
|
|||
LAN_IP=192.168.1.125
|
||||
PORT=9999
|
||||
DESC=rosenpass-pq
|
||||
# Result of this run, read by rosenpass-metrics.sh (60 s textfile collector) so
|
||||
# the mapping is observable without polling the IGD from that timer. /run is
|
||||
# tmpfs: on a reboot the file is gone and the metric is absent until this unit
|
||||
# runs again (OnBootSec=2min), which the alert treats as "unknown", not "lost".
|
||||
STATE=/run/rosenpass-upnp.present
|
||||
|
||||
set_present() {
|
||||
printf '%s\n' "$1" > "$STATE.tmp" && mv "$STATE.tmp" "$STATE"
|
||||
}
|
||||
|
||||
out=$(upnpc -e "$DESC" -a "$LAN_IP" "$PORT" "$PORT" UDP 0 2>&1) || true
|
||||
|
||||
# upnpc prints the mapping as " 0 UDP 9999->192.168.1.125:9999 'rosenpass-pq'"
|
||||
if ! upnpc -l 2>/dev/null | grep -q "${PORT}->${LAN_IP}:${PORT}"; then
|
||||
set_present 0
|
||||
logger -t rosenpass-upnp "mapping missing after re-assert: ${out}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set_present 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue