• CentOS 7下安装Slowhttptest DDoS检测工具


    Slowhttptest是依赖HTTP协议的慢速攻击DoS攻击工具,设计的基本原理是服务器在请求完全接收后才会进行处理,如果客户端的发送速度缓慢或者发送不完整,服务端为其保留连接资源池占用,大量此类请求并发将导致DoS。安装Slowhttptest需要依赖以下组件,可按照以下步骤来进行(如果组件已经安装,可以跳过):

    一、安装libssl-dev

    # yum install openssl openssl-devel
    

      

    二、安装C++编译器

    # yum install gcc-c++
    

    如果未安装C++编译器,在linux下执行 ./configure 时,会报如下错误:

    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking for g++... no
    checking for c++... no
    checking for gpp... no
    checking for aCC... no
    checking for CC... no
    checking for cxx... no
    checking for cc++... no
    checking for cl... no
    checking for FCC... no
    checking for KCC... no
    checking for RCC... no
    checking for xlC_r... no
    checking for xlC... no
    checking for C++ compiler default output file name... configure: error: C++ compiler cannot create executables
    See `config.log' for more details.
    

      

    三、安装m4、autoconf、perl和automake

    方法一:通过yum直接安装(本例中automake是通过下载包进行安装,原因为通过yum中的版本1.13较低,而安装slowhttptest需要automake-1.16版本)

    # yum install m4
    # yum install autoconf
    # yum install perl
    # yum install automake 
    

    执行上述命令会分别通过yum安装m4-1.4.18,autoconf-2.69,perl-5.16.3,automake-1.13。
    注意:需要按照顺序进行安装,因为automake依赖于m4,autoconf和perl,autoconf依赖于m4。

    方法二:通过直接下载包文件进行安装(m4、autoconf和automake是GNU中的开源软件,本例中automake安装在/usr/local/下)

    //安装路径
    # cd /usr/local/
    
    //安m4-1.4.18
    # wget http://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz
    # tar -zxvf m4-1.4.18.tar.gz
    # cd m4-1.4.18/
    # ./configure
    # make
    # make install
    # cd ..
    
    //安装autoconf-2.69
    # wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
    # tar -zxvf autoconf-2.69.tar.gz
    # cd autoconf-2.69/
    # ./configure
    # make
    # make install
    # cd ..
    
    //安装automake-1.16.1
    # wget http://ftp.gnu.org/gnu/automake/automake-1.16.1.tar.gz
    # tar -xvf automake-1.16.1.tar.gz
    # cd automake-1.16.1/
    # ./configure --prefix=/usr/  //本例实际过程中添加了--prefix=/usr/
    # make
    # make install
    

    直接下载包文件进行安装时遇到的一些问题和解决方法:

    问题1:执行./configure时提示“没有权限”。

    解决方法:可以用以下命令解决。

    # chmod -R 777 ./
    

      

    问题2:安装automake-1.16在make失败,提示–no-discard-stderr。

    解决方法:修改automake-1.16文件夹下Makefile源代码第3694行,在其后增加–no-discard-stderr:

    #3694行  automake-$(APIVERSION) --no-discard-stderr
    

      

    问题3:安装automake-1.16后,后续对slowhttptest执行make操作时仍然提示missing automake-1.16 –foreign
    解决方法:建议安装automake-1.16.1

    四、安装Slowhttptest
    Slowhttptest的代码托管在https://github.com/shekyan/slowhttptest,需要下载解压后从源码编译安装。

    # cd /usr/local/slowhttptest
    # ./configure --prefix=/usr/  //本例实际过程中添加了--prefix=/usr/
    # sudo autoreconf -ivf  //这句很关键,就是这一句解决了问题
    # make
    # make install
    

    如果在make的时候提示“missing automake-1.16”或“aclocal-1.16: 未找到命令”,是因为缺少缺少automake组件造成的。aclocal是automake中的一部分。请检查上面的组件安装是否完整。

    至此,Slowhttptest安装成功。

    五、运行Slowhttptest

    //slowloris模式:
    # slowhttptest -c 1000 -H -g -o my_header_stats -i 10 -r 200 -t GET -u https://host.example.com/index.html -x 24 -p 3
    
    //slow post模式:
    # slowhttptest -c 3000 -B -g -o my_body_stats -i 110 -r 200 -s 8192 -t FAKEVERB -u http://host.example.com/loginform.html -x 10 -p 3
    
    //slow read模式:
    # slowhttptest -c 8000 -X -r 200 -w 512 -y 1024 -n 5 -z 32 -k 3 -u https://host.example.com/resources/index.html -p 3
    

      

    六、其他
    如果安装的组件版本不正确,建议卸载,并进行清理(删除对应文件夹)。一些常用的命令如下:

    # m4 --version                          //查看m4的版本
    # autoconf --version                    //查看autoconf的版本
    # perl --version                        //查看perl的版本
    # aclocal --version                     //查看aclocal(automake)的版本
    # rpm -qa |grep automake                //查看automake的安装情况
    # rpm -ql automake-1.13.4-3.el7.noarch  //查看automake的安装路径
    # yum list installed |grep automake     //查看通过yum安装的automake信息
    # yum -y remove automake.noarch         //通过yum删除已安装的automake
    # make uninstall                        //在make install文件夹中通过uninstall卸载已安装的内容。
    

      

    参考页面:

    1.https://blog.csdn.net/m0_38016951/article/details/81195377
    2.https://www.landui.com/help/show-4482.html
    3.https://www.cnblogs.com/softidea/p/3328572.html
    4.https://jingyan.baidu.com/article/8275fc8691d01a46a03cf6a5.html?qq-pf-to=pcqq.c2c
    5.https://www.cnblogs.com/huanghuang/archive/2012/12/13/2816741.html
    6.https://bbs.csdn.net/topics/370153679
    7.https://blog.csdn.net/developerof/article/details/88206384
    8.https://blog.csdn.net/oWuMingXiaoBei1/article/details/89167140
    9.https://blog.csdn.net/qq_39869935/article/details/77248515
    10.https://www.cnblogs.com/shenlinken/p/7400336.html
    11.https://blog.csdn.net/DXZCZH/article/details/88374476
    12.https://www.jianshu.com/p/5ec96f76e25b
    13.https://www.itdaan.com/keywords/slowhttptest安装及使用.html
    14.https://blog.csdn.net/adamlinsfz/article/details/84307097
    15.https://blog.csdn.net/liyyzz33/article/details/89402504

  • 相关阅读:
    static,匿名对象
    构造方法
    面向对象
    数组拷贝,可变参数,foreach
    毕业设计 之 七 参考文献综述
    毕业设计 之 六 网站搭建学习笔记
    毕业设计 之 五 PHP语法学习笔记
    毕业设计 之 四 英文资料翻译
    毕业设计 之 三 mooodle及bigbluebutton使用笔记(未完成)
    毕业设计 之 二 PHP集成环境(Dreamweaver)使用
  • 原文地址:https://www.cnblogs.com/yangjisen/p/12456152.html
Copyright © 2020-2023  润新知