【问题标题】:Apache mod_security and chat serverApache mod_security 和聊天服务器
【发布时间】:2018-06-26 11:47:39
【问题描述】:

我的网站托管在运行 Apache 和 Plesk 的虚拟服务器上。我想在我的网站上集成来自 livezilla.de 的聊天。聊天服务器也在我的服务器上运行。

为了保护我的系统,我激活了 plesk_modsecurity。但是,该特定模块会禁止每个聊天用户的 IP 地址,因为聊天会非常频繁地 ping 服务器。

是否可以 (a) 无限制地允许从聊天到聊天服务器的请求,反之亦然,而 (b) 任何其他请求仍由具有适当限制的模块处理?

或者您会推荐其他解决方案吗?

以下列表显示了 modsecurity 规则引发的一些错误。

Message: Rule 7f7e7ac18c30 [id "340159"][file "/etc/apache2/modsecurity.d/rules/tortix/modsec/50_plesk_basic_asl_rules.conf"][line "114"] - Execution error - PCRE limits exceeded (-8): (null).
Message: Rule 7f7e7abb2c60 [id "340157"][file "/etc/apache2/modsecurity.d/rules/tortix/modsec/50_plesk_basic_asl_rules.conf"][line "135"] - Execution error - PCRE limits exceeded (-8): (null).
Apache-Error: [file "apache2_util.c"] [line 273] [level 3] [client XX.XXX.XX.XXX] ModSecurity: Rule 7f7e7ac18c30 [id "340159"][file "/etc/apache2/modsecurity.d/rules/tortix/modsec/50_plesk_basic_asl_rules.conf"][line "114"] - Execution error - PCRE limits exceeded (-8): (null). [hostname "mydomain.tld"] [uri "/livezilla/server.php"] [unique_id "WzIClVXWzdsAABSrkdgAAAAE"]
Apache-Error: [file "apache2_util.c"] [line 273] [level 3] [client XX.XXX.XX.XXX] ModSecurity: Rule 7f7e7abb2c60 [id "340157"][file "/etc/apache2/modsecurity.d/rules/tortix/modsec/50_plesk_basic_asl_rules.conf"][line "135"] - Execution error - PCRE limits exceeded (-8): (null). [hostname "mydomain.tld"] [uri "/livezilla/server.php"] [unique_id "WzIClVXWzdsAABSrkdgAAAAE"]
Apache-Handler: proxy:unix:///var/www/vhosts/system/mydomain.tld/php-fpm.sock|fcgi://127.0.0.1:9000
Stopwatch: 1530004117657831 96698593 (- - -)
Stopwatch2: 1530004117657831 96698593; combined=96528507, p1=2, p2=96528499, p3=2, p4=1, p5=3, sr=0, sw=0, l=0, gc=0
Producer: ModSecurity for Apache/2.9.2 (http://www.modsecurity.org/); 201806211447.
Server: Apache
Engine-Mode: "ENABLED"

【问题讨论】:

    标签: apache plesk mod-security


    【解决方案1】:

    为 ModSecurity 尝试 LocationMatch 指令。浏览到 工具和设置 > Web 应用程序防火墙 (ModSecurity) > 设置 > 自定义 并添加以下指令:

    <LocationMatch "/livezilla/">
    SecRuleEngine Off
    </LocationMatch>
    

    它将为 /livezilla/server.php 等 URI 禁用 ModSecurity

    【讨论】:

    • 非常感谢。我将代码稍微更改为&lt;LocationMatch "/livezilla/"&gt; SecRuleRemoveById 340159,340157 &lt;/LocationMatch&gt;,只排除了日志文件中显示的两个特定规则。现在聊天很顺利。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-27
    • 2012-12-11
    • 1970-01-01
    • 2015-09-25
    • 1970-01-01
    • 2016-05-29
    相关资源
    最近更新 更多