mirror of
https://github.com/potats0/lua-resty-coraza.git
synced 2025-06-28 17:41:00 +03:00
feat: 暴露waf变量
This commit is contained in:
parent
5fbe3ec1b0
commit
5704d72cd2
@ -18,20 +18,24 @@ local _M = {
|
||||
}
|
||||
|
||||
function _M.do_init()
|
||||
_M.waf = coraza.new_waf()
|
||||
return coraza.new_waf()
|
||||
end
|
||||
|
||||
function _M.rules_add_file(file)
|
||||
return coraza.rules_add_file(_M.waf, file)
|
||||
function _M.do_free_waf(waf)
|
||||
return coraza.free_waf(waf)
|
||||
end
|
||||
|
||||
function _M.rules_add(directives)
|
||||
return coraza.rules_add(_M.waf, directives)
|
||||
function _M.rules_add_file(waf, file)
|
||||
return coraza.rules_add_file(waf, file)
|
||||
end
|
||||
|
||||
function _M.do_access_filter()
|
||||
function _M.rules_add(waf, directives)
|
||||
return coraza.rules_add(waf, directives)
|
||||
end
|
||||
|
||||
function _M.do_access_filter(waf)
|
||||
-- each connection will be created a transaction
|
||||
local transaction = coraza.new_transaction(_M.waf)
|
||||
local transaction = coraza.new_transaction(waf)
|
||||
ngx_ctx.transaction = transaction
|
||||
|
||||
coraza.process_connection(transaction, ngx_var.remote_addr, ngx_var.remote_port,
|
||||
|
@ -109,6 +109,13 @@ function _M.new_waf()
|
||||
return waf
|
||||
end
|
||||
|
||||
function _M.free_waf(waf)
|
||||
-- extern int coraza_free_waf(coraza_waf_t t);
|
||||
local waf = coraza.coraza_free_waf(waf)
|
||||
nlog(debug_fmt("Success to free new waf"))
|
||||
return waf
|
||||
end
|
||||
|
||||
function _M.rules_add_file(waf, conf_file)
|
||||
-- extern int coraza_rules_add_file(coraza_waf_t w, char* file, char** er);
|
||||
local code = coraza.coraza_rules_add_file(waf, cast_to_c_char(conf_file), err_Ptr)
|
||||
|
Loading…
x
Reference in New Issue
Block a user