怎样配置DDoS deflate

栏目: 编程工具 · 发布时间: 6年前

下载: http://www.inetbase.com/scripts/ddos/

DDoS deflate 工作原理

每分钟检测一次IP连接状况,当某些IP连接超过配置脚本限制的连接数,程序会自动禁止这些IP一段时间,以达到防御攻击的目的

DDoS deflate官方网站: http://deflate.medialayer.com/

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

检查是否遭到ddos攻击命令

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

DDoS deflate的默认配置位于/usr/local/ddos/ddos.conf ,内容如下:

##### Paths of the script and other files

PROGDIR=”/usr/local/ddos”

PROG=”/usr/local/ddos/ddos.sh”

IGNORE_IP_LIST=”/usr/local/ddos/ignore.ip.list” //IP地址白名单

CRON=”/etc/cron.d/ddos.cron” //定时执行程序

APF=”/etc/apf/apf”

IPT=”/sbin/iptables”

##### frequency in minutes for running the script

##### Caution: Every time this setting is changed, run the script with –cron

##### option so that the new frequency takes effect

FREQ=1 //检查时间间隔,默认1分钟

##### How many connections define a bad IP? Indicate that below.

NO_OF_CONNECTIONS=150 //最大连接数,超过这个数IP就会被屏蔽,一般默认即可

##### APF_BAN=1 (Make sure your APF version is atleast 0.96)

##### APF_BAN=0 (Uses iptables for banning ips instead of APF)

APF_BAN=1 //使用APF还是iptables。推荐使用iptables,将APF_BAN的值改为0即可。

##### KILL=0 (Bad IPs are’nt banned, good for interactive execution of script)

##### KILL=1 (Recommended setting)

KILL=1 //是否屏蔽IP,默认即可

##### An email is sent to the following address when an IP is banned.

##### Blank would suppress sending of mails

EMAIL_TO=”root” //当IP被屏蔽时给指定邮箱发送邮件,推荐使用,换成自己的邮箱即可

##### Number of seconds the banned ip should remain in blacklist.

BAN_PERIOD=600 //禁用IP时间,默认600秒,可根据情况调整

试用了一会,感觉还不错,比我以前用的分析nginx日志封IP的脚本要好些,假如几个虚拟主机使用不同的网站日志,就必须运行几个分析日志的脚本,

这个脚本就用一个就可以把整个服务器保护起来了。但这个也存在一些问题,刚开始的时候把 mysql 服务器给封掉了,搞的我手忙脚乱的解封,

然后把mysql服务器IP添加白名单,谁知过会他过了段时间又把白名单删除了,又给mysql服务器封了,不得以卸载了一次。

研究了一下代码才发现,他禁止的IP也添加到白名单里,然后解封的时候通过tmp目录里的unban.xxxxx文件将白名单里禁止的IP再删除,

这样这个IP就不再受保护。所以我把mysql服务器IP添加白名单之后程序根据这个BAN_PERIOD=600 参数在10分钟后删除,所以就出现了你恢复他继续封的怪圈,白名单设置文件应该和禁止解禁这个IP记录文件分开就好了。

使用心得:

安装后第一时间要将白名单设置好,最好观察一段时间看是不是正常,以免一些和服务器需要保持连接的IP被封,比如mysql服务器,rsync备份服务器等等,这些机器往往都需要和网站服务器保持大量连接


以上所述就是小编给大家介绍的《怎样配置DDoS deflate》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Dynamic Programming

Dynamic Programming

Richard Bellman / Dover Publications / 2003-03-04 / USD 19.95

An introduction to the mathematical theory of multistage decision processes, this text takes a "functional equation" approach to the discovery of optimum policies. The text examines existence and uniq......一起来看看 《Dynamic Programming》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

在线进制转换器
在线进制转换器

各进制数互转换器

MD5 加密
MD5 加密

MD5 加密工具