Pure-Elixir, zero-clang TLS ClientHello SNI domain filter for tcx and
cgroup_skb hooks.
defmodule MyEdge.EgressSNI do
use MaeBPF
blocklist :blocked_domains, type: :lpm_domain, max_entries: 10_000
counter :sni_blocked
stream :sni_alerts, ringbuf_kb: 256
tcx :egress, direction: :egress do
plug MaeBPF.Plugs.TLSSNI,
domains: :blocked_domains,
mode: :blocklist,
ech_action: :pass,
split_action: :pass,
count: :sni_blocked,
emit: :sni_alerts
default :pass
end
endMatches exact FQDNs ("evil.example.com") and arbitrary-depth wildcard rules
("*.blocked.org") via a single reversed-FQDN LPM_TRIE lookup, caches
per-flow verdicts in a hidden 5-tuple LRU_HASH ("__maebpf_sni_flows"),
and clears stale entries on TCP SYN.
Options:
:domains(or:map) - requiredtype: :lpm_domainmap atom:mode-:blocklist(default, drop on match) or:allowlist(drop on miss):ech_action-:pass(default) or:dropwhen TLS extension0xFE0D(ECH) is seen:split_action-:pass(default),:drop, or:alertwhen ClientHello extensions are truncated before SNI:max_extensions- bounded TLS extension scan iterations (1..64, default16):flow_entries- capacity of the hidden 5-tupleLRU_HASHflow cache (default65_536):count- optional counter map incremented on drop:emit- optional RingBuf stream emitted on drop (and on:alertsplit events):max_entries- optional map capacity when auto-declaring standalone pipeline maps