Tengine waf,tenginewaf


https://github.com/lanzsec/tengine_waf/blob/master/README.md?from=timeline

tengine version 2.1.1

测试环境  192.168.1.135

其实就用到几个文件而已。

1 确认tenginx 初始化安装时是否编译了lua模块,没有的话可动态编译加载 

/usr/local/nginx/sbin/nginx  -m

ngx_http_lua_module (shared, 3.1)  动态加载的

ngx_http_copy_filter_module (static) 

ngx_http_range_body_filter_module (static)

2 vi nginx.conf   添加

       lua_need_request_body on;

        lua_package_path "/usr/local/nginx/conf/?.lua";

        lua_shared_dict limit 500m;

        lua_shared_dict blockiplimit 10m;

        init_by_lua_file  /usr/local/nginx/conf/init.lua;

wafconf 目录 和3个lua文件  cp到/usr/local/nginx/conf下

规则目录为tengine/conf/wafconf/,提供了多维度的web防护策略,有以下几个文件:

user-agent      匹配拦截恶意的user-agent
url             匹配拦截恶意的网页路径
args			  匹配拦截恶意的GET请求参数
post            匹配拦截恶意的post请求参数
cookie          匹配拦截恶意的cookie 请求
whitetip         ip白名单
whiteurl         网页路径白名单
blockip          ip黑名单

 

[zhangshaohua1510@192 conf]$ ll *.lua

-rw-r--r-- 1 root root 2329 4月  17 17:38 config.lua   路径作相应的修改

-rw-r--r-- 1 root root 9304 4月  17 16:29 init.lua

-rw-r--r-- 1 root root 2192 4月  17 16:29 waf.lua

4 vi vhosts/product.conf

location 里加一条

access_by_lua_file /usr/local/nginx/conf/waf.lua;

5 /usr/local/nginx/sbin/nginx  -t

相关内容

    暂无相关文章