How to whitelist IP addresses for ModSecurity in Plesk?

Comments

2 comments

  • Avatar
    WebCodePoet

    You missed NGINX here. We use NGINX Hosting.

    0
  • Avatar
    B3 Support

    If you want to whitelist IP addresses and totally disable ModSecurity, the approach above doesn't work!

    Entering the exception under WAF --> Settings --> Custom directives does not work, as the settings are written to /etc/apache2/plesk.conf.d/modsecurity.conf. However, this file is only loaded by Apache after the files from /etc/apache2/modsecurity.d. are processed. As a result, the rule never takes effect!
    Instead, we can create a file /etc/apache2/modsecurity.d/custom_rules.conf.

    #Do not filter
    #With log for debugging
    SecRule REMOTE_ADDR “@IPMatch 1.2.3.4” “id:1,phase:1,t:none,pass,log,ctl:ruleEngine=Off”
    #Without log for production
    SecRule REMOTE_ADDR “@IPMatch 1.2.3.4” “id:1,phase:1,t:none,pass,nolog,ctl:ruleEngine=Off”

    A reload must then be performed for Apache:

    systemctl reload apache2.service

    0

Please sign in to leave a comment.

Have more questions? Submit a request