Applicable to:
- Plesk for Linux
Symptoms
- After updating Plesk to 18.0.82, the NGINX configuration is broken and NGINX cannot be started
- ModSecurity 3.0 is enabled on NGINX with the Comodo (free) rule set
-
The NGINX configuration test fails with the following error:
CONFIG_TEXT: nginx: [emerg] "modsecurity_rules_file" directive Rules error. File: /etc/nginx/modsecurity.d/rules/comodo_free/30_Apps_OtherApps.conf. Line: 5650. Column: 27. Invalid regular expression: ^[\d-:]+$ in /etc/nginx/conf.d/modsecurity.conf:6
nginx: configuration file /etc/nginx/nginx.conf test failed
Cause
Plesk 18.0.82 updates libmodsecurity (the mod-security-v3 package) from 3.0.16 to 3.0.17, which checks every regular expression when it loads the rules and treats an invalid one as a fatal error, while earlier versions silently ignored it. Comodo (free) rule 240590 in 30_Apps_OtherApps.conf contains the invalid pattern ^[\d-:]+$. This is a known Plesk bug with ID PPPM-15599.
Resolution
The bug PPPM-15599 will be fixed in future Plesk updates and published in the Plesk Obsidian change log as soon as the update is released. In the meantime, one of the following workarounds can be applied:
- Connect to the server via SSH
-
Create a backup copy of the rule file:
# cp -a /etc/nginx/modsecurity.d/rules/comodo_free/30_Apps_OtherApps.conf /root/30_Apps_OtherApps.conf.orig
-
Move the hyphen to the end of the character class in the rule:
# sed -i 's/\[\\d-:\]/[\\d:-]/' /etc/nginx/modsecurity.d/rules/comodo_free/30_Apps_OtherApps.conf
grep -nF 'closedate "!@rx' /etc/nginx/modsecurity.d/rules/comodo_free/30_Apps_OtherApps.conf -
Restart NGINX:
# service nginx restart
- Log into Plesk
- Go to Tools & Settings>Web Application Firewall (ModSecurity)>Settings and Switch the ModSecurity rule set used by NGINX to another one, such as OWASP CRS or Atomic Basic.
Comments
Please sign in to leave a comment.