利用GFW来防止DDOS攻击

It’s a easy way to protect your website.
这是一个非常简单的方法来保护你的网站
But it will block any request from China.
但是它将屏蔽所有来自中国的访问请求
So please remove it after the attack.
所以在攻击停止以后请删除它

在网站程序中加入以下这段代码。

<?php
if(strpos($_SERVER[‘REQUEST_URI’],’minghui’) === false) {
header(‘Location:’. $_SERVER[‘REQUEST_URI’] . ‘?minghui’);
exit;
}
?>

If you are in China, you can visit http://vii.im/gfw-test.php to test。
如果你在中国,你可以访问http://vii.im/gfw-test.php来测试效果。

 

http://www.fuwuqiweihu.com/use-gfw-stop-ddos-from-china/

(D)DoS Deflate

(D)DoS Deflate is a lightweight bash shell script designed to assist in the process of blocking a denial of service attack. It utilizes the command below to create a list of IP addresses connected to the server, along with their total number of connections. It is one of the simplest and easiest to install solutions at the software level.

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

IP addresses with over a pre-configured number of connections are automatically blocked in the server’s firewall, which can be direct iptables or Advanced Policy Firewall (APF). (We highly recommend that you use APF on your server in general, but deflate will work without it.)

Notable Features

  • It is possible to whitelist IP addresses, via /usr/local/ddos/ignore.ip.list.
  • Simple configuration file: /usr/local/ddos/ddos.conf
  • IP addresses are automatically unblocked after a preconfigured time limit (default: 600 seconds)
  • The script can run at a chosen frequency via the configuration file (default: 1 minute)
  • You can receive email alerts when IP addresses are blocked.

Installation

wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh

Uninstallation

wget http://www.inetbase.com/scripts/ddos/uninstall.ddos
chmod 0700 uninstall.ddos
./uninstall.ddos

Questions?

Although most things are explained on this page, if you have any further questions, you may contact the original developer of the script, Zaf.

 

http://deflate.medialayer.com/