5 # Check the headers of TCP connections for unusual flag combinations
7 # Maximilian Wilhelm <max@rfc2324.org>
8 # -- Mon, 24 Apr 2006 20:04:15 +0200
11 . /usr/share/alff/lib/plugin-routines
14 # Make sure there is (an empty) chain tcp_header_check
15 createChain tcp_header_check
19 # If packet has SYN/ACK set and is new to ct, someone is trying nasty things
20 iptables -A tcp_header_check -p tcp --tcp-flags SYN,ACK SYN,ACK -m state --state NEW -m limit --limit 3/m --limit-burst 5 -j LOG --log-prefix "alff syn-ack-but-new: "
21 iptables -A tcp_header_check -p tcp --tcp-flags SYN,ACK SYN,ACK -m state --state NEW -j REJECT --reject-with tcp-reset
24 # If the paket is new to conntrack but does not have 'syn' set, someone is trying nasty things, too
25 iptables -A tcp_header_check -p tcp ! --syn -m state --state NEW -m limit --limit 3/m --limit-burst 5 -j LOG --log-prefix "alff new-without-syn: "
26 iptables -A tcp_header_check -p tcp ! --syn -m state --state NEW -j DROP
29 # If packet has SYN/ACK set and is new to ct, someone is trying nasty things
30 ip6tables -A tcp_header_check -p tcp --tcp-flags SYN,ACK SYN,ACK -m state --state NEW -m limit --limit 3/m --limit-burst 5 -j LOG --log-prefix "alff syn-ack-but-new: "
31 ip6tables -A tcp_header_check -p tcp --tcp-flags SYN,ACK SYN,ACK -m state --state NEW -j REJECT --reject-with tcp-reset
34 # If the paket is new to conntrack but does not have 'syn' set, someone is trying nasty things, too
35 ip6tables -A tcp_header_check -p tcp ! --syn -m state --state NEW -m limit --limit 3/m --limit-burst 5 -j LOG --log-prefix "alff new-without-syn: "
36 ip6tables -A tcp_header_check -p tcp ! --syn -m state --state NEW -j DROP