Skip to content

Arm the lab tripwire on ImaginationLAN (ADR-0014) #234

Closed

Description

@Gerrrt

What and why

Decided in ADR-0014 (the answer to #86); not built. This issue is the build.

ADR-0014 puts ifrit — attack tooling and the vulnerable targets — on ImaginationLAN (30) and adds no egress filtering there. The one firewall change it does decide is a tripwire on the ImaginationLAN interface, in the shape #223 gave the three terminal segments:

pass in log quick on igc0.30 inet from <vlan30 net> to <Internal_Segments>

Placed below the block rules that stop 30 → 99/50/40/20/10 and the quick iLO return-path pass (10.0.30.10 → 10.0.99.20/udp), and above the → any egress rule. It matches nothing while the design holds and costs nothing; if it ever logs a line, the segment that holds attackers has reached the house.

It is log-only. It cannot weaken anything. docs/security.md's threat-table row "a lab VM escaping into the house" is currently asserted, not watched; this is what makes it watched, on the segment where that threat becomes real.

The pieces

  1. The rule itself, on morpheus, by hand — the firewall is not config-as-code. Re-run make backup-firewall afterwards, as the restore runbook says.
  2. Internal_Segments must not contain 10.0.30.0/24. If the alias includes the lab's own subnet, every DNS and NTP query to 10.0.30.1 matches the tripwire and logs. Check the alias before adding the rule; if it does include 30, the rule needs its own alias (Internal_Segments minus 30) rather than a change to the shared one that the three existing tripwires use.
  3. A Loki rule. TerminalSegmentReachedInternalNetwork in stacks/observability/loki/rules/security.rules.yaml hard-codes sources 10\.0\.(10|20|40)\. and destinations 10\.0\.(30|50|99)\. — VLAN 30 is on the wrong side of it. A sibling LabSegmentReachedInternalNetwork with source 10\.0\.30\. and destination 10\.0\.(10|20|40|50|99)\., severity critical, same for. make check-loki-rules boots a real Loki against it; mind the backtick raw-string note in the file header.
  4. docs/runbooks/restore-the-firewall.md step 4 greps igc0\.(10|20|40) and expects exactly 3. Becomes igc0\.(10|20|30|40) and 4.
  5. docs/security.md — the "Three tripwire rules" paragraph becomes four, and check_docs.py does not count tripwires, so nothing guards that number but the runbook grep.
  6. The homelab-security dashboard has "Terminal → internal" panels; the lab tripwire wants to appear there or in a sibling panel, so a line is seen and not only alerted on.

Optional, from the same ADR

ADR-0014 puts the vulnerable targets on a bridge inside ifrit with no physical port, on a subnet morpheus has no interface or route for. If forwarding is ever accidentally enabled on the attack VM, a target's packet arrives at igc0.30 with a source outside 10.0.30.0/24, misses the → any pass (which is from vlan30 net), hits default deny, and is logged as a block. A second Loki rule on {app="filterlog", action="block"} with that subnet as source catches the forwarding mistake for free. Its subnet is chosen when ifrit is built (#96), so this rule waits for that.

When

With ifrit, or before. There is no reason to wait: the rule is a no-op on today's segment and the only cost is one restore-runbook number.

Which VLAN does this touch

🟢 30 — ImaginationLAN (lab)

Activity

  1. added
    featureA new capability or a change
    securityA credential, an exposure, or a control that is weaker than recorded
    on Sep 1, 2026
  2. Gerrrt commented on Sep 8, 2026

    @Gerrrt
    OwnerAuthor

    The firewall half of this landed before the repository half did, and it landed
    into the trap item 2 predicted.

    What is on morpheus today (read 2026-09-08, pfctl -sr)

    Rule 1788730111, created 2026-09-06 21:28 UTC alongside the untagged-LAN
    blocks from Lemmiwinks#224:

    pass in log quick on igc0.30 inet from <OPT4__NETWORK> to <Internal_Segments>
      descr="TRIPWIRE (issue 223) - must never match ..."
    

    Placed exactly where this issue asked — below the five blocks and the logged
    untagged-LAN block, above Allow internet. That is item 1, done.

    Item 2 is where it goes wrong. Internal_Segments is
    10.0.30.0/24, 10.0.50.0/24, 10.0.99.0/24, 10.7.7.0/24 — it names the lab's own
    subnet. So every packet from the lab to its own gateway that is not caught by
    a block above falls onto the tripwire and is logged as a pass. Loki, last seven
    days, tracker 1788730111:

    Lines 1,239
    Destination 10.0.30.1:53/udp, every one of them
    Sources 10.0.30.110 (Saruman) 826, 10.0.30.40 (alexander) 348, 10.0.30.10 (shiva) 65
    Real crossings 0

    A tripwire that logs the lab's DNS is a DNS log, not a tripwire: the line that
    would matter is buried in the ones that do not, and Passed (1h) on the
    security dashboard has been counting gateway lookups as passes for three days.

    What this PR lands (the repository half)

    • LabSegmentReachedInternalNetwork in security.rules.yaml, sibling of
      TerminalSegmentReachedInternalNetwork: source 10\.0\.30\., destination
      every other segment including 10.7.7.0/24 and excluding 30 — so the
      rule is right even while the alias is wrong, which is why it has not fired on
      any of the 1,239 lines. Critical, for: 0s, same shape. make check-loki-rules
      boots the pinned Loki against it: 17 rules, 30 dashboard expressions, all
      evaluated. The sibling's destination class also gains 10.7.7, which
      Internal_Segments gained on 2026-09-06 without the Loki rule following.
    • restore-the-firewall.md §4 step 5 expects four tripwires on
      igc0.(10|20|30|40), accepts either alias name, and adds a third check that
      the lab's rule points at House_Segments.
    • docs/security.md, docs/observability.md, the security dashboard's text
      panel: four tripwires, and why the fourth points at a different alias.
    • The security dashboard gains Lab segment → house, by action beside the
      terminal panel, the violations log panel shows both directions, and the alert
      table lists the new rule. Counted claims bumped: 94 rules, 17 log-based,
      141 panels.

    What closes this issue — one firewall change, by hand

    1. Firewall → Aliases: create House_Segments = 10.0.10.0/24,
      10.0.20.0/24, 10.0.40.0/24, 10.0.50.0/24, 10.0.99.0/24, 10.7.7.0/24.
      Every segment except the lab's own.
    2. Edit rule 1788730111 on the ImaginationLAN tab: destination
      Internal_Segments → House_Segments. Apply. Leave Internal_Segments
      alone — the three terminal tripwires need 30 in it.
    3. make backup-firewall, as the restore runbook says after any rule change.

    Verification, from the monitoring host:

    ssh admin@10.0.99.1 'pfctl -sr | grep -E "^pass in log quick on igc0\.30 "'   # to <House_Segments>
    # and an hour later, Loki should return nothing for the tracker:
    curl -sG http://localhost:3100/loki/api/v1/query_range \
      --data-urlencode 'query={app="filterlog"} |= "1788730111"' --data-urlencode 'limit=5'

    Two things worth knowing, neither blocking

    • Loki rules have no unit-test harness. promtool test rules covers the
      Prometheus side and validate.sh fails a stack without tests; the Loki side
      is check_loki_rules.sh (parse, and that the ruler evaluates) and
      check_loki_coverage.py (live, can this rule see each host). The new rule
      is therefore proven to parse and to evaluate, not to fire — the same class of
      gap TerminalSegmentReachedInternalNetwork cannot fire — the firewall logs blocks only #223 closed for the terminal rule by briefly logging real traffic. The
      1,239 lines are, accidentally, that proof for the source half: they carry
      10.0.30.x exactly where the regex reads it.
    • The optional second rule from ADR-0014 (a target's packet with a
      172.30.30.0/24 source arriving on igc0.30 and being logged as a block)
      still waits for ifrit; nothing here changes that.

    The repository half is #393.

    🤖 Generated with Claude Code

  3. Gerrrt commented on Sep 8, 2026

    @Gerrrt
    OwnerAuthor

    Alias applied on 2026-09-08 and verified from the monitoring host.

    On morpheus (pfctl -sr, pfctl -t ... -T show):

    pass in log quick on igc0.30 inet from <OPT4__NETWORK> to <House_Segments> ... ridentifier 1788730111
    House_Segments   = 10.0.10.0/24 10.0.20.0/24 10.0.40.0/24 10.0.50.0/24 10.0.99.0/24 10.7.7.0/24
    Internal_Segments = 10.0.30.0/24 10.0.50.0/24 10.0.99.0/24 10.7.7.0/24   (unchanged, as it must be)
    

    In Loki: the last line carrying tracker 1788730111 is 10.0.30.40 → 10.0.30.1:53 at 13:33:47 UTC, before the change. Sixteen minutes later: zero lines since. The decisive number is the rule's own counter — pfctl -vsr shows 26 evaluations, 0 packets: the gateway lookups that used to match are still reaching the rule and no longer matching it. The three lab hosts that produced the 1,239 lines are still resolving at the gateway — Saruman's agent is pushing on schedule — and none of that traffic is logged any more, which is what ordinary egress should look like.

    The Loki side: the live ruler holds 17 rules after the reload, LabSegmentReachedInternalNetwork among them, and the rule's own query (10.0.30.x source, any house destination, action=pass) returns nothing over 6h.

    All six pieces of this issue are in place: the rule, the alias it needed, the Loki rule, the restore-runbook count, the four-tripwire docs, and the dashboard panels. make backup-firewall has been re-run since the change, per the restore runbook. Closing.

    🤖 Generated with Claude Code

  4. added a commit that references this issue on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new capability or a changesecurityA credential, an exposure, or a control that is weaker than recorded

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions