High-Performance Standalone Deep Learning Network Intrusion Detection System (DL-NIDS)
Real-Time Zero-Copy Network Tap/Mirror Inspector with Embedded ONNX Runtime & Continuous Self-Learning
redborder-ai-dpi (redborder-ai-dpi) is a high-performance network inspection and prevention daemon written in pure Go. It operates in two distinct modes:
- Passive IDS Mode (Tap/Mirror): Taps network interfaces in promiscuous mode (TAP, SPAN, Mirror port) or replays offline PCAPs with zero interference on traffic.
- Active Inline IPS Mode (Bridge/Forwarding): Sits inline between two network segments (e.g. WAN
eth0and LANeth1), inspecting packets in real time and actively dropping attacks before they reach destination hosts.
┌────────────────────────────────────────┐
│ Network TAP / Mirror Port │
│ (eth0 / any / lo / pcap) │
└───────────────────┬────────────────────┘
│
┌──────────▼──────────┐
│ Zero-Copy Dissector │
│ (internal/capture) │
└──────────┬──────────┘
│
┌──────────────────────────────┼──────────────────────────────┐
│ │ │
┌──────────▼──────────┐ ┌──────────▼──────────┐ ┌──────────▼──────────┐
│ TCP Stream Assembler│ │ Flow State Tracker │ │ DNS & Handshake TAP │
│(internal/reassembly)│ │ (internal/flow) │ │ (Port 53 / 443 SNI) │
└──────────┬──────────┘ └──────────┬──────────┘ └──────────┬──────────┘
│ │ │
Reassembled L7 Payloads 10x6 Feature Windows DNS Queries & TLS Hello
┌────────▼──────────┐ ┌────────▼──────────┐┌────▼─────────────┐┌────────▼──────────┐┌────────▼──────────┐
│Pipeline A: Conv1D │ │Pipeline C: TLS ETA││Pipeline B: Flow ││Pipeline D: Domain ││Pipeline D: Threat │
│ L7 Character Model│ │JA3 / ClientHello ││Temporal Autoenc ││DGA / Entropy / Typo││Feed Bloom Filter │
│ (SQLi / XSS / RCE)│ │ (C2 Tools / Cert) ││(DDoS / Scans/SYN)││(Zero-Day Malware) ││(Abuse.ch Blocklist)│
└────────┬──────────┘ └────────┬──────────┘└────┬─────────────┘└────────┬──────────┘└────────┬──────────┘
│ │ │ │ │
└───────────────────────────┴────────────────┼───────────────────────┴────────────────────┘
│
┌──────────▼──────────┐
│ IP / CIDR Whitelist │
│ (Alert Suppression) │
└──────────┬──────────┘
│
┌──────────▼──────────┐
│ Security Alerts │
│ & Forensics │
└──────────┬──────────┘
│
┌────────────────────┴────────────────────┐
│ │
┌──────────▼──────────┐ ┌──────────▼──────────┐
│ Kafka / HTTP │ │ Unix Socket IPC │
│ (`rb_vault`/`events`)│ │ (`redborder-ai-dpi -t`) │
└──────────┬──────────┘ └─────────────────────┘
│
┌──────────▼──────────┐
│ Forensics Engine │
│ (`alert_<id>.pcap`) │
└─────────────────────┘
┌───────────────────────────────┐
│ redborder-ai-dpi Inline Engine │
│ (IPS Mode) │
└───────────────┬───────────────┘
│
┌─────────────────────────────────┴─────────────────────────────────┐
│ │
[ Segment A: WAN ] ──► [ eth0 Ingress ] [ eth1 Egress ] ──► [ Segment B: Protected LAN ]
│ ▲
▼ │
┌───────────────┐ │
│ ML Pipelines │───[ Clean Packet Passed ]─────┘
│ (A, B, C, D) │
└───────┬───────┘
│
[ Threat Detected ]
│
┌──────▼──────┐
│ DROP! │ (Attack payload never reaches destination)
└─────────────┘
- Target Threats:
- SQL Injection (SQLi): Union-based, boolean-blind, error-based, time-based, stacked queries.
- Cross-Site Scripting (XSS): Reflected, stored, DOM-based, JS polyglots, SVG/image event handlers.
- Command Injection (RCE): Shell metacharacters (
;,|,`,$()), reverse shells, pipe-to-bash payloads. - Path Traversal & LFI: Directory escape sequences (
../..,..//,%2e%2e%2f), sensitive system file access (/etc/passwd,/etc/shadow,boot.ini). - Server-Side Template Injection (SSTI): Jinja2, Twig, Mako, Freemarker, Spring EL expressions (
{{7*7}},${7*7},__globals__). - XML External Entity (XXE): Inline DTD entity declarations, external DTD retrieval, parameter entities (
<!ENTITY xxe SYSTEM "file:///etc/passwd">). - Server-Side Request Forgery (SSRF): Cloud metadata exfiltration (
169.254.169.254,metadata.google.internal), loopback intranet probing (gopher://,dict://). - NoSQL Injection: MongoDB JSON operator injection (
$gt,$ne,$regex,$where,$exists). - LDAP Injection: Active Directory & OpenLDAP filter bypasses (
*)(&,admin*)(password=*)). - JNDI / Log4Shell: Remote code execution lookups (
${jndi:ldap://...},${jndi:rmi://...}). - Server-Side Includes (SSI): Command execution and virtual file includes (
<!--#exec cmd="id"-->,<!--#include virtual="/etc/shadow"-->). - HTTP Request Smuggling: Dual header and chunked desync attacks (
CL.TE,TE.CL,\x0bchunked). - Insecure Deserialization: Java serialization magic (
rO0AB), Python pickle, PHPunserialize(), YAML object execution. - WebShell Execution: Backdoor shells (
eval(base64_decode),assert($_POST),Runtime.getRuntime().exec, China Chopper, Godzilla). - Open Redirect & OAuth Abuse: Redirection abuse (
redirect_uri=https://evil.com,url=//evil.com). - JWT Token Abuse: Unsigned JWT authentication bypass (
{"alg": "none"}).
- Model Architecture: Character-level 1D CNN with embedding layer, adaptive max-pooling, and softmax logits over 512-byte sequences.
- Protocol Filtering: Automatically bypasses encrypted binary sessions (SSH port 22, TLS 443, WireGuard 51820, OpenVPN 1194) and non-printable streams to eliminate false alarms.
- Target Threats: Volumetric DDoS bursts, SYN floods, port scans, stealth scans (NULL, Xmas, FIN), Slowloris / Slow HTTP DoS, periodic C2 beaconing heartbeats.
-
Input Matrix: 10-packet rolling window
$\times$ 6 normalized temporal features:-
delta_t: Inter-packet arrival delta ($0.0 - 1.0$ ) -
packet_size: Packet byte length normalized against MTU ($0.0 - 1.0$ ) -
tcp_flags: Normalized TCP flags bitmask (SYN, ACK, PSH, RST, FIN, URG) -
src_port: Normalized source port -
dst_port: Normalized destination port -
flow_direction: Forward client ($0.0$ ) vs Reverse server ($1.0$ )
-
-
Model Architecture: 1D Temporal Convolutional Autoencoder. Normal flows produce reconstruction MSE
$< 0.001$ , while volumetric attacks produce reconstruction MSE$> 0.15$ .
- Target Threats: Command & Control (C2) beacons (Cobalt Strike, Metasploit, Sliver, Mythic), malware botnets, suspicious DGA domains, direct IP SNIs, default C2 self-signed certificates.
- How It Works: Inspects the unencrypted TLS
ClientHelloduring the initial handshake without requiring private keys or TLS termination:- SNI (Server Name Indication): Extracts target domain names and detects suspicious TLDs (
.top,.xyz,.biz,.cc,.ru), direct IP connections, and C2 certificate patterns. - JA3 Fingerprinting: Computes MD5 hash of TLS version, cipher suites, extensions, elliptic curves, and point formats to identify unauthorized exploit tools.
- JA4+ Fingerprinting: Modern deterministic standard for TLS client fingerprinting (
t13d1516h2_...). - ALPN Protocols: Evaluates protocol negotiation (
h2,http/1.1,h3).
- SNI (Server Name Indication): Extracts target domain names and detects suspicious TLDs (
-
Target Threats: Algorithmically Generated Domains (DGA) used by ransomware/botnets, Brand Typo-squatting / Phishing domains, DNS Data Exfiltration / Tunneling (
iodine,dnscat2), ICMP Covert Command Shells & Exfiltration (icmpsh,ptunnel), and known C2 threat intelligence blocklists. -
Multi-Tier Execution Architecture:
-
Direct Threat Feed Matching (O(1) Hash Map): Instant lookup against
/etc/redborder-ai-dpi/blocklist.txt(Abuse.ch URLhaus, ThreatFox). Exact matches trigger immediate alerts and short-circuit computation without wasting CPU cycles. -
DNS Tunneling & Exfiltration Engine: Detects
dnscat,iodine, and deep base64/hex-encoded subdomains with high entropy ($H \ge 3.65$ ). -
Statistical DGA Shannon Entropy Model: Computes Shannon entropy
$H = -\sum p(x)\log_2 p(x)$ , consonant clustering ($\ge 5$ consecutive consonants), and vowel distribution to catch zero-day botnets (e.g.x89zklm0qva91z.biz). -
Homoglyph & Phishing Typosquatting Engine: Translates character confusions (
$0 \to o, 1 \to l, 3 \to e$ ) and detects brand spoofing (e.g.paypa1-security-update-login.com,micros0ft-verify.top). -
Smart ICMP Covert Channel & Tunneling Engine:
-
OS Ping Pattern Matching: Distinguishes benign OS pings (Windows 32-byte alphabet, Linux timestamp + incremental counter, diagnostic test sequences) and Path MTU sweep packets (
ping -s 1472) to eliminate false alarms. -
Entropy & Covert Token Analysis: Detects high-entropy encrypted data exfiltration (
$H \ge 4.50$ ,$\ge 96$ bytes),ptunnelmagic headers (0xD5200800),icmpshhandshakes, and interactive reverse shells.
-
OS Ping Pattern Matching: Distinguishes benign OS pings (Windows 32-byte alphabet, Linux timestamp + incremental counter, diagnostic test sequences) and Path MTU sweep packets (
-
Threat Feed Downloader: Run
python3 scripts/download_threat_feeds.pyto refresh active C2 domain lists.
-
Direct Threat Feed Matching (O(1) Hash Map): Instant lookup against
- OS: Linux (Rocky Linux 9 / RHEL 9 / Ubuntu 22.04+)
- Go: 1.22+
- Python: 3.9+ (for ML retraining)
make build
# Output binary: bin/redborder-ai-dpi# Tap interface eth0 (auto-scales across all CPU cores)
sudo ./bin/redborder-ai-dpi --interface eth0 --config configs/config.example.yaml
# Explicitly specify worker threads (e.g. 16 worker cores)
sudo ./bin/redborder-ai-dpi --interface eth0 --workers 16 --config configs/config.example.yaml
# Tap loopback or any interface (for local testing)
sudo ./bin/redborder-ai-dpi --interface any --config configs/config.example.yamlTo sit inline between two network segments (e.g. WAN eth0 and LAN eth1) and actively drop malicious attacks:
# Bridge eth0 (WAN) <-> eth1 (LAN) with active packet dropping
sudo ./bin/redborder-ai-dpi --mode ips --iface-a eth0 --iface-b eth1 --ips-action drop --config configs/config.example.yaml
# Or configure via configs/config.example.yaml:
# ips:
# enabled: true
# interface_a: "eth0"
# interface_b: "eth1"
# action: "drop" # "drop", "reset", or "alert_only"./bin/redborder-ai-dpi --pcap /path/to/capture.pcap --config configs/config.example.yamlmake docker
# or: docker build -t redborder-ai-dpi:latest .To inspect host network interfaces (e.g. eth0 or any), mount your configuration file and grant network capture capabilities:
docker run -d \
--name redborder-ai-dpi \
--restart unless-stopped \
--net=host \
--cap-add=NET_ADMIN \
--cap-add=NET_RAW \
-v /path/to/your/config.yaml:/etc/redborder-ai-dpi/config.yaml:ro \
-v /var/log/redborder-ai-dpi:/var/log/redborder-ai-dpi \
redborder-ai-dpi:latest \
--config /etc/redborder-ai-dpi/config.yamldocker run --rm -it \
--net=host \
--cap-add=NET_ADMIN \
--cap-add=NET_RAW \
-v $(pwd)/configs/config.example.yaml:/etc/redborder-ai-dpi/config.yaml:ro \
redborder-ai-dpi:latest \
--config /etc/redborder-ai-dpi/config.yamldocker run --rm -it \
-v $(pwd)/traffic.pcap:/data/traffic.pcap:ro \
-v $(pwd)/configs/config.example.yaml:/etc/redborder-ai-dpi/config.yaml:ro \
redborder-ai-dpi:latest \
--config /etc/redborder-ai-dpi/config.yaml \
--pcap /data/traffic.pcapFor security-hardened, ultra-minimal production deployments with zero CVE attack surface, redborder-ai-dpi supports building as a Canonical ROCK (OCI-compliant distroless container).
- Zero Package Manager & Shell Overhead: Built on
base: barewithbuild-base: ubuntu@24.04, containing strictly the compiled Go daemon, model weights, necessary dynamic C runtime libraries (libpcap,libc), and Pebble service manager. - Ultra-Small Attack Surface: No package managers (apt/dpkg), curl, or extraneous shell utilities that could be leveraged by attackers.
- Pebble Service Management: Managed by Canonical's lightweight Pebble init process for robust process lifecycle and health supervision.
Install Rockcraft and LXD on Ubuntu:
sudo snap install rockcraft --classic
sudo snap install lxd
sudo lxd init --auto# Build the .rock artifact in an isolated LXD container
make rock
# or: rockcraft packThis produces the OCI image archive: redborder-ai-dpi_1.0.0_amd64.rock.
Import the .rock file directly into your local Docker daemon:
# Using skopeo (available via rockcraft snap or host)
rockcraft.skopeo --insecure-policy copy \
oci-archive:redborder-ai-dpi_1.0.0_amd64.rock \
docker-daemon:redborder-ai-dpi:1.0.0
# Run in Live Network TAP mode (IDS)
docker run -d \
--name redborder-ai-dpi-rock \
--restart unless-stopped \
--net=host \
--cap-add=NET_ADMIN \
--cap-add=NET_RAW \
-v /path/to/config.yaml:/etc/redborder-ai-dpi/config.yaml:ro \
-v /var/log/redborder-ai-dpi:/var/log/redborder-ai-dpi \
redborder-ai-dpi:1.0.0
# Run in Foreground for live alert monitoring
docker run --rm -it \
--net=host \
--cap-add=NET_ADMIN \
--cap-add=NET_RAW \
-v $(pwd)/configs/config.example.yaml:/etc/redborder-ai-dpi/config.yaml:ro \
redborder-ai-dpi:1.0.0make rock-clean
# or: rockcraft cleanredborder-ai-dpi comes with pre-trained ONNX models ready out of the box, but also allows full retraining and fine-tuning to adapt to your network baseline.
All attack datasets (SQLi, XSS, Command Injections, Reverse Shells, JNDI, Path Traversal) and benign traffic patterns are pre-packaged in data/payloads/.
make train
# Automatically trains both the L7 Payload model and L3/L4 Flow Autoencoderpython3 scripts/train_payload_sqli.py \
--epochs 5 \
--output models/payload_sqli_cnn.onnxSniffs live traffic from your network for
sudo python3 scripts/train_payload_sqli.py \
--interface eth0 \
--duration 300 \
--epochs 5python3 scripts/train_payload_sqli.py \
--pcap /path/to/web_traffic.pcap \
--epochs 5The Flow Autoencoder learns what normal traffic looks like for your specific network without requiring labeled attack samples.
# Listen live on eth0 for 5 minutes and fit the Autoencoder
sudo .venv/bin/python3 scripts/train_flow_anomaly.py \
--interface eth0 \
--duration 300 \
--epochs 20python3 scripts/train_flow_anomaly.py \
--pcap /path/to/normal_traffic.pcap \
--epochs 20python3 scripts/train_flow_anomaly.py \
--pcap "/var/log/captures/*.pcap" \
--epochs 20On high-throughput 10G/40G mirror interfaces, use packet sampling and memory bounding to capture a clean statistical baseline without pegging CPU:
# Option 1: Live interface capture with 1:10 sampling and 50k window cap
sudo .venv/bin/python3 scripts/train_flow_anomaly.py \
--interface eth0 \
--duration 1800 \
--sample-rate 10 \
--max-windows 50000 \
--epochs 25
# Option 2: Snapshot PCAP via tcpdump ring buffer (Zero CPU Drop)
sudo tcpdump -i eth0 -s 96 -c 500000 -w /tmp/traffic_sample.pcap
python3 scripts/train_flow_anomaly.py --pcap /tmp/traffic_sample.pcap --epochs 25Both training scripts support continuous checkpointing:
- Warm-Start / Fine-Tuning (Default): Automatically loads existing weights from
models/*.pthand updates them with new data without forgetting previously learned patterns. - Train Fresh from Zero: Add
--from-scratchto wipe previous weights and train purely on new inputs:python3 scripts/train_payload_sqli.py --from-scratch --benign-file data/payloads/benign.txt --malicious-file data/payloads/malicious.txt sudo .venv/bin/python3 scripts/train_flow_anomaly.py --from-scratch --interface eth0 --duration 300
redborder-ai-dpi runs a background ModelWatcher:
- Whenever a Python training script exports an updated
.onnxfile to disk, the running Go daemon instantly hot-swaps the model in memory without restarting or dropping a single packet.
redborder-ai-dpi implements a Continuous Network Baseline Harvester to automatically adapt its detection engines to your environment without manual rule writing.
| Pipeline | Model / Detection Engine | Baseline Dataset | How It Learns & Calibrates |
|---|---|---|---|
L7_PAYLOAD |
1D Character Conv1D Neural Network (payload_sqli_cnn.onnx) |
Fixed High-Precision Model | False positives suppressed automatically via trusted baseline domains |
DOMAIN_INTEL |
Statistical Entropy & Brand Reputation | /var/log/redborder-ai-dpi/baseline_domains.txt |
Auto-loaded into trusted whitelist on service start |
L3_L4_FLOW |
1D Temporal Convolutional Autoencoder (flow_anomaly_cnn.onnx) |
Live traffic windows / rolling PCAPs | Trained via /opt/redborder-ai-dpi/bin/run-train-flow.sh |
TLS_ETA |
JA3 Fingerprint & Cipher Matcher | Client Hello Handshakes | Matched against malware C2 threat signatures |
When baseline.enabled: true is set in /etc/redborder-ai-dpi/config.yaml, the daemon harvests:
/var/log/redborder-ai-dpi/baseline_domains.txt:- Unique domain names observed across DNS queries (port 53), TLS SNIs (port 443), and HTTP Host headers.
- Auto-Loaded by Domain Classifier & Whitelist Filter: The Go daemon automatically loads this file at startup, marking every observed enterprise domain (and its parent apex domain) as trusted to eliminate DNS Tunneling, DGA, and payload false alarms.
- Manual Whitelisting: You can append custom corporate domains or CDN suffixes directly to this file (one domain per line).
Inspect, scan, audit, score, and sanitize your baseline domains before allowing them into the whitelist.
The scanner combines:
- URLhaus (Abuse.ch): Free live open-source malware, C2, and phishing threat feed.
- Quad9 (
9.9.9.9) & Cloudflare Security (1.1.1.2): Real-time live threat reputation lookups. - Shannon Entropy & Lexical DGA Model: Offline mathematical analysis for high-entropy subdomains and DNS tunneling patterns.
# 1. Update Free Threat Intelligence Feed from URLhaus (Abuse.ch)
# Automatically downloads latest malicious domains and SAFELY MERGES them with
# /etc/redborder-ai-dpi/blocklist.txt without overwriting your custom entries (saves .bak backup):
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh scan --update-feed
# 2. View baseline statistics, entry counts, and duplicate ratio
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh stats
# 3. List all observed domains recorded in the baseline
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh domains
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh domains --apex
# 4. Security Audit (Offline): Scan domains for DGA, DNS Tunneling, and Blocklist matches
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh scan
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh scan --threshold 0.70
# 5. Live Online Audit: Check real-time reputation against Quad9 / Cloudflare Security DNS
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh scan --online
# 6. Auto-Purge: Scan and remove all risky domains (score >= 0.75) with automatic backup
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh scan --purge --threshold 0.75
# 7. Check risk score of a single domain:
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh scan --domain somedomain.com
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh scan --domain somedomain.com --online
# 8. Clean and deduplicate the baseline dataset:
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh clean
# Exclude specific unwanted domains (Blacklist):
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh clean --exclude-domains unwanted-domain.com ads.corp
# Whitelist ONLY corporate domains (removes everything else):
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh clean --include-domains mycompany.com google.com
# 9. Clear / reset baseline file for a fresh capture run (saves automatic .bak backup)
/opt/redborder-ai-dpi/bin/run-manage-baseline.sh clearTip
Automating Threat Feed Updates via Cron: To ensure your sensor always maintains fresh threat intelligence without manual intervention, schedule a daily update:
0 3 * * * /opt/redborder-ai-dpi/bin/run-manage-baseline.sh scan --update-feed > /dev/null 2>&1You can test all three detection pipelines locally on your machine:
python3 -m http.server 8080cd /home/david/projects/redborder-ai-dpi
sudo ./bin/redborder-ai-dpi --interface any --config configs/config.example.yaml# 1. SQL Injection Attack
curl -s "http://127.0.0.1:8080/search?id=1%27%20UNION%20SELECT%20username,password%20FROM%20users--" > /dev/null
# 2. Cross-Site Scripting (XSS)
curl -s "http://127.0.0.1:8080/comment?user=%3Cscript%3Ealert(document.cookie)%3C/script%3E" > /dev/null
# 3. Command Injection (RCE)
curl -s "http://127.0.0.1:8080/status?exec=;cat%20/etc/passwd" > /dev/null
# 4. Path Traversal
curl -s "http://127.0.0.1:8080/download?file=../../../../../../etc/shadow" > /dev/null# 1. SYN Flood Anomaly
sudo nping --tcp -p 8080 --flags syn --rate 100 -c 30 127.0.0.1
# 2. Port Scan Probe (Probes 50 ports)
sudo nmap -sS -p 8000-8050 --min-rate 100 127.0.0.1
# 3. Or use the built-in simulator
sudo .venv/bin/python3 scripts/simulate_attacks.py --type all --target 127.0.0.1 --port 8080# Test TLS SNI extraction targeting a suspicious .xyz domain
curl -k -s "https://malicious-c2.xyz:8080" --resolve malicious-c2.xyz:8080:127.0.0.1 > /dev/null# 1. Trigger DGA domain detection via DNS
sudo .venv/bin/python3 scripts/simulate_attacks.py --type dga --target 127.0.0.1
# 2. Trigger Phishing typosquatting domain detection
sudo .venv/bin/python3 scripts/simulate_attacks.py --type phishing-dns --target 127.0.0.1# Query daemon stats via Unix domain socket (identical to redborder-monitor -t)
sudo ./bin/redborder-ai-dpi -t
# Or query with long flag:
sudo ./bin/redborder-ai-dpi --status
# Or reset statistics counters:
sudo ./bin/redborder-ai-dpi -r{
"event_id": "alert-l7-1723652500000000000-4821",
"timestamp": "2026-08-14T15:22:45Z",
"pipeline": "L7_PAYLOAD",
"severity": "CRITICAL",
"threat_category": "SQL_INJECTION",
"confidence": 0.992,
"action": "DROPPED",
"flow_key": "192.168.1.100:54321-10.0.0.1:80-6",
"src_ip": "192.168.1.100",
"dst_ip": "10.0.0.1",
"src_port": 54321,
"dst_port": 80,
"protocol": "HTTP",
"http_method": "GET",
"http_uri": "/search?id=1%20UNION%20SELECT%20username,password%20FROM%20users--",
"sample_data": "GET /search?id=1%20UNION%20SELECT%20username,password%20FROM%20users-- HTTP/1.1",
"sensor_name": "redborder-ai-dpi-ips",
"tags": {
"engine": "conv1d_character_onnx"
}
}{
"event_id": "alert-tls-1723652600000000000-1192",
"timestamp": "2026-08-14T15:23:20Z",
"pipeline": "TLS_ETA",
"severity": "CRITICAL",
"threat_category": "MALICIOUS_TLS_CLIENT",
"confidence": 0.95,
"flow_key": "192.168.1.100:54322-198.51.100.1:443-6",
"src_ip": "192.168.1.100",
"dst_ip": "198.51.100.1",
"src_port": 54322,
"dst_port": 443,
"protocol": "HTTPS/TLS",
"http_method": "TLS_CLIENT_HELLO",
"http_uri": "malicious-c2.xyz",
"sample_data": "SNI: malicious-c2.xyz | JA3: e7d705a3286e19ea42f587b344ee6865 | Detail: Cobalt Strike C2",
"sensor_name": "redborder-ai-dpi-eta",
"tags": {
"engine": "encrypted_traffic_analytics",
"ja3_hash": "e7d705a3286e19ea42f587b344ee6865",
"sni": "malicious-c2.xyz"
}
}{
"event_id": "alert-dom-1723652700000000000-8431",
"timestamp": "2026-08-14T15:24:10Z",
"pipeline": "DOMAIN_INTEL",
"severity": "HIGH",
"threat_category": "DGA_DOMAIN",
"confidence": 0.92,
"flow_key": "192.168.1.100:54323-8.8.8.8:53-17",
"src_ip": "192.168.1.100",
"dst_ip": "8.8.8.8",
"src_port": 54323,
"dst_port": 53,
"protocol": "DNS",
"http_method": "DNS_QUERY",
"http_uri": "x89zklm0qva91z.biz",
"sample_data": "Domain: x89zklm0qva91z.biz | Detail: High Entropy DGA Algorithm (Entropy: 3.65)",
"sensor_name": "redborder-ai-dpi-dns",
"tags": {
"engine": "domain_intelligence_dga",
"domain": "x89zklm0qva91z.biz"
}
}redborder-ai-dpi can forward all alerts and flow telemetry via HTTP POST directly to central collectors, SIEMs, or the redBorder platform:
output:
http:
enabled: true
endpoint: "https://vault.redborder.com/api/v1/events"
mode: "deflated" # normal, deflated (flate compression), gzip
insecure: false # Set true (or http_insecure: 1) to skip TLS verify
max_total_connections: 100
timeout_sec: 5
conn_timeout_sec: 2# Stream alerts directly via HTTP POST with deflated compression
sudo ./bin/redborder-ai-dpi \
--interface any \
--http-endpoint "http://127.0.0.1:8080/events" \
--http-mode "deflated" \
--config configs/config.example.yamlredborder-ai-dpi natively parses standard redBorder flat configuration files (identical to redborder-monitor):
{
"kafka_broker": "kafka.service",
"kafka_topic": "rb_vault",
"kafka_timeout": 5,
"max_kafka_fails": 2,
"http_endpoint": "https://vault.redborder.com/api/v1/events",
"rb_http_mode": "deflated",
"http_insecure": 0,
"http_max_total_connections": 100,
"http_timeout": 5,
"http_connttimeout": 2
}redborder-ai-dpi uses standard Linux raw AF_PACKET sockets in read-only tap mode.
- Packet Duplication: The Linux kernel delivers an independent copy of every arriving wire packet to all active
AF_PACKETlisteners on that interface. - No Interference:
redborder-ai-dpiruns seamlessly alongside Suricata, Snort, Zeek/Bro, Wireshark, ortcpdumpwithout locking, consuming, or dropping packets for other services. - Promiscuous Reference Counting: If either service enables promiscuous mode, the NIC remains in promiscuous mode until the last capture daemon terminates.
- Standard PF_RING Mode (
pf_ring.ko): 100% compatible. The kernel module duplicates packets to its own ring buffer while maintaining standardAF_PACKETkernel delivery. Bothredborder-ai-dpiand PF_RING services run in parallel. - PF_RING ZC (Zero-Copy Driver Bypass): Because full ZC bypasses the Linux kernel stack entirely, use a PF_RING ZC software distribution queue (
zbalance_ipc) or TAP reflector if sharing with kernelAF_PACKETlisteners.
redborder-ai-dpi scales across all available CPU cores without lock contention:
┌────────────────────────────────────────┐
│ Network TAP / Mirror Interface │
└───────────────────┬────────────────────┘
│
┌──────────▼──────────┐
│ Zero-Copy Dissector │
└──────────┬──────────┘
│
┌─────────────────▼─────────────────┐
│ 5-Tuple Symmetric Flow Hash Router│
│ hash(src, dst, ports) % N │
└─────────────────┬─────────────────┘
│
┌──────────────────────────────────┼──────────────────────────────────┐
│ │ │
┌────────▼─────────┐ ┌────────▼─────────┐ ┌────────▼─────────┐
│ Worker Shard 1 │ │ Worker Shard 2 │ │ Worker Shard N │
│ (Core 1 / Flow A)│ │ (Core 2 / Flow B)│ │ (Core N / Flow Z)│
├──────────────────┤ ├──────────────────┤ ├──────────────────┤
│• Flow State │ │• Flow State │ │• Flow State │
│• TCP Reassembly │ │• TCP Reassembly │ │• TCP Reassembly │
│• ONNX DL Worker │ │• ONNX DL Worker │ │• ONNX DL Worker │
└──────────────────┘ └──────────────────┘ └──────────────────┘
- Lock-Free Sharding: Incoming packets are hashed by 5-tuple (
hash(SrcIP, DstIP, SrcPort, DstPort) % numWorkers) and delivered to dedicated worker queues. - Worker Configuration:
- Auto-detection: Setting
num_workers: 0in config automatically uses all available host CPU cores. - CLI Override: Pass
--workers <N>(e.g.--workers 16).
- Auto-detection: Setting
When tapping high-throughput 10G/40G mirror interfaces, adjust kernel socket memory buffers to prevent packet drop:
# Add to /etc/sysctl.d/99-redborder-ai-dpi.conf and apply with 'sysctl -p /etc/sysctl.d/99-redborder-ai-dpi.conf'
net.core.rmem_max=67108864
net.core.rmem_default=33554432
net.core.netdev_max_backlog=100000You can suppress security alerts for trusted management hosts, internal vulnerability scanners (e.g. Nessus / Qualys), IPv6 link-local devices, internal subnets, ports, endpoints, or payload keywords:
# In configs/config.example.yaml
whitelist:
enabled: true
domains:
- "googleusercontent.com" # Covers *.googleusercontent.com (bypasses DGA/Phishing heuristics)
- "googleapis.com"
- "my-internal-domain.local"
ips:
- "192.168.1.50" # Specific IPv4 scanner/admin IP
- "10.0.0.1" # Gateway / DNS server
- "fe80::dc5a:7b78:461d:bcdb" # Specific IPv6 host (Link-Local or Global)
- "2001:db8::1" # Public IPv6 server
cidrs:
- "10.200.0.0/16" # Entire IPv4 VPN / management subnet
- "192.168.100.0/24" # Trusted staging VLAN
- "fe80::/64" # Link-Local IPv6 subnet
- "2001:db8::/32" # IPv6 enterprise prefix
ports:
- 57621 # Spotify Local Discovery port
- 62976 # D-Link SmartConsole Discovery port
- 5353 # mDNS / Bonjour
endpoints:
- "10.1.33.255:57621" # Specific host/broadcast on port
- "*:57621" # Wildcard any IP on port
- "255.255.255.255:62976"
payload_keywords:
- "SpotUdp" # Substring match on raw/base64 payload
- "DGS-1210"
- "M-SEARCH"
ignore_broadcast: false # Set true to suppress all broadcast traffic (255.255.255.255 / *.255)
ignore_multicast: false # Set true to suppress all multicast traffic (224.0.0.0/4)redborder-ai-dpi automatically loads active malicious C2 and ransomware domain blocklists:
threat_intel:
enabled: true
domain_blocklist: "/etc/redborder-ai-dpi/blocklist.txt" # Default packaged path-
Execution Flow: Every incoming DNS query, TLS SNI, and HTTP Host header is first evaluated against the in-memory blocklist in
$O(1)$ time. If matched, it immediately triggers an alert (MALICIOUS_DOMAIN) and short-circuits. If not matched, it proceeds to the DGA entropy and phishing machine learning models. -
Updating Threat Feeds:
Run the automated updater script to fetch the latest Abuse.ch URLhaus and ThreatFox feeds:
# Update host blocklist sudo python3 /opt/redborder-ai-dpi/scripts/download_threat_feeds.py /etc/redborder-ai-dpi/blocklist.txt
redborder-ai-dpi provides real-time daemon status, pipeline inference statistics, flow table telemetry, and runtime memory diagnostics via Unix Domain Socket IPC (identical to redborder-monitor):
# Query daemon stats via Unix domain socket (default: /run/redborder-ai-dpi/redborder-ai-dpi.sock)
sudo ./bin/redborder-ai-dpi -t
# Or reset statistics counters
sudo ./bin/redborder-ai-dpi -r{
"daemon_version": "1.0.0",
"mode": "ids",
"uptime_seconds": 3600,
"total_workers": 8,
"active_flows": 124,
"packets_processed": 145020,
"flow_anomalies_total": 3,
"ips_packets_forwarded": 0,
"ips_packets_dropped": 0,
"messages_sent_kafka": 42,
"messages_failed_kafka": 0,
"events_sent_http": 42,
"events_failed_http": 0,
"pipelines": {
"domain_intel": {
"inferences_total": 520,
"attacks_detected_total": 2,
"threats_by_category": {
"DGA_DOMAIN": 2
}
},
"l3_l4_flow": {
"inferences_total": 4200,
"attacks_detected_total": 3,
"threats_by_category": {
"SYN_FLOOD": 2,
"PORT_SCAN": 1
}
},
"l7_payload": {
"inferences_total": 1200,
"attacks_detected_total": 5,
"threats_by_category": {
"COMMAND_INJECTION": 2,
"SQL_INJECTION": 3
}
},
"tls_eta": {
"inferences_total": 850,
"attacks_detected_total": 1,
"threats_by_category": {
"MALICIOUS_TLS_CLIENT": 1
}
}
},
"alloc_bytes": 14523904,
"sys_bytes": 35651584,
"num_gc": 12
}redborder-ai-dpi includes an automated forensic capture engine that saves the raw packets for every triggered security alert:
forensics:
enabled: true
storage_path: "/var/log/redborder-ai-dpi/pcaps" # Directory for generated PCAPs
mode: "flow_context" # "flow_context" (buffers last 10 packets) or "single_packet"
embed_raw_base64: true # Embed base64-encoded raw frame and hex payload in alert JSON
max_storage_mb: 5000 # Automatic storage cap
max_retention_days: 14 # Retain alert PCAPs for 14 days- Flow Context Capture: redborder-ai-dpi extracts the full TCP 3-way handshake and request packets leading up to the exploit from the
FlowTrackerring buffer. - Wireshark-Ready PCAP: redborder-ai-dpi writes a
.pcapfile to/var/log/redborder-ai-dpi/pcaps/alert_<event_id>_<timestamp>.pcap. - In-Band Forensics: The security alert JSON published to Kafka / HTTP is enriched with:
pcap_file: Absolute path to the PCAP file on disk.raw_packet_base64: Base64-encoded raw Ethernet frame for immediate UI rendering.raw_payload_hex: Hex-encoded exploit payload.
# Open the generated forensic PCAP directly in Wireshark
wireshark /var/log/redborder-ai-dpi/pcaps/alert_alert-l7-1723652500000000000_1723652500000000000.pcap
# Or inspect with tcpdump:
tcpdump -nn -vv -r /var/log/redborder-ai-dpi/pcaps/alert_*.pcapredborder-ai-dpi supports both single-instance daemon execution and multi-instance segment deployments via systemd template units.
Used for standard single-interface TAP or single-segment inline deployments:
# Enable and start default daemon (/etc/redborder-ai-dpi/config.yaml)
sudo systemctl enable --now redborder-ai-dpi.service
# View status and live logs
sudo systemctl status redborder-ai-dpi.service
sudo journalctl -u redborder-ai-dpi.service -fWhen inspecting multiple network segments (for example, Segment 1 between eth0 <-> eth1 and Segment 2 between eth3 <-> eth4), running dedicated, independent instances is the recommended architecture:
| Advantage | Why It Matters |
|---|---|
| NUMA & CPU Pinning | In multi-NIC servers, eth0/eth1 may be bound to PCIe Bus 0 (NUMA 0) and eth3/eth4 to PCIe Bus 1 (NUMA 1). Running isolated instances avoids cross-NUMA interconnect latency and cache contention. |
| Zero Blast Radius / Fault Isolation | An interface issue or traffic surge on Segment 1 will never affect packet forwarding on Segment 2. |
| Independent Lifecycles | Stop, reload, or reconfigure Segment 1 without dropping packets on Segment 2. |
| Per-Segment Policies | Apply different inspection thresholds, whitelists, Kafka topics, or forensics retention per segment. |
Copy the template configuration configs/segment.example.yaml for each segment:
# Segment 1 (WAN <-> DMZ: eth0 <-> eth1)
sudo cp /etc/redborder-ai-dpi/segment.example.yaml /etc/redborder-ai-dpi/seg-wan.yaml
sudo vim /etc/redborder-ai-dpi/seg-wan.yaml
# Set:
# ips.interface_a: "eth0"
# ips.interface_b: "eth1"
# metrics.socket_path: "/run/redborder-ai-dpi/seg-wan.sock"
# forensics.storage_path: "/var/log/redborder-ai-dpi/pcaps/seg-wan"
# Segment 2 (LAN <-> Core: eth3 <-> eth4)
sudo cp /etc/redborder-ai-dpi/segment.example.yaml /etc/redborder-ai-dpi/seg-lan.yaml
sudo vim /etc/redborder-ai-dpi/seg-lan.yaml
# Set:
# ips.interface_a: "eth3"
# ips.interface_b: "eth4"
# metrics.socket_path: "/run/redborder-ai-dpi/seg-lan.sock"
# forensics.storage_path: "/var/log/redborder-ai-dpi/pcaps/seg-lan"Using systemd template units (redborder-ai-dpi@<instance>.service), instances automatically load /etc/redborder-ai-dpi/<instance>.yaml:
# Start and enable each segment independently
sudo systemctl enable --now redborder-ai-dpi@seg-wan.service
sudo systemctl enable --now redborder-ai-dpi@seg-lan.service
# Check status of specific segments
sudo systemctl status redborder-ai-dpi@seg-wan.service
sudo systemctl status redborder-ai-dpi@seg-lan.service# Inspect Segment 1 statistics & drop counts
redborder-ai-dpi -t --socket /run/redborder-ai-dpi/seg-wan.sock
# Inspect Segment 2 statistics & drop counts
redborder-ai-dpi -t --socket /run/redborder-ai-dpi/seg-lan.sockredborder-ai-dpi provides native RPM packaging with systemd integration and optional offline Deep Learning wheel bundling.
# Standard RPM Build (Native high-speed ONNX inference)
make rpm
# Unified Deep Learning RPM (Bundles offline CPU PyTorch & training wheels)
make -C packaging/rpm rpm WITH_DEEP_LEARNING=1
# Local Direct RPM Build (rpmbuild)
make -C packaging/rpm rpm-local/usr/bin/redborder-ai-dpi— Daemon binary & CLI utility/usr/lib/systemd/system/redborder-ai-dpi.service— Single-instance systemd unit/usr/lib/systemd/system/redborder-ai-dpi@.service— Multi-instance systemd template unit/etc/redborder-ai-dpi/config.yaml— Default daemon configuration/etc/redborder-ai-dpi/segment.example.yaml— Multi-segment configuration template/usr/share/redborder-ai-dpi/models/— Pre-trained ONNX neural network models/opt/redborder-ai-dpi/scripts/— Model retraining & self-learning scripts/var/log/redborder-ai-dpi/pcaps/— Forensics alert PCAP storage directory
redborder-ai-dpi/
├── .github/
│ └── workflows/ # CI/CD (GolangCI, SBOM Trivy, RPM release)
├── cmd/
│ ├── redborder-ai-dpi/ # Main daemon & IPC client entrypoint
│ └── gen-pcap/ # Synthetic traffic & attack PCAP generator
├── configs/
│ ├── config.example.yaml # Single-instance configuration
│ └── segment.example.yaml # Multi-instance segment configuration
├── data/
│ ├── domains/ # Blocklists & threat feeds
│ └── payloads/ # Attack & benign dataset text files
├── internal/
│ ├── capture/ # Zero-copy AF_PACKET & PCAP reader/transmitter
│ ├── config/ # YAML/JSON unified configuration loader
│ ├── flow/ # 5-tuple tracker & 10x6 temporal matrices
│ ├── forensics/ # Forensic packet capture & PCAP writer
│ ├── inference/ # ONNX Runtime engine & ModelWatcher
│ ├── ips/ # Inline bump-in-the-wire IPS bridge & packet drop
│ ├── metrics/ # Unix domain socket IPC status server & telemetry
│ ├── output/ # Kafka producer, HTTP output, Whitelist, Console
│ └── reassembly/ # TCP stream assembler & HTTP/TLS/DNS parser
├── models/
│ ├── payload_sqli_cnn.onnx # L7 ONNX model
│ ├── payload_sqli_cnn.pth # L7 PyTorch weights checkpoint
│ ├── flow_anomaly_cnn.onnx # L3/L4 Flow ONNX model
│ └── flow_anomaly_cnn.pth # L3/L4 PyTorch weights checkpoint
├── packaging/
│ └── rpm/ # RPM spec file, Makefile, and mock build configs
├── python/
│ └── requirements.txt # Python ML training dependencies
├── scripts/
│ ├── download_datasets.py # SecLists/PayloadsAllTheThings fetcher
│ ├── download_threat_feeds.py # Abuse.ch URLhaus/ThreatFox updater
│ ├── simulate_attacks.py # Live attack and flow anomaly simulator
│ ├── train_flow_anomaly.py # L3/L4 Flow Autoencoder trainer
│ └── train_payload_sqli.py # L7 Character Conv1D trainer
├── redborder-ai-dpi.service # Single-instance systemd unit
├── redborder-ai-dpi@.service # Multi-instance systemd template unit
├── LICENSE # GNU Affero General Public License v3 (AGPL-3.0)
├── Makefile # Build, test, and training automation
├── go.mod # Go module definition
└── README.md # Documentation
Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).