Applicable to:
- Plesk for Linux
Question
Does the Web Application Firewall (ModSecurity) with the Imunify360 rule set inspect requests that nginx sends to a Docker container through Docker Proxy Rules in Plesk?
Answer
No. A rule added at Domains > example.com > Docker Proxy Rules is written to the domain's nginx configuration as a location that sends requests directly to the container. These requests never reach Apache, so the Web Application Firewall running in Apache (ModSecurity 2.9) with the Imunify360 rule set does not inspect them.
Note: Switching Tools & Settings > Web Application Firewall (ModSecurity) > Settings to Nginx (ModSecurity 3.0) replaces the Imunify360 rule set with the OWASP rule set, so the Imunify360 rules cannot be used in that mode. Requests sent through Docker Proxy Rules are not blocked in that mode either.
To have requests to a Docker container inspected by the Web Application Firewall with the Imunify360 rule set, proxy them through Apache instead of using Docker Proxy Rules:
- Log into Plesk
- Go to Domains > example.com > Docker Proxy Rules and remove the rule for the path.
-
Go to Domains > example.com > Hosting & DNS > Apache & nginx Settings.
Note: Replace
/app/with the path for the application and8088with the external port mapped to the container at Docker > container name > Settings.Add the following lines to both Additional directives for HTTP and Additional directives for HTTPS:
CONFIG_TEXT: ProxyPass /app/ http://127.0.0.1:8088/
ProxyPassReverse /app/ http://127.0.0.1:8088/ - Click OK.
-
Connect to the server via SSH and make sure the Docker Proxy Rule is no longer in the nginx configuration. The command returns
0:# grep -c "extension docker" /var/www/vhosts/system/example.com/conf/nginx.conf
-
Make sure the application responds through Apache. The command returns the title of the application page, for example:
# curl -sk https://example.com/app/ | grep -o "<title>.*</title>"
<title>Welcome to nginx!</title>
With this configuration, the same path traversal request sent to /app/ is blocked with 403 Forbidden and logged in /var/log/modsec_audit.log.
Comments
Please sign in to leave a comment.