Skip to content

fix(firewall): close the firewall's own addresses to every segment, key-only sshd - #1503

Merged
Gerrrt merged 9 commits into
mainfrom
gerrrt/morpheus-self-access-key-only
Nov 23, 2026
Merged

Gerrrt merged 9 commits into
mainfrom
gerrrt/morpheus-self-access-key-only

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

What changed

Every interface's Block SSH/HTTPS/HTTP to pfSense rows are to name This Firewall (self) instead of that interface's own address. Winterfell gains Allow SSH to pfSense from prometheus, and sshd goes to Public Key Only (ADR-0129). The firewall change is made in the pfSense UI by the new runbook, close-the-firewall-to-its-segments.md.

check_firewall_claims.py gains a second question: per interface, which of the firewall's own addresses a host there reaches on ssh, http and https. It evaluates the ruleset the way pf does, one address at a time, and names addresses by segment, WAN or link-local, never by number. Unknowns resolve toward "reachable". It also gets its first fixtures (11), which CI now runs through self-tests.sh.

Applied on 2026-11-23, the date the docs give. Brought up to date with main the same day; ADR-0117, 0126, 0127 and 0128 were taken meanwhile, so this one is ADR-0129.

Why

A read-only audit of morpheus on 2026-11-13 found two problems:

  • Every segment reached the admin UI and sshd on the WAN address. The per-interface blocks named only their own address, and the catch-all's to any carried the rest. From prometheus, HTTPS there answered 200 and port 22 gave a banner. network.md said Winterfell was blocked from the UI.
  • Hicks also reached both on 10.0.30.1, through Allow Hicks access to ImaginationLAN.

sshd accepted passwords. The existing claims check could not see any of this, because the WAN address is in no segment.

Blast radius

  • No change to network segmentation or firewall rules. It changes rules: three blocks per interface are re-pointed, Hicks' three move above its lab rule, one pass is added on Winterfell, and the dead Allow SSH from Mac to WSL rule was deleted.
  • No new port published to a VLAN that could not already reach the service
  • No credential added outside secrets/*.sops.yaml

If the Hicks rows go in the wrong order, the UI locks out from Hicks. The runbook gives two ways back: the console's Restore recent configuration, and the anti-lockout rule on the switch LAN. If the Winterfell pass is wrong, prometheus's collectors, the nightly export and this check lose SSH. Runbook §2.3 tests for that before going on. oracle and trinity lose port 22 on the firewall; nothing scheduled on either uses it. Key-only SSH locks out any machine whose key is not on admin, and §1 proves each key first.

Verification

  • make validate passed before the merges with main; after them, check_docs.py, lint and the firewall-claims self-test pass (5 local skips: worktree-only timer and unit checks and the tmpfs offsite refusal; CI runs them)
  • Deployed and confirmed working: applied by the runbook on 2026-11-23. From prometheus: make check-firewall 35 PASS, 0 FAIL (21 FAILs before); the WAN address answers neither https (000) nor ssh (blocked); sshd -T reads passwordauthentication no, kbdinteractiveauthentication no, permitrootlogin yes; a password login is refused with Permission denied (publickey); prometheus's key still logs in. The three administering keys were proved with key-ok before §6.
  • Docs updated: network.md, security.md, firewall-claims.yaml, the changelog, ADR-0129 and the runbook

python3 scripts/check_firewall_claims.py --self-test: 11 PASS. --derive against the live firewall reproduces the audit by hand: Winterfell reaches only the WAN address on https and http. scripts/check_docs.py and scripts/lint.sh pass, with nothing skipped.

🤖 Generated with Claude Code

…ey-only sshd

Every interface's Block SSH/HTTPS/HTTP to pfSense rows named only that
interface's address, so every segment reached the admin UI and sshd on the
WAN address, and Hicks on the lab gateway too (2026-11-13 audit). ADR-0126
re-points them at This Firewall (self), adds a prometheus-only SSH pass on
Winterfell, and sets SSHd Key Only. The UI change is the new runbook.

check_firewall_claims.py now also asks which of the firewall's own
addresses each segment reaches on ssh, http and https, evaluated the way pf
does, with its first fixtures under self-tests.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt force-pushed the gerrrt/morpheus-self-access-key-only branch from b059bb7 to e6442d6 Compare November 23, 2026 05:39
Gerrrt added a commit that referenced this pull request Nov 23, 2026
…piry; true up the audit's docs

The repository side of the 2026-11-13 morpheus audit, apart from the
firewall's own addresses and key-only sshd (#1503).

- loki/rules/ups.rules.yaml: NutUpsDataStaleSustained (a stale period two
  minutes long) and NutUpsDataStaleFrequent (over twenty in an hour). The
  fortnight to 2026-11-23 had 1,363 periods, none over 5.2 s, at most nine
  an hour. Five behaviour tests. Neither sees a gap that lasts days, as the
  2026-11-05 driver outage did, because syslogd folds repeats; so
  scripts/collect-nut-state.sh asks upsc on the firewall from make
  gateway-state, and NutUpsUnreadable pages after 30 minutes.
- collect-cert-expiry.sh --file, for a client certificate with no handshake
  to read. make gateway-state reads the syslog listener's leaf and
  morpheus's pinned client leaf; SyslogTlsCertificateExpiringSoon warns at
  30 days, and the console rules exclude syslog-*.
- network.md: the undeclared Hicks SSH pass into smaug (ten passes), Skids'
  eighth reservation at .24, and the thirteen static ARP reservations.
- hardware.md: check_versions.py does collect pfSense's release.
- Changelog: the audit, and where each finding stood on 2026-11-23.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gerrrt and others added 4 commits November 23, 2026 17:55
main took ADR-0126 (gandalf monitoring, #1676) and ADR-0127 (neo's log
relay), so this PR's ADR moves to 0128, with every reference. README counts
128 ADRs and 54 runbooks.

Also corrects three links the earlier renumber broke: network.md and
security.md named phoenix's ADR-0117 "ADR-0126".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main's #1677 took ADR-0128 (prometheus's key-only sshd), so this PR's ADR
moves to 0129, with every reference to it; prometheus's ADR-0128 links are
left as main has them. README counts 129 ADRs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e deleted WSL rule from §3

make check-firewall 35/35, the WAN address closed to https and ssh, sshd
key-only, a password login refused. The dead Mac-to-WSL rule was deleted
during §3, so the runbook's ordering list no longer names it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt marked this pull request as ready for review November 23, 2026 18:57
Copilot AI balanced review requested due to automatic review settings November 23, 2026 18:57
@Gerrrt
Gerrrt enabled auto-merge (squash) November 23, 2026 19:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The checker can falsely declare management paths closed by ignoring rule suffixes and mishandling table exclusions and negated sources, while contradictory guidance can encourage accepting unexpected exposure.

4 open issues
What changed in this PR

This PR documents and verifies tighter access to pfSense’s management services across the lab, extending the existing firewall-claims checker to cover the firewall’s own addresses.

Changes:

  • Records blocks targeting This Firewall (self), explicit management exceptions, and key-only SSH.
  • Adds per-address management-port evaluation and 11 self-test cases to the claims checker.
  • Adds deployment, verification, and recovery instructions, with updated policy documentation.
File Description
systemd/​homelab-firewall-claims.service Updates comments describing the expanded check.
scripts/​self-tests.sh Documents the firewall checker’s fixtures.
scripts/​README.md Describes management-address coverage.
scripts/​check_firewall_claims.py Adds address discovery, rule evaluation, comparisons, and fixtures.
README.md Updates ADR and runbook counts.
docs/​security.md Documents management restrictions and key-only SSH.
docs/​runbooks/​close-the-firewall-to-its-segments.md Adds rollout, verification, and rollback procedures.
docs/​network.md Updates firewall access policy and SSH-hardening details.
docs/​firewall-claims.yaml Declares expected management access per interface.
docs/​changelog.md Records deployment and verification results.
docs/​adr/​0129-close-the-firewalls-own-addresses-and-take-passwords-off-its-ssh.md Records the hardening decision, exceptions, and tradeoffs.

Review effort: Balanced

Comment thread scripts/check_firewall_claims.py Resolved
Comment thread scripts/check_firewall_claims.py Resolved
Comment thread scripts/check_firewall_claims.py Resolved
Comment thread scripts/check_firewall_claims.py Resolved
@Gerrrt
Gerrrt disabled auto-merge November 23, 2026 19:05
… cannot fully evaluate

Copilot's review of #1503, four points:

- A rule's text after the address part was ignored, so a block ending in
  flags A/A or tagged read as closing the port. Anything but flags S/SA,
  flags any, state options, tag and allow-opts now marks the rule
  conditional: a block is skipped, a pass is taken.
- A table's ! entries were dropped, so a block to {0.0.0.0/0, !WAN} closed
  the WAN address. Destination lookup now takes the most specific entry; a
  source table with an exclusion overlapping the segment is unknown.
- A negated source was the negation of 'contains the segment', so a block
  from ! 10.0.99.0/25 covered all of 10.0.99.0/24. Sources now resolve to
  all, some or none of the segment, and a negation covers only when disjoint.
- When a management path opened, the stale-file advice still followed the
  warning; it now returns before it.

Three fixtures, each failing on the old code. Live: 35/35.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt enabled auto-merge (squash) November 23, 2026 19:09
Gerrrt and others added 3 commits November 23, 2026 19:23
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit 82eee00 into main Nov 23, 2026
9 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/morpheus-self-access-key-only branch November 23, 2026 20:11
Gerrrt added a commit that referenced this pull request Nov 24, 2026
… stalls (#1702)

* docs(ups): NUT's driver retries for 14 seconds, riding out the card's stalls

The data stale spells were the UPS card going silent for 2-8 s; NUT's
defaults gave up at about 6 s. Records the snmp_timeout/snmp_retries
arguments applied on morpheus on 2026-11-23 in the runbook, observability
and the changelog.

Refs #1503.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(ups): the 14 seconds is per request; slow exporter scrapes were retried, not failed

Review on #1702: upsd's MAXAGE counts from the driver's last message, so
the retry budget does not set an outage-detection delay, and the exporter's
5 s is a per-request timeout inside a 45 s scrape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Gerrrt added a commit that referenced this pull request Nov 24, 2026
…ft open (#1716)

* docs(network): name the three Hicks pool leases the morpheus audit left open

.100 is laptop-02 on Wi-Fi, .101 is mobile-02 (was .109), and .105 is
desktop-01 on its second Ethernet port, so its .20 reservation and static
ARP entry do not apply. mobile-01's row no longer claims .105.

Refs #1503.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(network): desktop-01's reservation now follows the port it uses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants