I次のルールがあります。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に空白はなく、Client-IPはX-Forwarded-Forに相当します。何か上流にはスペースを追加します。これはtest.txtと比較する前に削除する必要があります。 – Marcus