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_sec300intConnection tracking SYN/idle timeout — keep ≥ app keepalive interval
ct_server_port_max32768intOnly track connections to ports ≤ this (0 = all ports; breaks outbound traffic)
ct_established_exempttrueboolExempt sources with a proven TCP session from PPS/BPS/TCP scoring (v2.0+)
port_thresholds[]listPer-port threshold overrides, max 8 entries (v2.0+) — see below
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).

Established-connection exemption (v2.0+)

With ct_established_exempt: true (default), a source that completes a real TCP session — it sends a data segment within ct_syn_timeout_sec of its SYN — is exempt from PPS/BPS/TCP_PPS rate scoring. Bulk transfers (SFTP, backups) no longer get banned. SYN-rate, conn-rate, and UDP/ICMP scoring still apply, as do attack-mode caps. Works even when enable_connection_tracking is false.

Per-port threshold overrides (v2.0+)

static.port_thresholds replaces the global pps_threshold/bps_threshold for traffic to specific ports, in peacetime AND attack mode. Max 8 entries; each entry is a port or range plus thresholds (0 inherits the global value):

yaml
static:
  port_thresholds:
    - ports: "443"
      pps_threshold: 5000
      bps_threshold: 0
    - ports: "8000-9000"
      pps_threshold: 3000
      bps_threshold: 52428800

Use for transfer-heavy services that legitimately exceed global limits.

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
drop_fragmentsfalseDrop fragmented IP packets (MF flag or non-zero fragment offset)

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_factor0.7Fraction of spike threshold below which attack state clears (must be < 1.0)
spike_recovery_time10Seconds 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)
attack_min_pps1000Absolute floor for the attack PPS trigger (busy servers shouldn't trip attack mode)
attack_min_bps1048576Absolute floor for the attack BPS trigger
attack_trigger_time3Consecutive spike seconds before attack state is declared
attack_max_duration300Hard cap on attack-state seconds (0 = no cap)
attack_per_ip_pps1000Hard per-source PPS cap while an attack is active (0 = off)
attack_port_pps10000Aggregate per-destination-port PPS cap while an attack is active (0 = off) — rotation-proof; presets: 10k hosting / 15k gaming / 25k CDN (v2.0+)

New source flood

FieldDefaultDescription
new_source_limit100New unique IPs/second before flood mode engages
new_source_ban_duration30Each excess new source is temp-banned for this many seconds (v2.0+ — previously only one packet was dropped)

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_mode"off"SYN-cookie SYN flood mitigation: off / adaptive (engages at synproxy_threshold or during attacks) / always
synproxy_threshold10000Per-CPU SYN pps that engages adaptive SYN-cookie mode
syn_pps_threshold170Per-IP SYN packets/sec before the rate-based SYN gate scores the source

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

behavior — Adaptive behavior engine (v2.0+)

Learns per-port traffic baselines and groups sources into clusters; lookalike bot clusters (identical packet sizes, machine-paced timing, explosive growth) are flagged with a confidence score.

FieldDefaultDescription
enabledtrueMaster switch for the behavior engine (requires loader restart to change)
auto_blocktrueAuto-ban members of malicious clusters (≥85% confidence) for 1 hour (default since v2.1.0; set false for report-only mode)

Review clusters in the TUI behavior tab or with sudo openshield behavior. The engine freezes learning during declared attacks, so it mainly catches slow-burn botnets. See Config Values in Plain Language.

metrics — HTTP metrics API (v2.0+, default off)

Serves everything the TUI shows as JSON for custom dashboards. Full guide: Metrics API.

FieldDefaultDescription
enabledfalseEnable the HTTP JSON metrics endpoint
listen127.0.0.1:9100Bind address (0.0.0.0:9100 for remote dashboards)
api_keyrandom per installBearer token — manage with openshield key / key set / key regen (hot-applied)
rate_limit_per_sec10Max requests/s per source IP (0 = unlimited)
whitelist[]IP/CIDR allowlist (empty = all; requires loader restart to change)

alerter — Webhook notifications

FieldDefaultDescription
enabledfalseEnable webhook alerter
webhook_url""Discord/Slack webhook URL
events[]Event types to alert on
graph_enabledtrueAttach traffic graph to attack-end alerts
attack_updatestrueProgress embeds while an attack is ongoing
show_banned_ipsfalseInclude banned IP list inline in ban alerts
geo_breakdowntrueContinent/country share of banned IPs (requires GeoIP db)

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

Config Values in Plain Language · CLI Reference · Detection Engine · TUI Guide