Skip to main content

Overview

The Firewall ACL Agent is the enforcement endpoint of ML Defender’s pipeline, translating ML detections into kernel-level blocking rules using IPSet and IPTables. Validated with 36,000 events across 4 stress tests, it achieves 364 events/sec throughput with 0 crypto errors.

Stress Test Results

  • 36K events processed (Day 52)
  • 364 events/sec peak rate
  • 0 crypto errors (ChaCha20-Poly1305)
  • 0 decompression errors (LZ4)

Performance

  • <10ms blocking latency (detection → block)
  • 54% CPU max under extreme load
  • 127MB RAM at peak
  • Graceful degradation at capacity

Architecture

The Firewall Agent implements a config-driven architecture with no hardcoded values, ensuring production reliability:

IPSet vs IPTables

Role: Hash table data structure for storing IP lists
  • O(1) lookup complexity
  • Kernel-space storage
  • Automatic expiration (configurable TTL)
  • Atomic updates (thread-safe)

ChaCha20-Poly1305 Decryption Pipeline

The Firewall Agent is the pipeline endpoint and only decrypts + decompresses incoming data (no downstream encryption).

Configuration

Single Source of Truth (Day 52 Cleanup)

All configuration is loaded from config/firewall.json with no hardcoded values:

Validation Rules


Stress Test Results (Day 52)

Test Progression

Configuration:
Results:
  • Events: 1,000
  • Rate: 42.6 events/sec
  • CPU: N/A (too fast to measure)
  • Status: ✅ PASS
  • IPSet Successes: 118
  • IPSet Failures: 882 (capacity limit)

Cumulative Metrics (36K Events Total)


Capacity Planning

IPSet Capacity Limits

Discovery: IPSet max_elements=1000 was exceeded during stress tests, causing graceful failures (not crashes).
Realistic Capacity Planning: Hash Size Calculation:

Multi-Tier Storage (Roadmap)

Priority 1.1 (planned):

Deployment

Prerequisites

Build

1

Navigate

2

Configure

3

Compile

Run

Real-time Output:

Verify Blocking


Testing

Synthetic Data Injection

Monitor Blocking


Troubleshooting

Symptom: ipset_failures increasing in metricsSolution: Increase max_elements in config:
Recreate IPSet:

Roadmap

Priority 1: Production Scale (2 weeks)

1

P1.1: Multi-tier Storage

Goal: Handle 500K+ IPs without performance degradation
  • IPSet (hot: 1K IPs, <1Ξs lookup)
  • SQLite (warm: 100K IPs, ~1ms query)
  • Parquet (cold: unlimited, forensics)
2

P1.2: Async Queue + Worker Pool

Goal: 1K+ events/sec sustained throughput
  • Lock-free ring buffer
  • 4-8 worker threads
  • Batch IPSet updates (100 IPs/operation)
3

P1.3: Capacity Monitoring + Auto-eviction

Goal: Zero operator intervention for capacity management
  • LRU eviction policy
  • Automatic tier migration
  • Prometheus metrics export

Priority 2: Observability (1 week)

  • Prometheus metrics exporter
  • Grafana dashboards
  • Health check endpoints (Kubernetes readiness/liveness)
  • Runtime config updates via etcd

Next Steps

RAG System

Query blocked IPs using natural language

etcd Server

Manage distributed configuration and crypto keys

Monitoring

Set up Prometheus + Grafana dashboards

Performance Tuning

Optimize for 10Gbps+ environments