老谢博客

  • 首页
  • WordPress
  • 网络技术
  • 乱七八糟
  • 运维技术
  • 给我留言
  • 关于老谢

(D)DoS Deflate 防御简单DDOS攻击

分类:运维技术日期:2012-02-23 - 11:03:23作者:老谢

前言:

互联网如同现实社会一样充满钩心斗角,网站被DDOS也成为站长最头疼的事。在没有硬防的情况下,寻找软件代替是最直接的方法,比如用iptables,但是iptables不能在自动屏蔽,只能手动屏蔽。今天要说的就是一款能够自动屏蔽DDOS攻击者IP的软件:DDoS Deflate。

(D)Dos官方地址:http://deflate.medialayer.com/

(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.

Installation

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

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

安装完以后,你会看到一大篇协议,按q退出即可 :)

文件说明:

ddos.conf — DDoS-Deflate 的配置文件,其中配置防止ddos时的各种行为
ddos.sh — DDoS-Deflate 的主程序,使用shell编写的,整个程序的功能模块
ignore.ip.list — 白名单,该文件中的ip超过设定的连接数时,也不被 DDoS-Deflate 阻止
LICENSE — DDoS-Deflate 程序的发布协议

配置 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
 
##### 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
 
##### An email is sent to the following address when an IP is banned.   # 当单IP发起的连接数超过阀值后,将发邮件给指定的收件人.
##### Blank would suppress sending of mails
EMAIL_TO="root"
 
##### Number of seconds the banned ip should remain in blacklist.   # 设置被挡IP多少秒后移出黑名单.
BAN_PERIOD=600

##### 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 ##### An email is sent to the following address when an IP is banned. # 当单IP发起的连接数超过阀值后,将发邮件给指定的收件人. ##### Blank would suppress sending of mails EMAIL_TO="root" ##### Number of seconds the banned ip should remain in blacklist. # 设置被挡IP多少秒后移出黑名单. BAN_PERIOD=600

编辑/usr/local/ddos/ddos.sh

找到#echo $CURR_LINE_IP >> $IGNORE_IP_LIST,取消注释

找到netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -nr > $BAD_IP_LIST,注释掉,换成netstat -ntu | awk ‘{print $5}’ | egrep -o “[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}” | sort | uniq -c | sort -nr > $BAD_IP_LIST

模拟测试:

(D)DoS Deflate 防御简单DDOS攻击

卸载

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

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

原文地址 : https://www.xj123.info/2549.html

本站遵循 : 署名-非商业性使用-相同方式共享 2.5 中国大陆 (CC BY-NC-SA 2.5)

版权声明 : 原创文章转载时,请务必以超链接形式标明文章原始出处

Tags: DDOS , vps 安全
  • 上一篇:让cmd也能查询whois和ip信息
  • 下一篇:Nginx的启动、停止、平滑重启
17条评论
  1. 软件盒子 说:

    此非常实用

    POST:2012-02-23 15:28 回复
  2. 亨sir 说:

    果然够专业哦

    POST:2012-02-23 17:24 回复
  3. suN 说:

    不知道..

    POST:2012-02-23 17:36 回复
  4. 宁波网络推广 说:

    真是管用啊。。。。谢谢博主的分享啊

    POST:2012-02-23 20:36 回复
  5. 鳳梨果凍 说:

    看不懂。。。鴨梨山大啊= =。。。

    POST:2012-02-23 21:23 回复
    • 老谢 说:

      @鳳梨果凍 偶也是现学现卖

      POST:2012-02-24 22:53 回复
  6. 睡着的水 说:

    总是有些无聊人的攻击别人玩啊

    POST:2012-02-24 11:14 回复
    • 老谢 说:

      @睡着的水 无聊的人是蛮多

      POST:2012-02-24 22:54 回复
  7. 自贡SEO 说:

    大师级别的人物。

    POST:2012-02-24 14:46 回复
  8. 大D 说:

    YM专业人士。

    POST:2012-02-24 21:19 回复
    • 老谢 说:

      @大D 果断反YM

      POST:2012-02-24 22:52 回复
  9. SEO博客 说:

    VPS麻烦啊

    POST:2012-02-24 22:42 回复
    • 老谢 说:

      @SEO博客 爱折腾就好~

      POST:2012-02-24 22:51 回复
  10. VPS ROLL 说:

    嘿嘿,受教了。。去安装试试。

    POST:2012-02-26 09:18 回复
  11. zch0071 说:

    我安装后 运行 出现

    ./ddos.sh: 13: [: /usr/local/ddos/ddos.conf: unexpected operator
    DDoS-Deflate version 0.6
    Copyright (C) 2005, Zaf

    $CONF not found.

    POST:2012-06-06 15:19 回复
    • smartweb 说:

      /usr/local/ddos/ddos.conf
      第一行改为
      #!/bin/bash

      POST:2013-12-16 20:53 回复
  12. 鱼里别放刺 说:

    多谢楼主,解决了我看不到攻击者IP地址的问题。

    POST:2014-04-17 13:08 回复
发表评论 点击取消评论.

*必填

*必填

  • 文章归档
  • 子网计算
  • 我的共享
  • 锻炼计划
  • 给我留言
  • 关于老谢
2023年 4月
一 二 三 四 五 六 日
 12
3456789
10111213141516
17181920212223
24252627282930
« 10月    

最新文章

  • 2021好久没更新博客
  • Zabbix监控oxidized备份状态
  • Zabbix 5.0 LTS版本MySQL表分区及编译安装随记
  • centos7.9部署oxidized自动备份交换机配置
  • Surface Pro 4更换屏幕与电池
  • VCSA中删除horizon view链接克隆生成的replica-受保护副本
  • Esxi6.7U3安装SanDisk Fusion-io 1.3T ioscale Pci SSD加速卡驱动
  • 搭建ELK日志系统分析处理fortigate的syslog日志
  • 华为USG防火墙配置NAT映射回流解决内网通过公网映射访问内部服务器
  • 飞塔防火墙fortitoken配置

最新评论

  • 无敌风火轮:和索尼没啥关系,这是索尼电脑的...
  • zhudong:老大,有VMware Horizon 7.12相关资...
  • qx:所有连接失效了,求一份
  • RainH:大佬,这个111.111.111.111是什么鬼?...
  • 王叨叨:幸福的人都是相似的,不幸的人各有各...
  • 李海博客:李海博客前来学习!
  • 明月登楼:最近使用了ZeroSSL证书,感觉还不...
  • 鸟叔:尽管不知道干啥的,还是来顶一下
  • 鸟叔:鸟叔来贵博客参观学习,通过十年之约穿...
  • 周良粥凉:往前看。

日志存档

  • 2021年10月
  • 2021年4月
  • 2021年3月
  • 2021年2月
  • 2020年11月
  • 2020年9月
  • 2020年5月
  • 2020年4月
  • 2020年3月
  • 2020年1月
  • 2019年12月
  • 2019年10月
  • 2019年7月
  • 2019年6月
  • 2019年5月
  • 2019年3月
  • 2019年1月
  • 2018年12月
  • 2018年11月
  • 2018年10月
  • 2018年7月
  • 2018年6月
  • 2018年5月
  • 2018年4月
  • 2018年3月
  • 2018年1月
  • 2017年10月
  • 2017年9月
  • 2017年8月
  • 2017年7月
  • 2017年2月
  • 2017年1月
  • 2016年12月
  • 2016年11月
  • 2016年10月
  • 2016年7月
  • 2016年6月
  • 2016年4月
  • 2016年2月
  • 2016年1月
  • 2015年12月
  • 2015年10月
  • 2015年9月
  • 2015年7月
  • 2015年5月
  • 2015年4月
  • 2015年3月
  • 2015年2月
  • 2015年1月
  • 2014年12月
  • 2014年10月
  • 2014年9月
  • 2014年8月
  • 2014年7月
  • 2014年6月
  • 2014年5月
  • 2014年4月
  • 2014年3月
  • 2014年2月
  • 2014年1月
  • 2013年12月
  • 2013年11月
  • 2013年10月
  • 2013年9月
  • 2013年8月
  • 2013年7月
  • 2013年6月
  • 2013年5月
  • 2013年4月
  • 2013年3月
  • 2013年2月
  • 2013年1月
  • 2012年12月
  • 2012年11月
  • 2012年9月
  • 2012年8月
  • 2012年7月
  • 2012年6月
  • 2012年5月
  • 2012年4月
  • 2012年3月
  • 2012年2月
  • 2012年1月
  • 2011年12月
  • 2011年11月
  • 2011年10月
  • 2011年9月
  • 2011年8月
  • 2011年7月
  • 2011年6月
  • 2011年5月
  • 2011年4月
  • 2011年3月
  • 2011年2月
  • 2011年1月
  • 2010年12月
  • 2010年11月
  • 2010年10月
  • 2010年9月
  • 2010年8月
  • 2010年7月

W3C

  • XHTML 1.0 Transitional
  • CSS level 3
  • Google+
Copyright © 2010-2023 老谢博客 All rights reserved.
Gzipped 76.5% | Optimized loading 62 queries in 0.290 seconds | Memory 33.57 MB | 皖ICP备13010663号-1
Powered by WordPress. | Hosted By 腾讯云 | Theme by WordPress主题巴士 | 站点地图 | SiteMap | Uptime | 技术支持:苏州天剑计算机系统有限公司