feat(monitors): heartbeat + real DNS source discovery + medium port-scan notice - #242
Merged
Merged
Conversation
…can notice network-monitor and dns-monitor showed "running" but emitted nothing, ever: both are detection-only and their thresholds rarely (or never) trip, so an operator could not tell "watching, quiet" from "dead". Three fixes: 1. Proof-of-life heartbeat (both, info severity, every 15m, never bannable): a low-severity summary of what each module observed in the window — dns-monitor reports queries seen and its active sources, network-monitor reports inbound connections/sources across listening ports. 2. dns-monitor was blind by default: it tailed /var/log/syslog etc., but systemd-resolved logs no queries there and the real resolver logs to a journal unit that was never configured. It now defaults to discovering the common per-query resolver units (moshpit-dns, dnsmasq, named, unbound, pdns-recursor), tailing only those that actually exist, and reports its real sources in the host status line (or "no source"). Config still overrides. 3. network-monitor now surfaces a smaller scan (5-9 listening ports) at MEDIUM, which logs but never bans (auto-defence bans at high); a real scan (10+) stays high. Inbound-to-listening only, so the ephemeral outbound-port bug that once banned our upstreams cannot recur. Tests: heartbeat emits info with the observed count and resets; DNS tunneling still alerts high; the 5-port medium notice fires without any high event; 10 ports still detects high. Full apps/cli suite 365 pass, build clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ThreatCrush Security Scan13 finding(s) HIGH/CRITICAL: 1 | MEDIUM: 6 | LOW: 6
Snippets are redacted; ThreatCrush never prints matched credential material. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
network-monitoranddns-monitorshow running but emit nothing, ever — so an operator can't tell "watching, quiet" from "dead". Both are detection-only with thresholds that rarely (network) or never (dns) trip:/var/log/syslogetc., but systemd-resolved logs no queries there by default and the real resolver logs to a journal unit that was never configured → it parses zero queries and cannot emit.Fixes
infoseverity, every 15m, never bannable): a low-severity summary of what each module saw in the window. dns-monitor reports queries seen + active sources; network-monitor reports inbound connections/sources across listening ports.moshpit-dns,dnsmasq,named,unbound,pdns-recursor), tailing only those that exist, and reports its real sources in the host status (orno source).[dns-monitor] journal_units=[...]still overrides.Tests
New
monitor-heartbeat.test.ts: heartbeat emitsinfowith the observed count and resets; DNS tunneling still alerts high; the 5-port medium notice fires with no high event; 10 ports still detects high. Fullapps/clisuite 365 pass,tsupbuild clean.🤖 Generated with Claude Code