使用ModSecurity和lua脚本阻止请求
我有networkingstream量通过ModSecuritystream动。 在ModSecurityconfiguration中,我正在调用一个Lua脚本,对请求string的参数进行一些简单的分析。 具体来说,它是检查跨站脚本的证据,如果存在一些证据,将阻止传入的stream量。 ModSecurity规则引擎configuration如下: SecRuleEngine On SecRuleScript "/path/to/lua/script/detectXSS.lua" "block" lua脚本的一个说明性例子如下: function main() — Retrieve script parameters local d = m.getvars("ARGS", { "lowercase", "htmlEntityDecode" } ); — Loop through the parameters for i = 1, #d do — Examine parameter value. if (string.find(d[i].value, "<script")) then return ("Suspected XSS in variable " .. d[i].name .. "."); end […]