Hello Suricata community,
I am working on NFTBan ( GitHub - itcmsgr/nftban: NFTBan is an enterprise-grade firewall management system built on Linux nftables — combining atomic rule updates, privilege separation through Polkit, and AI-assisted threat intelligence for a resilient, self-healing network defense layer. ), an open-source project that integrates Suricata as a detection engine for server hardening on individual VPS/cloud servers.
This is not a typical NIDS deployment. We are optimizing for:
- Single-server protection (not network monitoring)
- Fast automated response (temporary IP bans via nftables)
- Low resource footprint (VPS constraints: 2–4 cores, 2–8 GB RAM)
- Focused threat detection: SSH brute-force, web attacks, port scanning, botnet activity
Suricata is used strictly for detection; enforcement is handled externally by our daemon.
Current Setup
Suricata version: 7.0.x
Ruleset: Emerging Threats Open
Capture: AF_PACKET (mmap, tpacket_v3, cluster_flow)
Output: eve.json (file-based)
Processing: External daemon (Go) consuming events and applying nftables rules
Observed performance (production testing on 4-core VPS):
- CPU usage: ~15% average
- Memory: ~800 MB resident
- Alert → block latency: ~300–500 ms (from Suricata alert timestamp to nftables rule applied)
- Packet drops: <0.1%
Performance Tuning Applied
To reduce CPU and memory usage while maintaining detection for our target threats, we applied aggressive tuning:
- Reduced TCP flow timeouts
- Established: ~60s (down from default 600s)
- Emergency-closed: ~10s
- Disabled HTTP body inspection
- Headers and URI only
- Disabled unused protocol parsers
- SMB, DCERPC, SMTP
- DNS limited to basic query/response analysis
- AF_PACKET ring tuning
- ~16k frames, ~2k frame size (effective packet size)
- Disabled NIC offloads
- GRO, LRO, TSO, GSO
Results: ~40% CPU reduction, ~30% memory reduction, while still detecting our target threats in testing.
Questions for Guidance
- Flow Timeouts
Are ~60s established TCP timeouts generally safe for SSH and HTTP analysis in our use case?
Do common ET rules for SSH brute-force or web attacks rely on longer flow tracking?
- HTTP Body Inspection
With body inspection disabled (URI/headers only):
- Are there critical ET rules for web scanners (SQLi/XSS) or botnet detection that fundamentally require body inspection?
- What important blind spots should we expect?
We accept reduced coverage for file-based web attacks, but want to understand what we’re missing.
- AF_PACKET: cluster_flow Choice
We chose cluster_flow (instead of cluster_cpu or autofp) for the following reasons:
- Flow integrity: Both directions of a connection processed by the same worker thread
- State coherence: Critical for stateful attack detection (SSH brute-force, multi-stage web attacks)
- Reduced atomic overhead: Minimizes internal locking on low-core systems
- Predictable latency: Flow pinning ensures linear, predictable alert generation
Question: Is cluster_flow still the right choice for 2–4 core systems in this scenario, or is there a better option for low-latency response?
- Output Method
For sub-second response times, is file-based eve.json consumption reasonable, or does Unix socket output provide significant performance gains at this scale?
Our external daemon currently tails eve.json with inotify. If socket-based output would meaningfully reduce the 300–500ms latency, we’ll switch.
What I’m NOT Asking For
- Full configuration review (we have a working setup)
- General NIDS best practices (different use case)
- Broad tuning advice beyond the specific questions above
What I AM Asking For
- Validation that these tuning choices don’t introduce critical blind spots for SSH/web attack detection
- Best-practice guidance on the specific points above
- “You’re missing X” feedback if there’s an obvious gap
Note:
We understand this tuning is aggressive compared to typical NIDS deployments.
Our goal is server hardening with automated response, not comprehensive network analysis.
We’re seeking guidance on whether these choices are appropriate for this focused use case.
Thank you for any insights!
Antonios Voulvoulis