Frčí útok? Je to SYN flood útok. Člověk přemýšlí, jestli nepřejít jinam, ale tam by se přesměroval i útok (dle A záznamu v DNS), takže:
#!/bin/bash #zdroje: https://blog.ip2location.com/knowledge-base/how-to-block-ip-addresses-from-a-country-using-ipset/ a https://www.ip2location.com/free/visitor-blocker # Create the ipset list ipset -N countryblocker hash:net # remove any old list that might exist from previous runs of this script rm /root/scripts/cn.zone # Pull the latest IP set for China cd /root/scripts wget -P . http://www.ipdeny.com/ipblocks/data/countries/cn.zone sed -i '/^#/d' /root/scripts/cn.zone sed -i 's/^/ipset add countryblocker /g' /root/scripts/cn.zone sed -i '1i ipset create countryblocker nethash' /root/scripts/cn.zone chmod +x /root/scripts/cn.zone bash /root/scripts/cn.zone iptables -A INPUT -m set --match-set countryblocker src -j DROP # Add each IP address from the downloaded list into the ipset 'china' #for i in $(cat /root/scripts/cn.zone ); do ipset -A china $i; done ### #iptables -A INPUT -m set --match-set countryblocker src -j DROP ### chmod +x /root/scripts/cn.zone bash /root/scripts/cn.zone # Restore iptables /sbin/iptables-restore < /etc/iptables.firewall.rules echo " Listen 89.221.212.196:80 Listen [2a02:2b88:2:1c4::1]:80Listen 89.221.212.196:443 Listen [2a02:2b88:2:1c4::1]:443 " > /etc/apache2/ports.conf apache2ctl graceful
Vypnací skript:
#!/bin/bash ### delete #iptables -D INPUT -m set --match-set countryblocker src -j DROP #iptables -D FORWARD -m set --match-set countryblocker src -j DROP ipset destroy countryblocker iptables -F iptables -F -t nat iptables -X iptables -X -t nat ip6tables -F ip6tables -F -t nat ip6tables -X ip6tables -X -t nat echo " Listen 89.221.212.196:81 Listen [2a02:2b88:2:1c4::1]:80Listen 89.221.212.196:443 Listen [2a02:2b88:2:1c4::1]:443 " > /etc/apache2/ports.conf apache2ctl graceful