简体   繁体   English

使用NGINX的WAF owasp modsecurity crs中“尚不支持SecCollectionTimeout”

[英]“SecCollectionTimeout is not yet supported” in WAF owasp modsecurity crs with NGINX

I install nginx with WAF (Using Docker) 我用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

but suddenly began to mark this error: 但突然开始标记这个错误:

nginx: [emerg] "modsecurity_rules_file" directive Rules error. nginx:[emerg]“modsecurity_rules_file”指令规则错误。 File: /opt/owasp-modsecurity-crs/crs-setup.conf. 文件:/opt/owasp-modsecurity-crs/crs-setup.conf。 Line: 96. Column: 43. SecCollectionTimeout is not yet supported. 行:96。列:43。尚不支持SecCollectionTimeout。

In documentation : 文档中

============== ==============

#
# -- [[ 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

============== ==============

I solve it by adding this line to the command (disabling the rule): 我通过在命令中添加此行来解决此问题(禁用规则):

&& sed -i 's/SecCollectionTimeout 600/# SecCollectionTimeout 600/' /opt/owasp-modsecurity-crs/crs-setup.conf

But I do not know what consequences it has, or if it is the correct way to apply it. 但我不知道它有什么后果,或者它是否是正确的应用方式。

Some example of the one that can guide me? 一个可以指导我的例子?

I think that you need to Re - configure the WAF OWASP to resolve that issue. 我认为你需要重新配置WAF OWASP来解决这个问题。 Check that link for that... 检查那个链接...

Last time my friend resolve that issue to re configure it ... 上次我的朋友解决了这个问题以重新配置它...

https://support.cloudflare.com/hc/en-us/articles/115000223771-How-do-I-configure-the-WAF- https://support.cloudflare.com/hc/en-us/articles/115000223771-How-do-I-configure-the-WAF-

I autorespond: 我自动回复:

Source: https://github.com/SpiderLabs/ModSecurity/issues/1705 资料来源: https//github.com/SpiderLabs/ModSecurity/issues/1705

it happens due the fact that the SecCollectionTimeout directive is not currently configurable on libModSecurity (aka v3) as stated on the reference manual. 它发生的原因是SecCollectionTimeout指令当前不能在libModSecurity(aka v3)上配置,如参考手册中所述。

Commenting out the SecCollectionTimeout directive on crs-setup.conf solves the problem without side effects. 在crs-setup.conf上注释掉SecCollectionTimeout指令可以解决没有副作用的问题。

A change to the parser to avoid the error is underway here. 此处正在对解析器进行更改以避免错误。 You can also choose to apply this change on the code for now as well. 您也可以选择在代码上应用此更改。 It's already being merged to main. 它已经被合并到main。

The funny thing is that the question I did 20 days ago in stackoverflow ... and the issue was raised 22 days ago on github, look for some issue related to "SecCollectionTimeout" and there was nothing related...at that moment 有趣的是,我在20天前在stackoverflow中做过的问题......这个问题是22天前在github上提出的,找了一些与“SecCollectionTimeout”有关的问题,那时没有任何相关内容......

In short, the code you put up is totally functional, so that the one that serves him, the only thing that I did was to recompile the image so that it did pull to the repository of https://github.com/SpiderLabs/ModSecurity and ready 简而言之,你提出的代码是完全正常的,所以那个为他服务的代码,我做的唯一的事情是重新编译图像,以便它确实拉到https://github.com/SpiderLabs/的存储库ModSecurity并准备就绪

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM