Skip to content
  • Contact us: +34 944 58 06 58
  • Plesk Partner Program
  • Plesk Lifecycle Policy
  • Blog
  • Contact us
  • Plesk 360
  • Contact us: +34 944 58 06 58
  • Plesk Partner Program
  • Plesk Lifecycle Policy
  • Blog
  • Contact us
  • Plesk 360
  • Solutions
    By Role
    • Developers
    • Content Managers
    • Digital Agencies
    • IT Admins
    • Web Hosters
    • Hyperscalers
    • Developers
    • Content Managers
    • Digital Agencies
    • IT Admins
    • Web Hosters
    • Hyperscalers
    By Edition
    • Web Admin Edition
    • Web Pro Edition
    • Web Host Edition
    • Business & Collaboration
    • Plesk WP Edition
    • Web Admin Edition
    • Web Pro Edition
    • Web Host Edition
    • Business & Collaboration
    • Plesk WP Edition
    By Cloud
    • Amazon Web Services
    • Microsoft Azure
    • Alibaba Cloud
    • GCP Marketplace
    • Vultr
    • DigitalOcean
    • Linode
    • UpCloud
    • Amazon Web Services
    • Microsoft Azure
    • Alibaba Cloud
    • GCP Marketplace
    • Vultr
    • DigitalOcean
    • Linode
    • UpCloud
    Partner Program
    Exclusive discounts, benefits and exposure to take your business to the next level
    Become a partner
    • By Role
      • Developers
      • Content Managers
      • Digital Agencies
      • IT Admins
      • Web Hosters
      • Hyperscalers
    • By Edition
      • Web Admin Edition
      • Web Pro Edition
      • Web Host Edition
      • Business & Collaboration
      • WP Edition
    • By Cloud
      • Amazon Web Services
      • Microsoft Azure
      • Alibaba Cloud
      • GCP Marketplace
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
    • Partner Program
      • Partner Program
  • Product
    Explore Features
    • Everyone
    • Admins & Web Hosters
    • Developers
    • Designers & Agencies
    • Plesk Features
    • Everyone
    • Admins & Web Hosters
    • Developers
    • Designers & Agencies
    • Plesk Features
    Key Topics
    • SocialBee
    • WP Toolkit
    • Sitejet Builder
    • SEO Toolkit
    • Joomla! Toolkit
    • Plesk Premium Email
    • Plesk Email Security
    • SocialBee
    • WP Toolkit
    • Sitejet Builder
    • SEO Toolkit
    • Joomla! Toolkit
    • Plesk Premium Email
    • Plesk Email Security
    Feature Packs
    • Business & Collaboration
    • WP Pack
    • Hosting Pack
    • Power Pack
    • Language Pack
    • Business & Collaboration
    • WP Pack
    • Hosting Pack
    • Power Pack
    • Language Pack
    Featured Extension
    SocialBee
    • Explore Features
      • Everyone
      • Admins & Web Hosters
      • Developers
      • Designers & Agencies
      • Plesk Features
    • Key Topics
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Plesk Premium Email
      • Plesk Email Security
    • Feature Packs
      • Business & Collaboration
      • WP Pack
      • Hosting Pack
      • Power Pack
      • Language Pack
    • Featured Extension
      • Extension
  • Pricing
  • Extensions
  • Help Center
  • More
    • Careers
    • Events
    • Plesk University
  • FREE TRIAL
  • Solutions
    • By Role
      • Developers
      • Content Managers
      • Digital Agencies
      • IT Admins
      • Web Hosters
      • Hyperscalers
    • By Edition
      • Web Admin Edition
      • Web Pro Edition
      • Web Host Edition
      • Business & Collaboration
      • WP Edition
    • By Cloud
      • Amazon Web Services
      • Microsoft Azure
      • Alibaba Cloud
      • GCP Marketplace
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
    • Partner Program
      • Partner Program
  • Product
    • Explore Features
      • Everyone
      • Admins & Web Hosters
      • Developers
      • Designers & Agencies
      • Plesk Features
    • Key Topics
      • SocialBee
      • WP Toolkit
      • Sitejet Builder
      • SEO Toolkit
      • Joomla! Toolkit
      • Plesk Premium Email
      • Plesk Email Security
    • Feature Packs
      • Business & Collaboration
      • WP Pack
      • Hosting Pack
      • Power Pack
      • Language Pack
    • Featured Extension
      • SocialBee
  • Pricing
  • Extensions
  • Help center
  • More
    • Careers
    • Events
    • Plesk University
    • Blog
    • Plesk Partner Program
    • Contact Us
  • FREE TRIAL
  • Solutions
    • By Role
      • Developers
      • Content Managers
      • Digital Agencies
      • IT Admins
      • Web Hosters
      • Hyperscalers
    • By Edition
      • Web Admin Edition
      • Web Pro Edition
      • Web Host Edition
      • Business & Collaboration
      • WP Edition
    • By Cloud
      • Amazon Web Services
      • Microsoft Azure
      • Alibaba Cloud
      • GCP Marketplace
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
    • Partner Program
      • Partner Program
  • Product
    • Explore Features
      • Everyone
      • Admins & Web Hosters
      • Developers
      • Designers & Agencies
      • Plesk Features
    • Key Topics
      • SocialBee
      • WP Toolkit
      • Sitejet Builder
      • SEO Toolkit
      • Joomla! Toolkit
      • Plesk Premium Email
      • Plesk Email Security
    • Feature Packs
      • Business & Collaboration
      • WP Pack
      • Hosting Pack
      • Power Pack
      • Language Pack
    • Featured Extension
      • SocialBee
  • Pricing
  • Extensions
  • Help center
  • More
    • Careers
    • Events
    • Plesk University
    • Blog
    • Plesk Partner Program
    • Contact Us
  • FREE TRIAL

Knowledge Base

How to whitelist IP addresses for ModSecurity in Plesk?

 
apachecentoscloudlinuxdebianfirewall

Question

How to whitelist a single/multiple IP addresses for ModSecurity in Plesk?

Answer

Apply one of the solutions below:

For OWASP ruleset on Linux

  1. Connect to the server via SSH.

  2. Create/ open for editing ModSecurity file that is used for IP whitelisting:

    For Debian based systems (Ubuntu/Debian):

    # vi /etc/apache2/modsecurity.d/000ipwhitelist.conf

    For RHEL based systems (CentOS/CloudLinux):

    # vi /etc/httpd/conf/modsecurity.d/rules/000ipwhitelist.conf

  3. Add the following rule in 1 line there:

    SecRule REMOTE_ADDR "@ipMatch 203.0.113.0/24,192.0.2.2" "id:3,phase:1,t:none,log,pass,ctl:ruleRemoveById=55666"

    Where:
    55666 - is the existing ModSecurity Rule and it should be replaced with the required rule ID.
    203.0.113.0/24 - IP addresses that are required to whitelist. Multiple, comma-separated, addresses can be also specified.  

  4. Check Apache syntax:

    For Debian based systems (Ubuntu/Debian):

    # apache2ctl -t

    For RHEL based systems (CentOS/CloudLinux):

    # httpd -t

  5. If, in accordance with step #4, the syntax is not OK, fix it. If it is OK, apply the new configuration:

    For Debian based systems (Ubuntu/Debian):

    # service apache2 reload

    For RHEL based systems (CentOS/CloudLinux):

    # service httpd reload

Note: Whitelist rules should be placed before other rules.
For details see:
ModSecurity Core Ruleset documentation - Writing Whitelist Modifications 
https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v2.x%29#ipMatch

For OWASP ruleset on Windows

    1. Log into the Plesk.
    2. Go to Tools & Settings > Web Application Firewall (ModSecurity) >Settings.
    3.  Add the rule below into the Custom directives field:

      SecRule REMOTE_ADDR "@ipMatch 203.0.113.0/24,192.0.2.2" "id:3,phase:1,t:none,log,pass,ctl:ruleRemoveById=55666"

      Where:
      55666 - is the existing ModSecurity Rule and it should be replaced with the required rule ID.
      203.0.113.0/24 - IP addresses that are required to whitelist. Multiple, comma-separated, addresses can be also specified.  

    4. Press the OK button to apply the changes.

For Comodo ruleset

  • Via Plesk GUI
  1. Log into the Plesk.
  2. Go to Tools & Settings > Web Application Firewall (ModSecurity) > Settings.
  3.  Add the rule below into the Custom directives field:

    SecRule REMOTE_ADDR "@ipMatch 203.0.113.0/24,192.0.2.2" "id:3,phase:1,t:none,log,pass,ctl:ruleRemoveById=55666"

    Where:
    55666 - is the existing ModSecurity Rule and it should be replaced with the required rule ID.
    203.0.113.0/24 - IP addresses that are required to whitelist. Multiple, comma-separated, addresses can be also specified.  

  4. Press the OK button to apply the changes.

 

  • Using command-line method
  1. Connect to the server via SSH.

  2. Create/ open for editing ModSecurity file that is used for IP whitelisting:

    For Debian based systems (Ubuntu/Debian):

    # vi /etc/apache2/plesk.conf.d/modsecurity.conf

    For RHEL based systems (CentOS/CloudLinux):

    # vi /etc/httpd/conf/plesk.conf.d/modsecurity.conf

    Add the following rule in 1 line there:

    SecRule REMOTE_ADDR "@ipMatch 203.0.113.0/24,192.0.2.2" "id:3,phase:1,t:none,log,pass,ctl:ruleRemoveById=55666"

    Where:
    55666 - is the existing ModSecurity Rule and it should be replaced with the required rule ID.
    203.0.113.0/24 - IP addresses that are required to whitelist. Multiple, comma-separated, addresses can be also specified.  
    Check Apache syntax:

    For…

Tweet
Share
Share
Email
0 Shares
Read the full article
Related Posts

Your Complete .htaccess Guide: Including .htaccess Basics and More

Read More »

NGINX vs Apache – Which Is the Best Web Server in 2024?

Read More »

Top Web Servers For Linux And Windows

Read More »
Knowledge Base

How to enable leverage browser caching for Apache in Plesk

Read More »

How to enable remote access to MySQL/MariaDB server in Plesk?

Read More »

Unable to upload file to website on Plesk: Request body no files data length is larger than the configured limit

Read More »

All websites hosted in Plesk are not accessible over HTTPS: 502 Bad Gateway or ERR_CONNECTION_REFUSED

Read More »

Hosting Wiki

  • Django
  • RESTful Web Service
  • GIT
  • Server Redundancy
  • Cloud Service Architecture
  • Virtualizor
  • On-Demand Services
  • Linux Containers
  • Google Cloud CDN
  • GitHub
  • Bare Metal Server
  • Denial of Service
  • Red Hat Virtualization
  • Virtuozzo
  • Oracle VM Server
  • Citrix Hypervisor
  • Server Virtualization Software
  • Windows Server
  • Linux
  • Virtualization
  • JavaScript
  • MongoDB
  • VirtualMin
  • Plesk
  • Apache Tomcat
  • Apache
  • Web Server
  • DNS Server
  • IPv6
  • IPv4
  • SIP
  • SSH
  • UDP/IP
  • Firewall
  • Email Virus Protection
  • TCP/IP
  • HTTP

Industry
Partners

industry-partner_ALIBABA
industry-partner_GOOGLEPARTNER
industry-partner_MICROSOFT
industry-partner_REDHAT-r2
industry-partner_ALIBABA
industry-partner_AUTOMATTIC
industry-partner_AWS
industry-partner_DIGITALOCEAN
industry-partner_SCALEWAY
Follow us:
Facebook Twitter Linkedin Youtube Github

COMPANY

About Plesk
Our Brand
Legal
Careers
Impressum

PRODUCT

Pricing 
Extensions
What’s new

KNOWLEDGE BASE

Documentation
Help Center
Migrate to Plesk
Contact Us
Hosting Wiki
Preview releases

PROGRAMS

Contributor Program NEW
Partner Program
Affiliate ProgramNEW

COMMUNITY

Blog
Forums 
Plesk University

First defaul

Company

About Plesk
Our Brand
Legal
Careers
Impressum

PRODUCT

Pricing 
Extensions
What’s new

KNOWLEDGE BASE​

Documentation
Help Center
Migrate to Plesk
Contact Us
Hosting Wiki
Preview releases

PROGRAMS​

Contributor Program NEW
Partner Program
Affiliate ProgramNEW

COMMUNITY​

Blog
Forums
Plesk University

Follow us:
Facebook Twitter Linkedin Youtube Github

© 2025 WebPros International GmbH. All rights reserved. Plesk and the Plesk logo are trademarks of WebPros International GmbH.

Managed with love with Plesk WP Toolkit