DDOS utok zabespečeni
Napsal: 05 bře 2012 18:30
Dobrý den mam virtualni server se serverama na counter strike 1.6 a schazují mi servery a vyhrožují.
Dá se s tím něco udělat ?????
Dá se s tím něco udělat ?????
Kód: Vybrat vše
# port scan module detector ..
iptables -N PORTSCAN
# NMAP FIN/URG/PSH
iptables -A INPUT -i all -p tcp --tcp-flags ALL FIN,URG,PSH -m recent --set -j PORTSCAN
iptables -A FORWARD -i all -p tcp --tcp-flags ALL FIN,URG,PSH -m recent --set -j PORTSCAN
# SYN/RST
iptables -A INPUT -i all -p tcp --tcp-flags SYN,RST SYN,RST -m recent --set -j PORTSCAN
iptables -A FORWARD -i all -p tcp --tcp-flags SYN,RST SYN,RST -m recent --set -j PORTSCAN
# SYN/FIN -- Scan(probably)
iptables -A INPUT -i all -p tcp --tcp-flags SYN,FIN SYN,FIN -m recent --set -j PORTSCAN
iptables -A FORWARD -i all -p tcp --tcp-flags SYN,FIN SYN,FIN -m recent --set -j PORTSCAN
# NMAP FIN Stealth
iptables -A INPUT -i all -p tcp --tcp-flags ALL FIN -m recent --set -j PORTSCAN
iptables -A FORWARD -i all -p tcp --tcp-flags ALL FIN -m recent --set -j PORTSCAN
# ALL/ALL Scan
iptables -A INPUT -i all -p tcp --tcp-flags ALL ALL -m recent --set -j PORTSCAN
iptables -A FORWARD -i all -p tcp --tcp-flags ALL ALL -m recent --set -j PORTSCAN
# NMAP Null Scan
iptables -A INPUT -i all -p tcp --tcp-flags ALL NONE -m recent --set -j PORTSCAN
iptables -A FORWARD -i all -p tcp --tcp-flags ALL NONE -m recent --set -j PORTSCAN
# XMAS
iptables -A INPUT -i all -p tcp --tcp-flags ALL URG,ACK,PSH,RST,SYN,FIN -m recent --set -j PORTSCAN
iptables -A FORWARD -i all -p tcp --tcp-flags ALL URG,ACK,PSH,RST,SYN,FIN -m recent --set -j PORTSCAN
# Log/Drop PORTSCAN
iptables -A PORTSCAN -m limit --limit 1/second -j LOG --log-level info --log-prefix "PORTSCAN -- SHUN " --log-tcp-sequence --log-tcp-options --log-ip-options
iptables -A PORTSCAN -j DROP
Kód: Vybrat vše
iptables -A INPUT -p icmp -j DROP
iptables -A INPUT -i $interface -d $ip_address -p icmp -j ACCEPT
iptables -A OUTPUT -p icmp -j ACCEPT
iptables -A INPUT -p icmp -m limit --limit 10/second -j ACCEPT
iptables -A INPUT -p icmp -m limit --limit 1/s --limit-burst 1 -j LOG --log-prefix PING-DROP:
iptables -A INPUT -m recent --name ICMP --update --seconds 60 --hitcount 6 -j DROP
iptables -A INPUT -i $interface -d $ip_address -p icmp -m recent --set --name ICMP -j ACCEPT
Kód: Vybrat vše
iptables -A INPUT -p tcp ! --syn -m conntrack --ctstate NEW -j LOG --log-prefix "New not syn:"
iptables -A INPUT -p tcp ! --syn -m conntrack --ctstate NEW -j DROP
iptables -A FORWARD -p tcp ! --syn -m conntrack --ctstate NEW -j LOG --log-prefix "New not syn:"
iptables -A FORWARD -p tcp ! --syn -m conntrack --ctstate NEW -j DROP
Kód: Vybrat vše
iptables -A INPUT -p tcp -s any/0 --dport 113 -j REJECT --reject-with tcp-reset
iptables -A FORWARD -p tcp -i eth+ -s any/0 --dport 113 -j REJECT --reject-with tcp-reset
iptables -A FORWARD -p tcp -i $interface -s any/0 --dport 113 -j REJECT --reject-with tcp-reset
Kód: Vybrat vše
iptables -N BAD_FLAGS
iptables -A INPUT -p tcp --tcp-option 64 -m recent --set -j BAD_FLAGS
iptables -A INPUT -p tcp --tcp-option 128 -m recent --set -j BAD_FLAGS
iptables -A BAD_FLAGS -m limit --limit 1/second -j LOG --log-level info --log-prefix "BAD_FLAGS -- SHUN " --log-tcp-sequence --log-tcp-options --log-ip-options
iptables -A BAD_FLAGS -j DROP
Kód: Vybrat vše
iptables -N SMALL
iptables -A INPUT -p udp -m length --length 0:27 -m recent --set -j SMALL
iptables -A INPUT -p tcp -m length --length 0:39 -m recent --set -j SMALL
iptables -A INPUT -p icmp -m length --length 0:27 -m recent --set -j SMALL
iptables -A INPUT -p 30 -m length --length 0:31 -m recent --set -j SMALL
iptables -A INPUT -p 47 -m length --length 0:39 -m recent --set -j SMALL
iptables -A INPUT -p 50 -m length --length 0:49 -m recent --set -j SMALL
iptables -A INPUT -p 51 -m length --length 0:35 -m recent --set -j SMALL
iptables -A INPUT -m length --length 0:19 -m recent --set -j SMALL
iptables -A SMALL -m limit --limit 1/second -j LOG --log-level info --log-prefix "SMALL -- SHUN " --log-tcp-sequence --log-tcp-options --log-ip-options
iptables -A SMALL -j DROP
Kód: Vybrat vše
iptables -N BOGUS
iptables -t filter -p all -A INPUT -m conntrack --ctstate INVALID -j BOGUS
iptables -t filter -p all -A OUTPUT -m conntrack --ctstate INVALID -j BOGUS
iptables -t filter -p all -A FORWARD -m conntrack --ctstate INVALID -j BOGUS
iptables -A BOGUS -m limit --limit 1/second -j LOG --log-level info --log-prefix "INVALID PACKET -- DROP " --log-tcp-sequence --log-tcp-options --log-ip-options
iptables -A BOGUS -j REJECT
Kód: Vybrat vše
iptables -N NOFRAGS
iptables -A OUTPUT -p ip -f -j NOFRAGS
iptables -A INPUT -p ip -f -j NOFRAGS
iptables -A FORWARD -p ip -f -j NOFRAGS
iptables -A NOFRAGS -m limit --limit 1/second -j LOG --log-level info --log-prefix "Fragment -- DROP " --log-tcp-sequence --log-tcp-options --log-ip-options
iptables -A NOFRAGS -j DROP
Kód: Vybrat vše
iptables -N ODDPORTS
iptables -A INPUT -p udp --sport 2:21 -m recent --set -j ODDPORTS
iptables -A INPUT -p udp --dport 2:21 -m recent --set -j ODDPORTS
iptables -A INPUT -p tcp --dport 0 -m recent --set -j ODDPORTS
iptables -A INPUT -p tcp --sport 0 -m recent --set -j ODDPORTS
iptables -A FORWARD -i eth+ -p udp --dport 2:21 -m recent --set -j ODDPORTS
iptables -A FORWARD -i eth+ -p tcp --dport 0 -m recent --set -j ODDPORTS
iptables -A FORWARD -i eth+ -p tcp --sport 0 -m recent --set -j ODDPORTS
iptables -A FORWARD -i $interface -p udp --dport 2:21 -m recent --set -j ODDPORTS
iptables -A FORWARD -i $interface -p tcp --dport 0 -m recent --set -j ODDPORTS
iptables -A FORWARD -i $interface -p tcp --sport 0 -m recent --set -j ODDPORTS
iptables -A ODDPORTS -m limit --limit 1/second -j LOG --log-level info --log-prefix "ODDPORTS -- SHUN " --log-tcp-sequence --log-tcp-options --log-ip-options
iptables -A ODDPORTS -j DROP
Kód: Vybrat vše
iptables -N OFFENDER
iptables -A INPUT -p all -m recent --rcheck --seconds 300 -j OFFENDER
iptables -A FORWARD -p all -m recent --rcheck --seconds 300 -j OFFENDER
iptables -A OFFENDER -m limit --limit 1/second -j LOG --log-level info --log-prefix "OFFENDER -- SHUN " --log-tcp-sequence --log-tcp-options --log-ip-options
iptables -A OFFENDER -j DROP
Kód: Vybrat vše
iptables -N OFFENDER
iptables -A INPUT -p all -m recent --rcheck --seconds 300 -j OFFENDER
iptables -A FORWARD -p all -m recent --rcheck --seconds 300 -j OFFENDER
iptables -A OFFENDER -m limit --limit 1/second -j LOG --log-level info --log-prefix "OFFENDER -- SHUN " --log-tcp-sequence --log-tcp-options --log-ip-options
iptables -A OFFENDER -j DROP
Kód: Vybrat vše
iptables -A INPUT -m recent --rcheck --seconds 60 -m limit --limit 10/second -j LOG --log-prefix "BG "
iptables -A INPUT -m recent --update --seconds 60 -j DROP
# drop spoofed packets (i.e. packets with local source addresses coming from outside etc.), mark as Bad Guy
iptables -A INPUT -i $interface -s $ip_address -m recent --set -j DROP
Kód: Vybrat vše
iptables -A INPUT -i $interface -p tcp -d $ip_address -m multiport --dports 137,138,139,445 -j ACCEPT
iptables -A INPUT -i $interface -p udp -d $ip_address -m multiport --dports 137,138,139,445 -j ACCEPT
iptables -A INPUT -i $interface -p udp --dport 1026 -j DROP
iptables -A INPUT -i $interface -m multiport -p tcp --dports 1433,4899 -j DROP