У меня такая проблема, как dos/ddos атака. Очень много разных форумов и сайтов посмотрел, воспользовался поиском, но толком нигде нету точного ответа. Видел, что говорят про iptables + fail2ban, но примеров нету. Ещё нашел такую вещь:
Код: Выделить всё
iptables -I INPUT -p udp --dport 27000:29999 -m hashlimit --hashlimit-upto 101/sec --hashlimit-mode srcip --hashlimit-name css -j ACCEPT
iptables -I INPUT -p udp --dport 27000:29999 -m length --length 0:32 -j DROP
-N logattacker
-A logattacker -j LOG --log-prefix " SRCDS:ATTACK: " --log-ip-options
-A logattacker -j DROP
-A INPUT -p udp -m udp -m limit -m length --dport 27000:29999 --limit 2/second -j logattacker --length 0:32
Ещё на одном из форумов посоветовали:
Код: Выделить всё
iptables -A INPUT -p udp -m udp --dport 27015 -m conntrack --ctstate NEW -m length --length 30:256 -m hashlimit --hashlimit-upto 10/sec --hashlimit-burst 10 --hashlimit-mode srcip,srcport,dstip,dstport --hashlimit-name CStrike_new -j ACCEPT
iptables -A INPUT -p udp -m udp --dport 27015 -m length --length 30:1500 -m hashlimit --hashlimit-upto 101/sec --hashlimit-burst 101 --hashlimit-mode srcip,srcport,dstip,dstport --hashlimit-name CStrike_ESTABL -j ACCEPT
iptables -A INPUT -p udp -m udp --dport 27015 -j DROP