Giter VIP home page Giter VIP logo

waf's Introduction

WAF

  • 使用Nginx+Lua实现自定义WAF(Web application firewall)
  • 最近发现使用的人越来越多了,计划开始维护和增加新功能 2020.7.29 赵班长

项目背景介绍

需求产生

由于原生态的Nginx的一些安全防护功能有限,就研究能不能自己编写一个WAF,参考Kindle大神的ngx_lua_waf,自己尝试写一个了,使用两天时间,边学Lua,边写。不过不是安全专业,只实现了一些比较简单的功能:

功能列表:

  1. 支持IP白名单和黑名单功能,直接将黑名单的IP访问拒绝。
  2. 支持URL白名单,将不需要过滤的URL进行定义。
  3. 支持User-Agent的过滤,匹配自定义规则中的条目,然后进行处理(返回403)。
  4. 支持CC攻击防护,单个URL指定时间的访问次数,超过设定值,直接返回403。
  5. 支持Cookie过滤,匹配自定义规则中的条目,然后进行处理(返回403)。
  6. 支持URL过滤,匹配自定义规则中的条目,如果用户请求的URL包含这些,返回403。
  7. 支持URL参数过滤,原理同上。
  8. 支持日志记录,将所有拒绝的操作,记录到日志中去。
  9. 日志记录为JSON格式,便于日志分析,例如使用ELK进行攻击日志收集、存储、搜索和展示。

WAF实现

WAF一句话描述,就是解析HTTP请求(协议解析模块),规则检测(规则模块),做不同的防御动作(动作模块),并将防御过程(日志模块)记录下来。所以本文中的WAF的实现由五个模块(配置模块、协议解析模块、规则模块、动作模块、错误处理模块)组成。

安装部署

以下方案选择其中之一即可:

  • 选择1: 可以选择使用原生的Nginx,增加Lua模块实现部署。
  • 选择2: 直接使用OpenResty

OpenResty安装

1 Yum安装OpenResty(推荐)

源码安装和Yum安装选择其一即可,默认均安装在/usr/local/openresty目录下。

[root@opsany ~]# wget https://openresty.org/package/centos/openresty.repo
[root@opsany ~]# sudo mv openresty.repo /etc/yum.repos.d/
[root@opsany ~]# sudo yum install -y openresty
  1. 测试OpenResty和运行Lua
[root@opsany ~]# vim /usr/local/openresty/nginx/conf/nginx.conf
#在默认的server配置中增加
        location /hello {
            default_type text/html;
            content_by_lua_block {
                ngx.say("<p>hello, world</p>")
            }
        }
[root@opsany ~]# /usr/local/openresty/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/openresty-1.17.8.2/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/openresty-1.17.8.2/nginx/conf/nginx.conf test is successful
[root@opsany ~]# /usr/local/openresty/nginx/sbin/nginx
  1. 测试访问
[root@opsany ~]# curl http://127.0.0.1/hello
<p>hello, world</p>

WAF部署

[root@opsany ~]# git clone https://github.com/unixhot/waf.git
[root@opsany ~]# cp -r ./waf/waf /usr/local/openresty/nginx/conf/
[root@opsany ~]# vim /usr/local/openresty/nginx/conf/nginx.conf
#在http{}中增加,注意路径,同时WAF日志默认存放在/tmp/日期_waf.log
#WAF
    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";
[root@opsany ~]# ln -s /usr/local/openresty/lualib/resty/ /usr/local/openresty/nginx/conf/waf/resty
[root@opsany ~]# /usr/local/openresty/nginx/sbin/nginx -t
[root@opsany ~]# /usr/local/openresty/nginx/sbin/nginx -s reload

附录

Nginx + Lua源码编译部署(不推荐)

  1. Nginx安装必备的Nginx和PCRE软件包。
[root@nginx-lua ~]# cd /usr/local/src
[root@nginx-lua src]# wget http://nginx.org/download/nginx-1.12.1.tar.gz
[root@nginx-lua src]# wget https://nchc.dl.sourceforge.net/project/pcre/pcre/8.41/pcre-8.41.tar.gz
#其次,下载当前最新的luajit和ngx_devel_kit (NDK),以及春哥(章)编写的lua-nginx-module
[root@nginx-lua src]# wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz
[root@nginx-lua src]# wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz
[root@nginx-lua src]# wget wget https://github.com/chaoslawful/lua-nginx-module/archive/v0.10.10.zip
  1. 最后,创建Nginx运行的普通用户
[root@nginx-lua src]# useradd -s /sbin/nologin -M www
  1. 解压NDK和lua-nginx-module
[root@openstack-compute-node5 src]# tar zxvf v0.3.0.tar.gz
[root@openstack-compute-node5 src]# unzip -q v0.10.10.zip
  1. 安装LuaJIT Luajit是Lua即时编译器。
[root@webs-ebt src]# tar zxvf LuaJIT-2.0.5.tar.gz 
[root@webs-ebt src]# cd LuaJIT-2.0.5
[root@webs-ebt LuaJIT-2.0.5]# make && make install
  1. 安装Nginx并加载模块
[root@webs-ebt src]# tar zxf nginx-1.12.1.tar.gz
[root@webs-ebt src]# tar zxvf pcre-8.41.tar.gz 
[root@webs-ebt src]# cd nginx-1.12.1
[root@webs-ebt nginx-1.12.1]# export LUAJIT_LIB=/usr/local/lib
[root@webs-ebt nginx-1.12.1]# export LUAJIT_INC=/usr/local/include/luajit-2.0
[root@webs-ebt nginx-1.12.1]#./configure --user=www --group=www --prefix=/usr/local/nginx-1.12.1/ --with-pcre=/usr/local/src/pcre-8.41 --with-http_stub_status_module --with-http_sub_module --with-http_gzip_static_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module  --add-module=../ngx_devel_kit-0.3.0/ --add-module=../lua-nginx-module-0.10.10/
[root@webs-ebt nginx-1.12.1]# make -j2 && make install
[root@webs-ebt nginx-1.12.1]# ln -s /usr/local/nginx-1.12.1 /usr/local/nginx
[root@webs-ebt nginx-1.12.1]# ln -s /usr/local/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2

如果不创建符号链接,可能出现以下异常:

error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory
  1. 测试安装

安装完毕后,下面可以测试安装了,修改nginx.conf 增加第一个配置。

        location /hello {
                default_type 'text/plain';
                content_by_lua 'ngx.say("hello,lua")';
        }
 
[root@webs-ebt src]# /usr/local/nginx/sbin/nginx -t
[root@webs-ebt src]# /usr/local/nginx/sbin/nginx -t

然后访问http://xxx.xxx.xxx.xxx/hello 如果出现hello,lua。表示安装完成,然后就可以。

OpenResty源码编译部署(不推荐)

  1. 安装依赖软件包
[root@opsany ~]# yum install -y readline-devel pcre-devel openssl-devel
  1. 安装OpenResty

2.1 下载并编译安装OpenResty

[root@opsany ~]# cd /usr/local/src
[root@opsany src]# wget https://openresty.org/download/openresty-1.17.8.2.tar.gz
[root@opsany src]# tar zxf openresty-1.17.8.2.tar.gz
[root@opsany src]# cd openresty-1.17.8.2
[root@opsany openresty-1.17.8.2]# ./configure --prefix=/usr/local/openresty-1.17.8.2 \
--with-luajit --with-http_stub_status_module \
--with-pcre --with-pcre-jit \
--with-file-aio --with-threads
[root@opsany openresty-1.17.8.2]# gmake && gmake install
[root@opsany openresty-1.17.8.2]# cd
[root@opsany ~]# ln -s /usr/local/openresty-1.17.8.2/ /usr/local/openresty

waf's People

Contributors

bc-moon avatar lytsing avatar silenceguo avatar unixhot avatar womaiyun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

waf's Issues

access.lua顺序问题

白名单ip
白名单url
这俩个应该放在前面,避免cc规则拦住就到不了白名单url规则

使用最新版openresty启动报错

我这边部署了Openresty 1.15.8.1 ,把waf规则放到nginx/conf下,启动openresty报错

2019/05/28 15:05:23 [error] 8427#0: lua_load_resty_core failed to load the resty.core module from https://github.com/openresty/lua-resty-core; ensure you are using an OpenResty release from https://openresty.org/en/download.html (rc: 2, reason: module 'resty.core' not found:
        no field package.preload['resty.core']
        no file '/usr/local/openresty/nginx/conf/waf/resty/core.lua'
        no file '/usr/local/openresty/site/lualib/resty/core.so'
        no file '/usr/local/openresty/lualib/resty/core.so'
        no file './resty/core.so'
        no file '/usr/local/lib/lua/5.1/resty/core.so'
        no file '/usr/local/openresty/luajit/lib/lua/5.1/resty/core.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file '/usr/local/openresty/site/lualib/resty.so'
        no file '/usr/local/openresty/lualib/resty.so'
        no file './resty.so'
        no file '/usr/local/lib/lua/5.1/resty.so'
        no file '/usr/local/openresty/luajit/lib/lua/5.1/resty.so'
        no file '/usr/local/lib/lua/5.1/loadall.so')

可能是时间太久了,这个waf规则需要修改下才能使用呢。

用的 nginx/1.20.1,不产生日志

[root@localhost nginx]# nginx -V

nginx version: nginx/1.20.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.1.1k  25 Mar 2021
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-stream --with-stream_ssl_module --with-openssl=/root/lnmp1.8/src/openssl-1.1.1k --with-openssl-opt='enable-weak-ssl-ciphers' --with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib --add-module=/root/src/lua-nginx-module-0.10.14 --add-module=/root/src/ngx_devel_kit-0.3.1 --with-ld-opt='-ljemalloc'

image

image
image

按照文档配置,lua模块报错,不知道是不是代码的问题。

2017/08/02 19:29:01 [error] 18148#0: *14 lua entry thread aborted: runtime error: /usr/local/nginx/conf/waf/init.
lua:152: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
coroutine 0:
[C]: in function 'pairs'
/usr/local/nginx/conf/waf/init.lua:152: in function 'user_agent_attack_check'
/usr/local/nginx/conf/waf/access.lua:6: in function 'waf_main'
/usr/local/nginx/conf/waf/access.lua:18: in function </usr/local/nginx/conf/waf/access.lua:1>, client: 12
5.39.239.6, server: localhost, request: "GET //index.php/api/index/imgcode HTTP/1.1", host: "gd.lo-x.cc", referre
r: "http://www.baidu.com/s?wd=www"

这种疯狂的被扫描应该怎么写规则?

1.45.28.97 - - [25/Nov/2020:16:25:30 +0800] "GET /?rAV7w.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:30 +0800] "GET /?id=fuiW3 HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:30 +0800] "GET /?5C8RZ28.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:30 +0800] "GET /?6n0pJ52.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:30 +0800] "GET /?20E46h5.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:31 +0800] "GET /?N2ea4/0OVS7.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:31 +0800] "GET /?O13tN.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:31 +0800] "GET /?28W6634.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:31 +0800] "GET /?aZlUA16.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:31 +0800] "GET /?550d51N.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:31 +0800] "GET /?DRu4Q.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:31 +0800] "GET /?29eWj=T9CO0.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:31 +0800] "GET /?id=irp69 HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:32 +0800] "GET /?id=3TnGu HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:32 +0800] "GET /?id=CHb16 HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:32 +0800] "GET /?G9n73.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"
1.45.28.97 - - [25/Nov/2020:16:25:32 +0800] "GET /?V8m7g.html HTTP/1.1" 200 1956 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2)"

太嚣张了,疯狂的扫描。请教下怎么写对应的拦截正则?

去掉access.lua里面被注释的代码后报错了

`require 'init'

function waf_main()
if white_ip_check() then
elseif black_ip_check() then
elseif user_agent_attack_check() then
elseif cc_attack_check() then
elseif cookie_attack_check() then
elseif white_url_check() then
elseif url_attack_check() then
elseif url_args_attack_check() then
elseif post_attack_check() then
else
return
end
end

waf_main()

`

错误日志

2020/01/07 18:15:53 [error] 165#0: *40 lua entry thread aborted: runtime error: /usr/local/openresty/nginx/conf/myconf/waf/init.lua:170: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
coroutine 0:
[C]: in function 'pairs'
/usr/local/openresty/nginx/conf/myconf/waf/init.lua:170: in function 'post_attack_check'
/usr/local/openresty/nginx/conf/myconf/waf/access.lua:12: in function 'waf_main'
/usr/local/openresty/nginx/conf/myconf/waf/access.lua:18: in main chunk, client: 10.211.55.2, server: localhost, request: "GET /abcdef/core/notification/count.do HTTP/1.1", host: "10.211.55.9", referrer: "http://10.211.55.9/abcdef/index.do"

关于cc限制的ip时长配置

你好,cc限制比如配置为config_cc_rate = "10/60",默认比如触发报警,限制的ip有效期为多长,在哪里可以配置呢

.

。。

conf/waf/init.lua:170: bad argu ment #1 to 'pairs' (table expected, got nil)

为什么按照说明的操作提示这个错误,init_lua 第170行pairs的参数为空。
2017/09/11 20:29:28 [debug] 14548#0: *23152 regex "/(attachments|upimg|images|css|uploadfiles|html|uploads|templets|static|template|data|in c|forumdata|upload|includes|cache|avatar)/(\w+).(php|jsp)" not matched on string "/testhello" starting from 0
157 2017/09/11 20:29:28 [debug] 14548#0: *23152 lua resume returned 2
158 2017/09/11 20:29:28 [error] 14548#0: *23152 lua entry thread aborted: runtime error: /liyang/openresty-test/conf/waf/init.lua:170: bad argu ment #1 to 'pairs' (table expected, got nil)

url_args_attack_check功能报错,请大神帮忙解决

waf的url_args_attack_check功能报错,请大神帮忙解决。
报错详细如下:

[C]: in function 'concat'
/usr/local/openresty1.11/nginx/conf/waf/init.lua:130: in function 'url_args_attack_check'
/usr/local/openresty1.11/nginx/conf/waf/access.lua:11: in function 'waf_main'
/usr/local/openresty1.11/nginx/conf/waf/access.lua:18: in function </usr/local/openresty1.11/nginx/conf/waf/access.lua:1>, client: 118.91.92.132, server: g.share.com, request: "GET /gamepage/egg.php?lxt&&cd=0&lt=d96628e0ads&vs=0 HTTP/1.1", host: "g.share.com"

使用openresty/openresty:alpine镜像集成waf后启动报错

nginx: [error] lua_load_resty_core failed to load the resty.core module from https://github.com/openresty/lua-resty-core; ensure you are using an OpenResty release from https://openresty.org/en/download.html (rc: 2, reason: module 'resty.core' not found:
no field package.preload['resty.core']
no file '/usr/local/openresty/nginx/conf/resty/core.lua'
no file '/usr/local/openresty/site/lualib/resty/core.so'
no file '/usr/local/openresty/lualib/resty/core.so'
no file './resty/core.so'
no file '/usr/local/lib/lua/5.1/resty/core.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/resty/core.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/local/openresty/site/lualib/resty.so'
no file '/usr/local/openresty/lualib/resty.so'
no file './resty.so'
no file '/usr/local/lib/lua/5.1/resty.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/resty.so'
no file '/usr/local/lib/lua/5.1/loadall.so')

修改config_log_dir后无日志产生

修改了config.lua下的config_log_dir,重载nginx后未生效,原/tmp目录下也无日志
环境说明
CentOS Linux release 7.6.1810
nginx-1.18.0
openresty-1.17.8.2
ngx_devel_kit-0.3.0
LuaJIT-2.0.5
lua-nginx-module-0.10.10

请问为什么我开了url check和post check,但是却没有生效呢?

我可以正常使用ip黑名单和白名单,但是url check和post check不生效,请问是怎么回事呢?
我使用的是openresty-1.11.2.5版本来实现waf的,下面是我的nginx.conf和config.lua文件,请参考。
nginx.conf

`#user nobody;

worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
#WAF
lua_shared_dict limit 50m; #防cc使用字典,大小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";

include       mime.types;
default_type  application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

server {
    listen       4880;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;
location /hi {
	default_type text/html;
	content_by_lua_block{
		ngx.say('hello openrastry')
	}
}
    location / {
        root   html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

}
`

config.lua
`--WAF config file,enable = "on",disable = "off"

--waf status
config_waf_enable = "on"
--log dir
config_log_dir = "/tmp"
--rule setting
config_rule_dir = "/usr/local/openresty/nginx/conf/waf/rule-config"
--enable/disable white url
config_white_url_check = "on"
--enable/disable white ip
config_white_ip_check = "on"
--enable/disable block ip
config_black_ip_check = "on"
--enable/disable url filtering
config_url_check = "on"
--enalbe/disable url args filtering
config_url_args_check = "on"
--enable/disable user agent filtering
config_user_agent_check = "on"
--enable/disable cookie deny filtering
config_cookie_check = "on"
--enable/disable cc filtering
config_cc_check = "on"
--cc rate the xxx of xxx seconds
config_cc_rate = "10/60"
--enable/disable post filtering
config_post_check = "on"
--config waf output redirect/html
config_waf_output = "html"
--if config_waf_output ,setting url
config_waf_redirect_url = "https://www.unixhot.com"
config_output_html=[[

<title>网站防火墙</title>

你的行为已经违反网站相关规定 ]]

`

writing a global Lua variable ('waf_main') 报错怎么解决

请问这个报错怎么解决
021/12/25 15:13:44 [warn] 2004#2004: *43 [lua] _G write guard:12: __newindex(): writing a global Lua variable ('waf_main') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
stack traceback:
/usr/local/openresty/nginx/conf/waf/access.lua:4: in main chunk, client: 192.168.121.188, server: localhost, request: "GET /hello HTTP/1.1", host: "192.168.123.179"
2021/12/25 15:13:44 [warn] 2004#2004: *43 [lua] _G write guard:12: __newindex(): writing a global Lua variable ('waf_main') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
image

启动后应用一直500

2020/12/16 10:11:23 [warn] 6630#0: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('CLIENT_IP') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
stack traceback:
/home/openresty/openresty/waf/lib.lua:11: in function 'get_client_ip'
/home/openresty/openresty/waf/init.lua:63: in function 'cc_attack_check'
/home/openresty/openresty/waf/access.lua:7: in function 'waf_main'
/home/openresty/openresty/waf/access.lua:18: in main chunk, client:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.