安装DDoS deflate防止VPS被DDOS攻击
在我们配置好一台VPS服务器后,很多人都会觉得没必要再去配置什么了,觉得是安全的了。其实是不对的,我们最基本的一个问题就是要小心不要被DDOS攻击了,因为那样容易被商家封号。
所以我们就要通过软件来预防DDOS攻击,DDoS deflate的原理就是如果某个IP再短时间内突然大量的访问你的IP的话,就认定它是在DDoS攻击。
1、安装方法:
wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh
这时候你会看到一大堆英文,不用理它,直接按q退出就行。
2、登录FTP,找到目录:/usr/local/ddos/
编辑ddos.conf文件;
(下一文字是ddos.conf文件的中文说明,其他的不用管,只要看我加黑的部分就可以了,编辑完后,再通过FTP上传回去即可)
##### 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
##### How many connections define a bad IP? Indicate that below.
# 单IP发起连接数阀值,不建议设置太低.
NO_OF_CONNECTIONS=150
##### APF_BAN=1 (Make sure your APF version is atleast 0.96)
##### APF_BAN=0 (Uses iptables for banning ips instead of APF)
#一般情况下你是使用iptables来做防火墙,所以这里你需要将 APF_BAN的值改为0.
APF_BAN=1
##### 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.
# 当单IP发起的连接数超过阀值后,将发邮件给指定的收件人.
##### Blank would suppress sending of mails
EMAIL_TO=”root”
# 这里是邮箱,可以把root替换成你的邮箱
##### Number of seconds the banned ip should remain in blacklist.
# 设置被挡IP多少秒后移出黑名单.
BAN_PERIOD=600
3.安装好后再安装一下iptables 即可, 安装方法
yum install iptables
Ps:DDoS deflate是全自动运行,安装好后就不用管它了。
——————————————小小的分割线——————————————
/usr/local/ddos/下面还有一个ignore.ip.list文件,那个是白名单设置文件。
可以把自己的IP添加进去,我们可以手工添加ignore.ip.list里面的白名单 ip,然后强制不允许修改
chattr +i /usr/local/ddos/ignore.ip.list //强制不允许修改
chattr -i /usr/local/ddos/ignore.ip.list //解除不允许修改
©版权声明:本文为【威武中国】(V5CHINA.COM)原创文章,转载时请注明出处!
>>原文链接地址: https://www.v5china.com/install-ddos-deflate-to-prevent-vps-from-being-attacked-by-ddos.html