[英]“SecCollectionTimeout is not yet supported” in WAF owasp modsecurity crs with NGINX
我用WAF安装nginx(使用Docker)
mkdir -p /usr/src \
&& cd /usr/src/ \
&& git clone --depth 1 -b v3/master --single-branch https://github.com/SpiderLabs/ModSecurity \
&& cd ModSecurity \
&& git submodule init \
&& git submodule update \
&& ./build.sh \
&& ./configure \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& make install
... previous commands to install nginx from source...
&& cd /usr/src \
&& git clone --depth 1 https://github.com/SpiderLabs/ModSecurity-nginx.git \
&& cd /usr/src/nginx-$NGINX_VERSION \
&& ./configure --with-compat --add-dynamic-module=../ModSecurity-nginx \
&& make modules \
&& cp objs/ngx_http_modsecurity_module.so /etc/nginx/modules \
&& mkdir /etc/nginx/modsec \
&& wget -P /etc/nginx/modsec/ https://raw.githubusercontent.com/SpiderLabs/ModSecurity/v3/master/modsecurity.conf-recommended \
&& mv /etc/nginx/modsec/modsecurity.conf-recommended /etc/nginx/modsec/modsecurity.conf \
&& sed -i 's/SecRuleEngine DetectionOnly/SecRuleEngine On/' /etc/nginx/modsec/modsecurity.conf \
&& sed -i 's/SecRequestBodyInMemoryLimit 131072//' /etc/nginx/modsec/modsecurity.conf \
&& sed -i 's#SecAuditLog /var/log/modsec_audit.log#SecAuditLog /var/log/nginx/modsec_audit.log#' /etc/nginx/modsec/modsecurity.conf \
&& mkdir /opt \
&& cd /opt \
&& git clone -b v3.0/master --single-branch https://github.com/SpiderLabs/owasp-modsecurity-crs.git \
&& cd owasp-modsecurity-crs/ \
&& cp /opt/owasp-modsecurity-crs/crs-setup.conf.example /opt/owasp-modsecurity-crs/crs-setup.conf
但突然开始标记这个错误:
nginx:[emerg]“modsecurity_rules_file”指令规则错误。 文件:/opt/owasp-modsecurity-crs/crs-setup.conf。 行:96。列:43。尚不支持SecCollectionTimeout。
在文档中 :
==============
#
# -- [[ Collection timeout ]] --------------------------------------------------
#
# Set the SecCollectionTimeout directive from the ModSecurity default (1 hour)
# to a lower setting which is appropriate to most sites.
# This increases performance by cleaning out stale collection (block) entries.
#
# This value should be greater than or equal to:
# tx.reput_block_duration (see section "Blocking Based on IP Reputation") and
# tx.dos_block_timeout (see section "Anti-Automation / DoS Protection").
#
# Ref: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#wiki-SecCollectionTimeout
# Please keep this directive uncommented.
# Default: 600 (10 minutes)
SecCollectionTimeout 600
==============
我通过在命令中添加此行来解决此问题(禁用规则):
&& sed -i 's/SecCollectionTimeout 600/# SecCollectionTimeout 600/' /opt/owasp-modsecurity-crs/crs-setup.conf
但我不知道它有什么后果,或者它是否是正确的应用方式。
一个可以指导我的例子?
我认为你需要重新配置WAF OWASP来解决这个问题。 检查那个链接...
上次我的朋友解决了这个问题以重新配置它...
https://support.cloudflare.com/hc/en-us/articles/115000223771-How-do-I-configure-the-WAF-
我自动回复:
资料来源: https : //github.com/SpiderLabs/ModSecurity/issues/1705
它发生的原因是SecCollectionTimeout指令当前不能在libModSecurity(aka v3)上配置,如参考手册中所述。
在crs-setup.conf上注释掉SecCollectionTimeout指令可以解决没有副作用的问题。
此处正在对解析器进行更改以避免错误。 您也可以选择在代码上应用此更改。 它已经被合并到main。
有趣的是,我在20天前在stackoverflow中做过的问题......这个问题是22天前在github上提出的,找了一些与“SecCollectionTimeout”有关的问题,那时没有任何相关内容......
简而言之,你提出的代码是完全正常的,所以那个为他服务的代码,我做的唯一的事情是重新编译图像,以便它确实拉到https://github.com/SpiderLabs/的存储库ModSecurity并准备就绪
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.