Skip to content

feat(suricata): v1.92 — enforcement hardening + scope removal + policy layer + CI gates#440

Closed
itcmsgr wants to merge 8 commits intomainfrom
feat/v1.92-suricata-phase1
Closed

feat(suricata): v1.92 — enforcement hardening + scope removal + policy layer + CI gates#440
itcmsgr wants to merge 8 commits intomainfrom
feat/v1.92-suricata-phase1

Conversation

@itcmsgr
Copy link
Copy Markdown
Owner

@itcmsgr itcmsgr commented Apr 16, 2026

Summary — v1.92 Suricata Integration

Net change: -8,133 LOC (1,015 added, 9,148 deleted across 32 files)

Wave 1: Safety Foundation (+524 LOC)

  • invariants.go — INV-S-001..013 constants + authority labels
  • verify.gonftban suricata verify deployment checks
  • inline.go — Inline Exception Mode config + validation + SID cap
  • inline_exceptions.conf — default config (disabled, empty allowlist)

Wave 2: Scope Creep Removal (-8,589 LOC)

  • Deleted 4 Go packages: customrules/, recommendations/, scanner/, rules/
  • Deleted 8 CLI commands: custom, sid, recommend, profile, rules, scan + dispatcher cleanup
  • Deleted 6 shell scripts: rules, tools, advanced, iface, helpers, setup

Wave 3: Simplified Deployment (-446 LOC)

  • Rewrote install_suricata.sh: 636→190 LOC (package-only, no source build)
  • suricata_managed_install() / disable() / status() entry points
  • SURICATA_UNMANAGED=true escape hatch

Wave 4: User Policy Layer (+297 LOC)

  • detection.conf — category toggles
  • actions.conf — response mapping per category
  • policy.go — Go loader with .local override support

Wave 5: CI Gates (+45 LOC)

  • GS-003: ban_handler IPC-only enforcement
  • GS-004: scope creep reintroduction guard
  • GS-008: inline exception disabled by default
  • GS-014: rule engine cannot trigger inline

Lab verification

  • lab4: go build (nftband + nftban-core + nftban-validate) + go vet — ALL PASS

Build & Integrity Status: STATUS.md

🤖 Generated with Claude Code

…ion structure

v1.92 Wave 1: Safety foundation before any code removal.

New files:
- invariants.go: INV-S-001..013 constants + authority labels
- verify.go: `nftban suricata verify` — IDS deployment checks
  (suricata installed, active, EVE valid, IDS-only mode)
- inline.go: Inline Exception Mode config structure + validation
  (allowlist, double-gate, SID cap, kill switch, dry-run)
- inline_exceptions.conf: Default config (disabled, empty allowlist)

Architecture: V192_FINAL_ARCHITECTURE_DECISION.md
- Default: Suricata IDS → NFTBan decides → kernel enforces
- Exception: approved SIDs may inline-drop → NFTBan audits → kernel bans

All invariants machine-verifiable via CI gates GS-001..GS-014.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 16, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Comment thread internal/suricata/verify.go Fixed
itcmsgr and others added 4 commits April 16, 2026 22:08
Delete Suricata ecosystem tooling that is not needed for NFTBan to
produce a correct ban. NFTBan manages deployment correctness; it does
not become a Suricata rule management platform.

Deleted Go packages (4 directories):
- customrules/ (manager + validator, 1,160 LOC) — rule authoring
- recommendations/ (analyzer, 481 LOC) — "which rules to enable"
- scanner/ (detector + probes, 967 LOC) — overlaps native portscan
- rules/ (generator, 279 LOC) — SID management

Deleted CLI commands (6 files):
- cmd_suricata_custom.go (353 LOC) — custom rules CLI
- cmd_suricata_sid.go (305 LOC) — SID management CLI
- cmd_suricata_recommend.go (210 LOC) — recommendations CLI
- cmd_suricata_profile.go (190 LOC) — complex profile CLI
- cmd_suricata_rules.go (127 LOC) — rules CLI
- cmd_suricata_scan.go (103 LOC) — scanner CLI

Deleted shell scripts (6 files):
- cmd_suricata_rules.sh (733 LOC) — rules shell CLI
- cmd_suricata_tools.sh (789 LOC) — benchmarking tools
- cmd_suricata_advanced.sh (565 LOC) — advanced config
- cmd_suricata_iface.sh (1,052 LOC) — interface management
- helpers/suricata_rules.sh (962 LOC) — rules helpers
- setup_suricata_rules.sh (165 LOC) — rules setup

Fixed: removed GenerateAutoConf() from config/generator.go (depended
on deleted scanner package) and scanner import.

Rule: "Does NFTBan need this to produce a correct ban?" → NO → deleted.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The dispatcher still referenced functions from deleted CLI files
(profile-*, scan*, rules-*, sid-*, custom-*, recommend*).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
….conf)

User-facing policy controls for Suricata alert processing (INV-S-006).

New files:
- detection.conf: category toggles (which alerts NFTBan processes)
- actions.conf: response mapping per category (observe/ban_short/ban_long/ban_permanent)
- policy.go: Go loader with .local override support + defaults

These control NFTBan's response, NOT Suricata's detection behavior.
Suricata always runs its full ruleset. NFTBan filters based on policy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@itcmsgr itcmsgr changed the title feat(suricata): v1.92 Phase 1 — enforcement model hardening + inline exception structure feat(suricata): v1.92 Waves 1+2+4 — enforcement hardening + scope removal + policy layer Apr 16, 2026
itcmsgr and others added 2 commits April 16, 2026 22:16
Replace source-build installer with package-manager-only deployment.
NFTBan manages Suricata via apt/dnf — no more ./configure && make.

Changes:
- install_suricata.sh: 636 LOC → 190 LOC (package install + IDS config + service)
- suricata_managed_install(): single entry point for `nftban suricata enable`
- suricata_managed_disable(): stop service, keep package
- suricata_managed_status(): deployment status report
- SURICATA_UNMANAGED=true: skip managed install, read EVE only

Removed: source download, build deps, compile, custom prefix, Rust/cargo deps

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CI enforcement for v1.92 Suricata architecture invariants:
- GS-003: ban_handler.go uses IPC only (no direct nft calls)
- GS-004: deleted scope-creep packages don't reappear
- GS-008: inline exception disabled in default config
- GS-014: rule engine/policy cannot trigger inline enforcement

Source: V192_FINAL_ARCHITECTURE_DECISION.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@itcmsgr itcmsgr changed the title feat(suricata): v1.92 Waves 1+2+4 — enforcement hardening + scope removal + policy layer feat(suricata): v1.92 — enforcement hardening + scope removal + policy layer + CI gates Apr 16, 2026
Comment thread internal/suricata/policy.go Dismissed
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@itcmsgr
Copy link
Copy Markdown
Owner Author

itcmsgr commented Apr 16, 2026

Recreating to clear stale gosec code scanning comments

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