技术头条 - 一个快速在微博传播文章的方式     搜索本站
您现在的位置首页 --> 安全 --> nginx防hashdos模块释出

nginx防hashdos模块释出

浏览:1786次  出处信息

     hashdos这个事,严格意义上不是各种语言的错了(不过perl的确处理得很好)。

     借鉴tomcat的作法,实现了下面这个nginx-http-hashdos-module,通过设置hashdos(默认on)的开关和body_max_count(默认值1000),对nginx后面的服务进行安全防护,相比对php或者java进行patch,这或许是最好的办法了。

    nginx-http-hashdos-module项目地址

     https://github.com/54chen/nginx-http-hashdos-module

    如何使用

     1.下载zip后保存到一个目录,如~/nginx-http-hashdos-module。

     2.cd nginx-1.0.9/

     3.重新编译和安装nginx

     ./configure --prefix=/opt/soft/nginx --with-pcre --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-debug --add-module=/path_to/nginx-http-hashdos-module/ && make && make install

     4.配置打开:

     hashdos on;

     body_max_count 1000;

     location ~ \.php$ {

     fastcgi_pass 127.0.0.1:9000;

     fastcgi_index index.php;

     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

     include /opt/soft/nginx/conf/fastcgi_params;

     client_body_buffer_size 2m;

     client_max_body_size 2m;

     }

    注意事项

     因为计算参数都在内存中进行,所以client_body_buffer_size 与 client_max_body_size 的值一定要相等。推荐2m。

    TODO

     改进in-file时的post分析。

    https://github.com/54chen/nginx-http-hashdos-module

建议继续学习:

  1. nginx防hashdos模块使用帮助    (阅读:2152)
  2. Hash Collision DoS 问题    (阅读:1823)
QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习
<< 前一篇:密码安全策略
© 2009 - 2024 by blogread.cn 微博:@IT技术博客大学习

京ICP备15002552号-1