簡體   English   中英

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

[英]“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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM