使用naxsi

naxsi简介

naxsi 是一个nginx 防病毒,防跨站,sql 注入的一个模块。nginx的一个waf ,应用防火墙。非常好配置。

naxsi 安装

naxsi 在debina/ubuntu 上是直接被支持的,也就是说你只需要 apt-get 即可。

apt-get install nginx-naxsi  
centos 系统 

naxsi 原理

naxsi 会根据规则来检查get ,post 请求,http 的请求头。

naxsi 使用,配置

1 。加入naxsi 规则

include /etc/nginx/naxsi_core.rules;
2. 在虚拟主机中加入配置,加在location 中
LearningMode;
SecRulesEnabled;
DeniedUrl "/RequestDenied";

include "/etc/nginx/mynaxsi.rules";

## check rules
CheckRule "$SQL >= 8" BLOCK;
CheckRule "$RFI >= 8" BLOCK;
CheckRule "$TRAVERSAL >= 4" BLOCK;
CheckRule "$EVADE >= 4" BLOCK;
CheckRule "$XSS >= 8" BLOCK;

LearningMode 学习模式,规则匹配到的请求不会被屏蔽,而是放在白名单里面。

SecRulesEnabled 规则启用,如果想关闭的话把他改成SecRulesDisabled 即可。

DeniedURL  url 被屏蔽以后返回的地址。默认是在/RequestDenied下。

CheckRule check的规则

 

naxsi 原理

naxsi 会根据规则来检查get ,post 请求,http 的请求头。

 
posted @ 2014-10-29 17:30  过去的我  阅读(2681)  评论(0编辑  收藏  举报