C CO-RE TLS ClientHello SNI filter (bpf_iter_num up to 64 extensions,
IPv4 + IPv6, 802.1Q/802.1ad VLANs, ECH detection, optional tproxy_port
punt for split PQ ClientHello reassembly, reversed-FQDN LPM_TRIE, and
5-tuple LRU_HASH flow cache) for use MaeBPFC tcx and cgroup hooks.
defmodule MyEdge.FullSNI do
use MaeBPFC
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 MaeBPFC.Plugs.TLSSNI,
domains: :blocked_domains,
mode: :blocklist,
max_extensions: 64,
ipv6: true,
vlan: true,
ech_action: :drop,
split_action: :drop,
count: :sni_blocked,
emit: :sni_alerts
default :pass
end
endWith userspace TPROXY punt on split PQ ClientHello:
plug MaeBPFC.Plugs.TLSSNI,
domains: :blocked_domains,
split_action: {:tproxy, 15001},
tproxy_mark: 0x1501,
emit: :sni_alertsRequires use MaeBPFC (:maebpf_c). Using this plug inside a pure-Elixir
use MaeBPF module fails cleanly at compile time with an actionable hint.
Options:
:domains(or:map/:list) - requiredtype: :lpm_domainmap atom:mode-:blocklist(default, drop on match) or:allowlist(drop on miss):max_extensions-bpf_iter_numTLS extension scan cap (1..64, default64):ipv6- enable IPv6 TCP parsing alongside IPv4 (defaulttrue):vlan- strip up to two 802.1Q/802.1ad VLAN headers ontcx(defaulttrue):ech_action-:pass(default) or:dropwhen TLS extension0xFE0D(ECH) is seen:split_action-:pass(default),:drop,:alert,:tproxy, or{:tproxy, port}when aClientHellois truncated before SNI:tproxy_port- optional userspace TPROXY port (1..65535); implied whensplit_action: {:tproxy, port}is used:tproxy_mark- optionalu32 skb->markset when punting split flows to TPROXY (defaults totproxy_portwhen set, otherwise1):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:alert/:tproxysplit events):max_entries- optional domain map capacity when auto-declaring standalone maps
Emits .rodata globals (tlssni_mode, tlssni_ech_action,
tlssni_split_action, tlssni_tproxy_port, tlssni_tproxy_mark) so policy
flags can be inspected via MaeBPF.get_global/2 or overridden pre-load via
globals:.