Skip to content

Configuration Reference

Runtime configuration file: /etc/openshield/openshield.yaml

All defaults shown below match the actual code defaults from userspace/internal/config/defaults.go. Generate a fresh config with:

bash
sudo openshield config

Top-level

FieldDefaultDescription
interfaceeno1Network interface to attach XDP to
xdp_modeautoXDP attachment mode: auto, native, generic, skb

auto tries native → generic → skb in fallback order. Set explicitly to force a specific mode.

static — Per-IP rate thresholds & scoring

Controls per-source-IP rate limiting with a suspicion scoring system. Each violation type adds score points; when cumulative score exceeds suspicion_threshold, the IP is banned.

FieldDefaultTypeDescription
enabledtrueboolMaster switch for per-IP static mitigation
pps_threshold850intMax packets/s per IP (all protocols)
bps_threshold8912896intMax bytes/s per IP (~8.5 MB/s)
tcp_pps_threshold680intMax TCP packets/s per IP
udp_pps_threshold425intMax UDP packets/s per IP
icmp_pps_threshold85intMax ICMP packets/s per IP
syn_pps_threshold170intMax SYN packets/s per IP
suspicion_threshold100intCumulative suspicion score that triggers a ban
ban_duration3600intBan duration in seconds (1 hour)
pps_score20intScore added for PPS threshold violation
bps_score20intScore added for BPS threshold violation
tcp_pps_score15intScore added for TCP PPS violation
udp_pps_score15intScore added for UDP PPS violation
icmp_pps_score25intScore added for ICMP PPS violation
syn_pps_score30intScore added for SYN PPS violation
suspicion_decay0.5floatScore retention per window (0.5 = keep 50%)
rate_limit_modethresholdstringthreshold (scoring) or token_bucket
token_rate0intTokens refilled/s per IP (token_bucket mode)
token_burst0intMax burst tokens per IP (token_bucket mode)
enable_connection_trackingtrueboolDrop blind SYN-ACK/RST/ACK (no prior SYN)
ct_syn_timeout_sec30intConnection tracking SYN timeout
star_duration_multiplicators[1,2,4,8,16,32][]intMultipliers for repeat-offender escalating bans
star_decay_seconds3600intClean seconds before star rating drops
ban_subnets[][]stringSubnets to ban in CIDR notation
auto_subnet_banfalseboolAuto-ban entire subnets when many IPs banned
auto_subnet_prefixes[24][]intPrefix lengths for auto subnet ban
subnet_ban_duration7200intBan duration for subnet bans (2 hours)

Suspicion scoring explained

Token bucket mode

Set rate_limit_mode: token_bucket to use a token-based approach instead of scoring. Each IP gets token_burst initial tokens, with token_rate tokens refilled per second. Packets consume 1 token each. When tokens are exhausted, the IP is rate-limited (not banned — packets are dropped until tokens refill).

validation — Packet validation filters

FieldDefaultDescription
filter_privatetrueDrop packets with private/bogon source IPs
filter_bogontrueDrop packets from bogon address ranges
filter_bogus_tcptrueDrop packets with impossible TCP flag combinations
filter_malformedtrueDrop packets with malformed headers

dynamic — Advanced detection engine

Adaptive baseline, attack detection, new-source flood prevention, amplification detection, and panic circuit breaker.

Baseline learning

FieldDefaultDescription
enabledtrueEnable dynamic detection engine
baseline_window60Seconds to build initial traffic baseline
baseline_update_interval5Seconds between baseline EMA updates
baseline_alpha0.1EMA smoothing factor for baseline
baseline_alpha_min0.05Minimum EMA alpha (adaptive floor)
baseline_alpha_max0.50Maximum EMA alpha (adaptive ceiling)
baseline_alpha_variance_scale0.1How much variance adjusts alpha

Spike & attack detection

FieldDefaultDescription
spike_percentage200% above baseline that triggers spike detection (200 = 3× baseline)
spike_recovery_factor1.2Multiplier below which spike is considered recovered
spike_recovery_time30Seconds below recovery factor before clearing
attack_threshold_multiplier0.5Threshold multiplier during attack (0.5 = 50% of normal)
attack_pps_threshold0Global PPS to trigger attack state (0 = disabled, uses baseline)
attack_bps_threshold0Global BPS to trigger attack state (0 = disabled)

New source flood

FieldDefaultDescription
new_source_limit100New unique IPs/second before flood mode engages
new_source_ban_duration30Ban duration for new sources detected during flood

Panic circuit breaker

When per-CPU packet rate exceeds panic_pps_rate, the panic breaker bulk-drops panic_drop_ratio% of packets before any map lookups — protecting the CPU from map contention under extreme load.

FieldDefaultDescription
panic_pps_rate200000Per-CPU PPS that triggers panic breaker
panic_drop_ratio80% of packets to bulk-drop when in panic mode
panic_global_pps_threshold5000000Cross-CPU total PPS for coordinated panic
panic_coordination_enabledtrueEnable userspace cross-CPU panic coordination

Amplification detection

FieldDefaultDescription
dns_amplification_enabledtrueDrop DNS amplification responses (sport=53, QR=1)
dns_amplification_payload_min512Minimum UDP payload for DNS amp detection
udp_amplification_enabledtrueDrop UDP amplification on known amp ports
udp_amp_ports[53,123,1900,11211,17,19,520,69]Monitored UDP amplification ports
udp_amp_payload_min[512,90,256,50,50,50,50,50]Min payload per amp port

Behavioral anomaly detection

FieldDefaultDescription
syn_fin_ratio_enabledtrueDetect abnormal SYN/FIN ratios
syn_fin_ratio_threshold100SYN/FIN ratio that triggers detection
entropy_spoof_enabledtrueDetect spoofed-source floods via entropy analysis
entropy_spoof_threshold12Entropy threshold for spoof detection
ttl_anomaly_enabledtruePer-IP TTL deviation detection
ttl_expected64Expected initial TTL
ttl_tolerance5TTL deviation tolerance
pkt_anomaly_enabledtrueDetect anomalous packet sizes
pkt_size_min_threshold64Minimum expected packet size
pkt_size_max_threshold1024Maximum expected packet size

Connection rate limiting

FieldDefaultDescription
conn_rate_enabledtrueEnable connection rate limiting
conn_rate_limit5000Max new connections/s per IP

Auto-escalation

FieldDefaultDescription
auto_escalation_enabledtrueEnable automatic subnet ban escalation
auto_escalation_threshold5Bans per /24 before subnet ban triggered

MAC filtering

FieldDefaultDescription
mac_filter_enabledfalseMAC address whitelist/blacklist
mac_filter_mode0Filter mode (0=disabled, 1=whitelist, 2=blacklist)
mac_filter_entries[]List of MAC addresses

SYNPROXY

FieldDefaultDescription
synproxy_enabledfalseCookie-based SYN flood mitigation
synproxy_secret""Secret key for SYN cookie generation
synproxy_timeout_sec10SYN cookie timeout

L7 signature drops

FieldDefaultDescription
l7_drop_signaturesnullList of L7 payload signatures to drop

whitelist — Trusted IPs

FieldDefaultDescription
enabledtrueEnable whitelist bypass
ips[]Array of trusted IPs that bypass all mitigation

Whitelisted IPs skip all rate checks, validation, and detection. Their packets pass directly through.

maps — BPF map sizing

FieldDefaultDescription
ip_stats_max100000Max entries in per-IP stats LRU hashmap
ban_max50000Max entries in ban LRU hashmap
whitelist_max10000Max entries in whitelist hashmap
event_buffer_size262144Ring buffer size for events (256 KB)
bloom_filter_enabledtrueUse Bloom filter for fast whitelist lookup
bloom_filter_size150000Bloom filter entry count

Bloom filter

When bloom_filter_enabled: true, whitelist lookups first check a Bloom filter — a probabilistic data structure that can definitively say "this IP is NOT in the whitelist" in O(1) with no hashmap lookup. Only IPs that pass the Bloom filter are checked against the full hashmap, drastically reducing map lookup overhead under load.

This is handled inside the BPF fast path: the Bloom filter map is probed before the whitelist hashmap, avoiding unnecessary hashmap lookups for non-whitelisted traffic.

telemetry — Stats & logging

FieldDefaultDescription
poll_interval1Seconds between BPF map reads
event_rate_limit100Max events/s pushed to TUI/socket
top_offenders_count20Number of top offenders tracked
log_levelinfoLog level: debug, info, warn, error
snapshot_interval1Seconds between snapshot pushes to TUI

alerter — Webhook notifications

FieldDefaultDescription
enabledfalseEnable webhook alerter
webhook_url""Discord/Slack webhook URL
events[]Event types to alert on

Kernel feature gate behavior

Some configuration fields depend on kernel features. OpenShield-XDP auto-detects available features at load time:

Run openshield status after loading to see which features are active. Fields that can't be supported due to kernel limitations are silently disabled with no error — the program degrades gracefully rather than failing to load.

Runtime-safe vs read-only fields

Fields marked as runtime-safe can be changed via openshield reload or the TUI Config screen without unloading the XDP program. Read-only fields require a full reload:

Runtime-safe: All static thresholds, scores, ban duration, rate limit mode, validation flags, dynamic thresholds, whitelist.enabled, bloom_filter_enabled

Read-only: interface, xdp_mode, map sizes (ip_stats_max, ban_max, etc.), baseline_window, baseline_alpha, poll_interval

Next steps

CLI Reference · Detection Engine · TUI Guide e_alpha, poll_interval`

Next steps

CLI Reference · Detection Engine · TUI Guide