我有以下规则:的ModSecurity:removeWhitespace不工作
SecRule REQUEST_HEADERS:Client-IP "@ipMatchFromFile test.txt"
"id:210487,t:none,t:urlDecodeUni,t:removeWhitespace,drop,msg:'IP-test'"
但是当我运行它,我得到的回应:
T (0) urlDecodeUni: "111.22.33.44 " // note the space before the "
T (0) removeWhitespace: "111.22.33.44" // perfect! The space has been removed
Transformation completed in 4 usec.
Executing operator "ipMatchFromFile" with param "test.txt" against REQUEST_HEADERS:Client-IP.
Target value: "111.22.33.44" // target value has no space, hooray!
IPmatchFromFile: Total tree entries: 8, ipv4 8 ipv6 0
IPmatch: bad IPv4 specification "111.22.33.44 ". // why, oh why, is the space back!
Operator completed in 4 usec.
Operator error: IPmatch: bad IPv4 specification "111.22.33.44 ". // that space again!
Rule returned -1.
Rule processing failed.
Rule failed, not chained -> mode NEXT_RULE.
请堆栈溢出的传说;告诉我如何解决它:-)
有没有在test.txt文件列表的空间?转换仅发生在请求中文件条目相比较的参数上 - 而不是与文件中的条目相比较。 –
test.txt中没有空格,Client-IP是X-Forwarded-For的等价物。上游的东西是添加一个空间,我们需要删除之前,比较test.txt .. – Marcus