feat(ops): alert when a port is published to the internet that nothing allows (stacked on #106) #107
Loading…
Reference in a new issue
No description provided.
Delete branch "jfraeys/feat/exposure-drift-alert"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Merge #106 first (stacked on the infra_metrics role).
The LLDAP admin panel sat on the public internet because UFW cannot see Docker-published ports, and only a staging check found it. This makes production tell you within an hour next time.
Tests: 8 unit tests with faked docker/iptables (flags only what is neither allowed nor dropped; a DROP in either IP family counts; drops never excuse UDP; empty allowlist flags all public ports; default output unchanged; metrics written atomically with mode 0644; clean host writes zero; a failing check leaves the old file) plus 3 promtool scenarios (fires after the 5-minute window with the right labels, a clean host never alerts, a stopped timer goes stale), mutation-checked. All 36 rules pass promtool check. ansible-lint and yamllint clean. While writing the test I had the for: 5m boundary wrong (it fires at the second evaluation, not before); corrected the test, not the rule.
Not exercised on a real node: the timer and first run; check with systemctl list-timers infra-exposure.timer and ls /var/lib/node_exporter/textfile_collector/infra_exposure.prom after deploying with --tags infra_metrics,prometheus.
🤖 Generated with Claude Code