All pastes #19898 Raw Edit

Something

public shellscript v1 · immutable
#19898 ·published 2005-08-12 17:28 UTC
rendered paste body
iptables -N invalid_http; iptables -I INPUT -p tcp --dport 80 -mstate --state NEW -j invalid_http; while true; do for i in `tail -n 50  /usr/local/apache/logs/error_log|grep Invalid.method |cut -d\  -f 1 |sort |uniq `; do iptables -nL invalid_http |grep -q $i || (iptables -I invalid_http -s $i -p tcp --dport 80 -j REJECT --reject-with tcp-reset; echo $i added); done; sleep 1; donethe field position might be off.  Handy for blocking the new type of http flood that sends invalid requests.(added state check cause the server bogs after about 12,000 rules)