互聯網是豐富多彩的,基本上能夠找到我們需要的資源,也正因為如此很多朋友都加入到站長的行列中來。在眾多站長之間也會存在明爭暗斗的事情。尤其是我們個人站長,由于技術和財力有限,好不容易使用上主機、VPS后被攻擊沒有能力防御,導致我們的主機或者VPS商給我們的賬戶暫停,IP掛起等。尤其是我們在使用的VPS主機中,因為是按照流量消費的,在耗盡我們的流量,遭遇大量的DDOS攻擊之后,也束手無策,包括老左也看到之前也遭遇到DDOS攻擊。
在遇到這些問題的時候,我們是否能在VPS設置中進行處理呢?哪怕是一點點的防御。看到DDOS deflate腳本是可以協助VPS阻止攻擊進程的,如果遇到來自某個IP的持續攻擊,可以給該IP自動的設置成IP黑名單。只能說可以給我們的VPS一點點防御。
第一步,安裝。
1
2
3
|
wget http://myvps-scripts.googlecode.com/files/deflate.sh chmod +x deflate.sh ./deflate.sh |
第二步,配置/usr/local/ddos/ddos.conf文件。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
##### 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" 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. 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) APF_BAN=0 ##### KILL=0 (Bad IPs are'nt banned, good for interactive execution of script) ##### KILL=1 (Recommended setting) KILL=1 ##### An email is sent to the following address when an IP is banned. ##### Blank would suppress sending of mails EMAIL_TO="root" ##### Number of seconds the banned ip should remain in blacklist. BAN_PERIOD=600 |
標示說明:
NO_OF_CONNECTIONS=150#最大連接數,超過會被屏蔽,默認即可
APF_BAN #默認是1,建議使用0,標示iptables限制
EMAIL_TO="" 填寫郵箱賬號,到時候有信息會發送到我們郵箱中
BAN_PERIOD=600 代表限制該IP 600秒