diff --git a/plugins/op_waf/index.py b/plugins/op_waf/index.py index 30d4f2fb3..a0aa2b3de 100755 --- a/plugins/op_waf/index.py +++ b/plugins/op_waf/index.py @@ -655,9 +655,9 @@ def setCcConf(): tmp = cobj['cc'] - tmp['cycle'] = args['cycle'] - tmp['limit'] = args['limit'] - tmp['endtime'] = args['endtime'] + tmp['cycle'] = int(args['cycle']) + tmp['limit'] = int(args['limit']) + tmp['endtime'] = int(args['endtime']) tmp['is_open_global'] = args['is_open_global'] tmp['increase'] = args['increase'] cobj['cc'] = tmp diff --git a/plugins/op_waf/waf/lua/common.lua b/plugins/op_waf/waf/lua/common.lua index 4f0f708e2..7f22b0839 100644 --- a/plugins/op_waf/waf/lua/common.lua +++ b/plugins/op_waf/waf/lua/common.lua @@ -126,6 +126,17 @@ end function _M.write_file(self, filename, body) + fp = io.open(filename,'ab') + if fp == nil then + return nil + end + fp:write(body) + fp:flush() + fp:close() + return true +end + +function _M.write_file_clear(self, filename, body) fp = io.open(filename,'w') if fp == nil then return nil @@ -245,7 +256,7 @@ function _M.inc_log(self, name, rule) if not total_log then return false end ngx.shared.limit:set(total_path,total_log) if not ngx.shared.limit:get('mw_waf_timeout') then - self:write_file(total_path,total_log) + self:write_file_clear(total_path,total_log) ngx.shared.limit:set('mw_waf_timeout',1,5) end end