Guest User

Untitled

a guest
May 22nd, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. iptables -F
  4.  
  5. # Call of Duty DDoS Fix
  6.  
  7. iptables -A OUTPUT -p UDP -m length --length 1162:1168 -j DROP
  8. iptables -A FORWARD -p UDP -m length --length 1162:1168 -j DROP
  9. iptables -A INPUT -p UDP -m length --length 1162:1168 -j DROP
  10. iptables -A INPUT -p UDP -m length --length 42 -m recent --set --name getstatus_cod
  11. iptables -A INPUT -p UDP -m string --algo bm --string "getstatus" -m recent --update --seconds 1 --hitcount 20 --name getstatus_cod -j DROP
  12.  
  13. # Quake 3+4 DDoS Fix
  14.  
  15. iptables -N quake3_ddos
  16. # accept real client/player traffic
  17.  
  18. iptables -A quake3_ddos -m u32 ! --u32 "0x1c=0xffffffff" -j ACCEPT
  19.  
  20. # match "getstatus" queries and remember their address
  21. iptables -A quake3_ddos -m u32 --u32 "0x20=0x67657473&&0x24=0x74617475&&0x25&0xff=0x73" -m recent --name getstatus --set
  22.  
  23. # drop packet if "hits" per "seconds" is reached
  24. #
  25. # NOTE: if you run multiple servers on a single host, you will need to higher these limits
  26. # as otherwise you will block regular server queries, like Spider or QConnect
  27. # e.g. they will query all of your servers within a second to update the list
  28. iptables -A quake3_ddos -m recent --update --name getstatus --hitcount 10 --seconds 3 -j DROP
  29.  
  30. iptables -A quake3_ddos -j ACCEPT
  31. iptables -I INPUT 1 -p udp -j quake3_ddos
  32.  
  33. iptables -L -n
  34.  
  35. exit 0
Advertisement
Add Comment
Please, Sign In to add comment