openstar icon indicating copy to clipboard operation
openstar copied to clipboard

带正则的规则都不生效

Open Livenux opened this issue 2 years ago • 2 comments

系统信息:

  • Kernel: 5.15.0-40-generic #43-Ubuntu SMP Wed Jun 15 12:54:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  • OS: Ubuntu 22.04.1 LTS
  • openresty: 1.21.4.1-2~jammy1

现象: 只有ip.deny 生效,其他的模块都没有生效.

Nginx 错误日志:

2022/08/17 18:21:53 [warn] 14749#14749: *32 [lua] _G write guard:12: writing a global Lua variable ('aho-corasick') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
stack traceback:
        [C]: at 0x7f3c02604920
        [C]: in function 'require'
        /opt/openresty/openstar/lib/optl.lua:6: in main chunk
        [C]: in function 'require'
        /opt/openresty/openstar/i_worker.lua:128: in function </opt/openresty/openstar/i_worker.lua:127>, context: ngx.timer

启用的模块:

{"logPath":"\/opt\/openresty\/openstar\/logs\/","htmlPath":"\/opt\/openresty\/openstar\/index\/","code":"ok","autoSync":{"state":"Master\/Slave\/off","timeAt":5},"app_Mod":"on","log_conf":{"filename":"waf.log","state":"on","tb_formart":["$time","$remoteIp","$host","$ip","$method","$server_protocol","$status","$request_uri","$useragent","$referer","waf_log:","$waf_log","\n"],"tb_concat":" "},"referer_Mod":"on","jsonPath":"\/opt\/openresty\/openstar\/conf_json\/","uri_Mod":"on","realIpFrom_Mod":"on","header_Mod":"on","redis_Mod":{"Password":"","ip":"127.0.0.1","state":"on","Port":6379},"useragent_Mod":"on","network_Mod":"on","cookie_Mod":"on","Mod_state":"on","args_Mod":{"state":"on","HPP_state":"on"},"ip_Mod":"on","post_Mod":{"state":"on","HPP_state":"on"},"debug_Mod":false,"baseDir":"\/opt\/openresty\/openstar\/","post_form":10240,"replace_Mod":"off","host_method_Mod":"off","denyMsg":{"state":"on","msg":"openstar deny","http_code":403},"rewrite_Mod":"on","ngx_status":"on"}

Livenux avatar Aug 17 '22 11:08 Livenux

optl.lua 中使用了 aho 算法,对应这个算法的 aho-corasick.so 文件似乎没有加载成功,注释掉 optl.lua 中 使用 aho 算法的地方 image image

starjun avatar Aug 18 '22 08:08 starjun

aho-corasick.so

optl.lua 中使用了 aho 算法,对应这个算法的 aho-corasick.so 文件似乎没有加载成功,注释掉 optl.lua 中 使用 aho 算法的地方 image image

我测试了下aho-corasick.so ,在resty里面匹配不了,但是执行lua脚本又能匹配,这是因为新的luajit没法使用这个模块吗?

Livenux avatar Aug 21 '22 03:08 Livenux