3 # create_chain_tcp_scan_handling
5 # These rules are mainly copied from "Arno's IPTABLES firewall script"
6 # by Arno van Amersfoort. See http://rocky.eld.leidenuniv.nl/ for details
8 # Maximilian Wilhelm <max@rfc2324.org>
9 # -- Mon, 24 Apr 2006 20:05:49 +0200
12 . /usr/share/alff/lib/plugin-routines
19 # Make sure there is (an empty) chain tcp_scan_handling
20 createChain tcp_scan_handling
23 # Log scanning of nmap etc.
24 if [ "${log_scans}" != "0" ]; then
25 echo " * Logging of stealth scans (nmap probes etc.) enabled."
29 iptables -A tcp_scan_handling -p tcp --tcp-flags ALL FIN,URG,PSH \
30 -m limit --limit 3/m --limit-burst 5 -j LOG --log-level ${loglevel} --log-prefix "Stealth XMAS scan: "
33 iptables -A tcp_scan_handling -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG \
34 -m limit --limit 3/m --limit-burst 5 -j LOG --log-level ${loglevel} --log-prefix "Stealth XMAS-PSH scan: "
37 iptables -A tcp_scan_handling -p tcp --tcp-flags ALL ALL \
38 -m limit --limit 3/m --limit-burst 5 -j LOG --log-level ${loglevel} --log-prefix "Stealth XMAS-ALL scan: "
41 iptables -A tcp_scan_handling -p tcp --tcp-flags ALL FIN \
42 -m limit --limit 3/m --limit-burst 5 -j LOG --log-level ${loglevel} --log-prefix "Stealth FIN scan: "
45 iptables -A tcp_scan_handling -p tcp --tcp-flags SYN,RST SYN,RST \
46 -m limit --limit 3/m --limit-burst 5 -j LOG --log-level ${loglevel} --log-prefix "Stealth SYN/RST scan: "
49 iptables -A tcp_scan_handling -p tcp --tcp-flags SYN,FIN SYN,FIN \
50 -m limit --limit 3/m --limit-burst 5 -j LOG --log-level ${loglevel} --log-prefix "Stealth SYN/FIN scan(?): "
53 iptables -A tcp_scan_handling -p tcp --tcp-flags ALL NONE \
54 -m limit --limit 3/m --limit-burst 5 -j LOG --log-level ${loglevel} --log-prefix "Stealth Null scan: "
59 echo " * Logging of stealth scans (nmap probes etc.) disabled."
63 # Drop (NMAP) scan packets:
64 if [ "${drop_scans}" != '0' ]; then
65 echo " * stealth scans (nmap probes etc.) will be DROPed."
70 iptables -A tcp_scan_handling -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP
74 iptables -A tcp_scan_handling -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP
78 iptables -A tcp_scan_handling -p tcp --tcp-flags ALL ALL -j DROP
82 iptables -A tcp_scan_handling -p tcp --tcp-flags ALL FIN -j DROP
86 iptables -A tcp_scan_handling -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
88 # SYN/FIN -- Scan(probably)
89 ###########################
90 iptables -A tcp_scan_handling -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
94 iptables -A tcp_scan_handling -p tcp --tcp-flags ALL NONE -j DROP
99 echo " * stealth scans (nmap probes etc.) will *not* be DROPed."