Skip to content

feat(network): watch the dynamic DNS record against the WAN address - #627

Merged
Gerrrt merged 1 commit into
mainfrom
gerrrt/dns-record-freshness-check-779837
Sep 22, 2026
Merged

Gerrrt merged 1 commit into
mainfrom
gerrrt/dns-record-freshness-check-779837

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Closes #604.

What

make gateway-state, which runs every 15 minutes, now also checks whether the remote path's dynamic DNS name still resolves at a public resolver to the address the WAN holds.

  • The comparison runs on morpheus. A script goes over ssh on stdin. On the firewall it reads the name from config.xml through pfSense's config API and the address from the interface, then runs drill @1.1.1.1. It prints one word: match, stale or unchecked. The name and the address never appear in an argv, a variable, a log or a series on the monitoring host.
  • Two booleans, labelled with host alone. homelab_ddns_record_checked, and homelab_ddns_record_matches_wan. The second is left out when the comparison did not run, so a resolver outage cannot look like a stale record. NXDOMAIN, an empty answer, and one right A beside one wrong A all count as stale.
  • DdnsRecordStale (warning): matches_wan == 0 for 1h, which is four samples and well past a forced update or the TTL. The description gives both causes and says Force update comes first.
  • DdnsRecordUnchecked (warning): checked == 0 for 6h, so a broken check cannot pass as silence.

Docs

  • observability.md: what the series do and do not disclose.
  • open-the-remote-path.md: runbook rows for both alerts, plus a note in §0 step 4.
  • ADR-0044: a marked update under the consequence this closes.
  • Rule counts moved from 94 to 96 and from 112 to 114 wherever they are claimed.

Verified

  • collect-gateway-state.sh --self-test: 16 cases. Eleven are new: ten fixtures for the verdict awk, plus an sh -n parse check of the firewall script.
  • promtool: each rule has firing and quiet cases.
  • Live against morpheus: checked 1 and matches_wan 1. The firewall script's whole output is one line and one word, and nothing in the full --print output is shaped like an IPv4 address.
  • With GATEWAY_DDNS_RESOLVER=192.0.2.1: checked 0, and no matches_wan series.
  • ./scripts/validate.sh is green after rebasing onto current main.

After merge

Converge is report-only. The timer runs make from the main checkout, so the new series and rules go live once that checkout is pulled and Prometheus reloads its rules.

🤖 Generated with Claude Code

ADR-0044 left record freshness unmonitored, and the WAN address is sticky,
so a broken updater would stay hidden until the day the address moved and
the operator was outside trying to get in.

gateway-state now also sends a script to morpheus over ssh on stdin. It
reads the name from config.xml and the address from the WAN interface, asks
1.1.1.1 with drill, and prints one word: match, stale or unchecked. Neither
value leaves the firewall. Two booleans are emitted, labelled with host alone:
homelab_ddns_record_checked, and homelab_ddns_record_matches_wan, which is
left out when the comparison could not run. A resolver outage therefore never
reads as a stale record.

DdnsRecordStale fires after an hour of mismatch, which is four samples, well
past any forced update or TTL. DdnsRecordUnchecked fires after six hours
without a comparison, so a broken check cannot pass as silence. The verdict
logic is covered by eleven self-test fixtures; each rule has firing and quiet
promtool cases.

Docs: what the series do and do not disclose (observability.md), runbook
rows for both alerts, a marked update under ADR-0044's consequence, and
the rule counts moved from 94 to 96 and from 112 to 114.

Closes #604

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit 8a9a8ec into main Sep 22, 2026
3 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/dns-record-freshness-check-779837 branch September 22, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The dynamic DNS record is unwatched, and the remote path now depends on it

1 participant