Skip to content

feat(logs): relay neo's log through morpheus (ADR-0127) - #1680

Merged
Gerrrt merged 4 commits into
mainfrom
gerrrt/apply-adr-0127
Nov 23, 2026
Merged

Gerrrt merged 4 commits into
mainfrom
gerrrt/apply-adr-0127

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

What changed

This applies ADR-0127. neo's log is relayed through syslog-ng on morpheus and stored in Loki as host="neo". The receiver side is in this PR:

  • syslog.alloy gets a neo sender rule. It matches only morpheus's connection address and the hostname neo, and gives those lines a fixed app="routeros".
  • Every firewall Loki selector (filterlog, Suricata, Kea) now requires host="morpheus".
  • Two new rules: SwitchLoginFromUnexpectedSource and SwitchLogsStopped.
  • The procedure is a new §10 of ship-firewall-logs.md.

The ADR moves to Accepted.

The morpheus side is already live, by hand, as the ADR orders. Nothing has been sent on it yet:

  • three syslog-ng objects (s_neo, r_host_neo, r_host_morpheus), with the existing TLS log path now rewriting HOST to morpheus;
  • one pass on igc0, Allow Neo syslog to Firewall, 10.7.7.2 → 10.7.7.1 UDP 5514.

neo is pointed at the relay only after this deploys.

Why

ADR-0127 (#1659): the core switch kept its log in RAM only, 1,000 lines deep.

Applying it turned up three things the ADR got wrong or didn't know. They are fixed here and recorded in the changelog:

  • morpheus's existing syslog-ng source has no flags(no-hostname). It is package-generated and can't take the flag, and §3 of the runbook described a source that never ran. The morpheus path now rewrites HOST to morpheus, so only the neo path can produce neo.
  • Home Assistant's logins aren't a heartbeat. It logged in once in four hours. neo gets a 5-minute log-heartbeat scheduler entry, so SwitchLogsStopped has something to measure against.
  • ether4 (mjolnir's card) is flapping. It has had 48,057 link-downs in 16 days and filled 987 of the 1,000 buffered lines. That is not fixed here.

Blast radius

prometheus's Alloy, which loads the whole directory as one config, and Loki's ruler. If either is wrong, every firewall alert is affected, which is why the tests below cover both. Separately, morpheus has one new pass on the switch LAN, to its own address only, and two new syslog-ng objects.

  • No change to network segmentation or firewall rules: one pass to the gateway's own address on igc0. It reaches no segment, and nothing into or out of Winterfell changes.
  • No new port published to a VLAN that could not already reach the service: 10.7.7.1:5514 is bound on the switch LAN only.
  • No credential added outside secrets/*.sops.yaml

Verification

  • scripts/check_syslog_senders.sh: 14/14 pass, including three new neo cases (labels, a suricata tag on Skids's facility, and neo from another address dropped and counted). With the app="routeros" rule removed, the two label cases fail.

  • scripts/test_loki_rules.py: 72/72 tests over 28 of 28 rules. New cases: a neo line tagged filterlog doesn't keep FirewallLogsStopped quiet, and a priority-1 neo line tagged suricata doesn't fire.

  • On morpheus: the syslog-ng syntax test was clean before applying, and sockstat shows 127.0.0.1:5140 and 10.7.7.1:5514. morpheus's own lines kept arriving in Loki after the restart, with filterlog, kea-dhcp4 and others in the next minute. pfctl -sr shows the pass directly below the NTP pass and above Block access to Winterfell.

  • check_docs.py and lint.sh pass.

  • make validate passes locally with 5 checks skipped: the offsite tmpfs path refusal, and four deployment-checkout checks that don't apply in a worktree. CI runs them.

  • make validate passes

  • Deployed to the lab and confirmed working: the morpheus side is done, and the Alloy/Loki deploy and neo follow the merge.

  • Docs updated (docs/, service README, or docs/roadmap.md)

Refs #1659

🤖 Generated with Claude Code

…firewall's alerts (ADR-0127)

syslog.alloy stores a line as host="neo" only when it arrives on
morpheus's pinned connection with hostname neo, and gives it a fixed
app="routeros" so no tag on that path reads as filterlog, Suricata or
Kea. The firewall's Loki selectors also require host="morpheus". Two
rules read the new stream: SwitchLoginFromUnexpectedSource and
SwitchLogsStopped, the second against a five-minute heartbeat because
Home Assistant's logins came once in four hours.

ship-firewall-logs.md §3 now describes the syslog-ng config that runs,
whose generated source cannot take flags(no-hostname), and §10 is the
neo procedure. restore-the-firewall.md checks both streams come back.
ADR-0127 is accepted, and README's ADR count is corrected to 127.

Refs #1659

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 18:32
# Conflicts:
#	README.md
#	docs/changelog.md
@Gerrrt
Gerrrt enabled auto-merge (squash) November 23, 2026 18:35

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 upgrade sequence omits a required hostname rewrite, risking misattributed logs and suppressed switch alerts, while a Loki label collision causes false critical login alerts and incorrect source reporting.

2 open issues
What changed in this PR

Implements ADR-0127’s receiver-side support for relaying neo’s switch logs through morpheus into Loki, while keeping switch logs separate from firewall alerts.

Changes:

  • Adds Alloy sender identification and fixed routeros labeling, with firewall rules restricted to host="morpheus".
  • Adds unexpected-login and missing-log alerts for neo, plus sender and alert fixtures.
  • Documents deployment, recovery, and incident response; accepts ADR-0127 and updates rule and ADR counts.
File Description
stacks/​observability/​README.md Updates the Loki rule count.
stacks/​observability/​loki/​tests/​security.test.yaml Adds switch alert and firewall-isolation fixtures.
stacks/​observability/​loki/​rules/​security.rules.yaml Scopes firewall selectors and adds two switch alerts.
stacks/​observability/​alloy/​syslog.alloy Identifies relayed switch logs and isolates their labels.
scripts/​check_syslog_senders.sh Adds switch sender acceptance and rejection checks.
README.md Updates alert and ADR totals.
docs/​security.md Documents the gateway syslog pass and alert total.
docs/​runbooks/​ship-firewall-logs.md Corrects relay setup and adds switch deployment steps.
docs/​runbooks/​restore-the-firewall.md Adds recovery checks for both log streams.
docs/​runbooks/​respond-to-a-security-alert.md Adds switch-login investigation guidance.
docs/​observability.md Describes the two switch alerts.
docs/​network.md Documents the syslog path and heartbeat.
docs/​firewall-claims.yaml Clarifies gateway-only passes in comments.
docs/​changelog.md Records the implementation and operational observations.
docs/​architecture.md Adds the switch-to-firewall syslog exception.
docs/​adr/​0127-relay-neos-log-through-morpheus.md Accepts the decision and corrects relay and heartbeat assumptions.

Review effort: Balanced

Comment thread docs/runbooks/ship-firewall-logs.md Resolved
Gerrrt and others added 2 commits November 23, 2026 18:59
…elay rewrite first

Every line on the syslog path carries source="network", so Loki renamed
the regexp's `source` capture to source_extracted and the rule compared
"network": every login to neo, expected or not, would have paged. The
capture is now login_from, and the fixtures carry source: network as
production lines do; the old rule fails all three login cases against
them. ship-firewall-logs.md §10 now makes morpheus's r_host_morpheus
rewrite a checked first step, before Alloy trusts the hostname neo.

Refs #1659

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	README.md
#	docs/observability.md
#	docs/security.md
@Gerrrt
Gerrrt merged commit bc218d2 into main Nov 23, 2026
9 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/apply-adr-0127 branch November 23, 2026 19:16
Gerrrt added a commit that referenced this pull request Nov 23, 2026
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