【实测】利用nginx openrestry 打造企业级waf防火墙

【实测】利用nginx openrestry 打造企业级waf防火墙
? nginx ? ? Nginx ? ? 运维 ? ? OpenResty ?    2019-09-20 01:26:56    1231    0    0

一、背景

 

二、步骤

1.安装环境依赖
yum install openssl-devel pcre-devel gcc -y ​


2.编译安装Openresty(Orange依赖)
wget https://openresty.org/download/openresty-1.11.2.3.tar.gz ##版本号可登陆网站自选
##编译安装
./configure -j2 --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module
gmake && gmake install
##默认安装目录
/usr/local/openresty
##配置环境变量
PATH=$PATH:$HOME/bin:/usr/local/openresty/bin:/usr/local/openresty/nginx/sbin
##生效
source /etc/profile​


3.编译安装lor框架(Orange依赖)

 ​

git clone https://github.com/sumory/lor.git
cd lor && make install
##默认安装目录为:/usr/local/lor
##可执行文件:/usr/local/bin/lord​


    

4.安装Orange

 ​

git clone https://github.com/sumory/orange.git
cd orange && make install
##netstat -tlunp 查看9999端口是否开启
通过http://xxx:9999/访问​


在这里插入图片描述


5.开启账号/密码访问

 ​

##auth false改成true
"auth": true
#重启orange即可
orange restart​


在这里插入图片描述


6.安装waf插件

 ​

git clone https://github.com/unixhot/waf.git
cd waf/waf && ls
access.lua config.lua init.lua lib.lua rule-config
##/usr/local/openresty/nginx/conf/nginx.conf 添加如下配置,如下图
lua_shared_dict limit 50m; 
lua_package_path "/usr/local/openresty/nginx/conf/waf/?.lua"; 
init_by_lua_file "/usr/local/openresty/nginx/conf/waf/init.lua"; 
access_by_lua_file "/usr/local/openresty/nginx/conf/waf/access.lua";
 ​

在这里插入图片描述


##由以上配置可知,waf配置路径位于/usr/local/openresty/nginx/conf/waf/
cd waf/waf/ && cp * /usr/local/openresty/nginx/conf/waf/
##将配置拷贝到相应目录​


7.重启orange

 ​

orange restart​


在这里插入图片描述


参考链接:https://blog.csdn.net/qq_33633013/article/details/83654892

上一篇: WINDOWS 共享断开会话,凭据管理器删除会话记录

下一篇: 常见问题珍藏-涵盖多个领域:shell python devpos

梅志克斯,Zabbix,Matrix,nginx,linux运维,Docker,菜鸟学习linux
1231 人读过
comments powered by Disqus
文档导航