在白名单操作上使用自定义 REQUEST_HEADER
Using custom REQUEST_HEADER on whitelist action
我正在尝试对 ModSecurity 白名单规则使用自定义请求 header,以便删除特定规则。
SecRule REQUEST_URI "^/admin/index\.html$" \
"id:1004,\
phase:2,\
pass,\
nolog,\
ctl:ruleRemoveById=%{request_headers.x-rules-excluded}"
但是,当我尝试这样做时,我在 NGINX 上收到以下错误:
Mar 20 16:18:42 develop-node ip[16035]: nginx: [emerg] "modsecurity_rules_file" directive Rules error. File: /tmp/test.modsec.conf. Line: 1062. Column: 96. Expecting an action, got: ctl:ruleRemoveById=%{request_headers.x-rules-excluded}" in /tmp/test.nginx.conf:28
我想知道这是否可行...
谢谢!
这是不可能的。您正在尝试执行宏扩展,ctl
操作不支持它。您只能在 ctl:ruleRemoveById
.
中传递整数或范围
我正在尝试对 ModSecurity 白名单规则使用自定义请求 header,以便删除特定规则。
SecRule REQUEST_URI "^/admin/index\.html$" \
"id:1004,\
phase:2,\
pass,\
nolog,\
ctl:ruleRemoveById=%{request_headers.x-rules-excluded}"
但是,当我尝试这样做时,我在 NGINX 上收到以下错误:
Mar 20 16:18:42 develop-node ip[16035]: nginx: [emerg] "modsecurity_rules_file" directive Rules error. File: /tmp/test.modsec.conf. Line: 1062. Column: 96. Expecting an action, got: ctl:ruleRemoveById=%{request_headers.x-rules-excluded}" in /tmp/test.nginx.conf:28
我想知道这是否可行...
谢谢!
这是不可能的。您正在尝试执行宏扩展,ctl
操作不支持它。您只能在 ctl:ruleRemoveById
.