How to whitelist Mod_security rules for a domain on a CPanel server


How to whitelist Mod_security rules for a domain on a CPanel server


How to whitelist Mod_security rules for a domain on a CPanel server

First off-all, you need to find the Rule ID. You can find it from the apache error log (grep for your IP) or if you have CSF installed and keep getting your IP blocked, check /etc/csf/csf.deny to see if its listing the mod_security rule that you were blocked from.

Once you have the rule’s id number, you will need to create the following file and directory, as some of them are not there by default.

# mkdir -p /usr/local/apache/conf/userdata/std/2/user/domain.com
# vim /usr/local/apache/conf/userdata/std/2/user/domain.com/domain.com.conf

Add the following lines and whitelist some mod_security rules.

#
SecRuleRemoveById
#

Be sure to replace with the Rule ID number of the mod_security rule you need to whitelist. Save the file, and then run the following commands, replacing with the actual cpanel user name.

Enabling the userdata includes in Apache conf
/scripts/ensure_vhost_includes –user=cpanel user

This uncomments a line in the VirtualHost entry in httpd.conf for this domain to include any .conf files in /usr/local/apache/conf/userdata/std/2/user/domain.com/

[# /usr/local/cpanel/bin/apache_conf_distiller –update
# /usr/local/cpanel/bin/build_apache_conf

These compile and distill the changes into Apache’s configuration.

Bu cevap yeterince yardımcı oldu mu?

Diğer Dökümanlar


  • Network monitoring on Linux

    Network monitoring on Linux This post mentions some linux command line tools that can be used to monitor the network usage. These tools monitor the traffic flowing through network interfaces and...

  • df -i /tmp folder is full

    Install tmwatchftp://ftp.muug.mb.ca/mirror/centos/6.5/os/x86_64/Packages/tmpwatch-2.9.16-4.el6.x86_64.rpmthen run  /usr/sbin/tmpwatch -am 1 /tmp/nginx_clientthen add cron filelike this0 */1 *...

  • Accessing a Fedora Logical Volume from Ubuntu

    A while back, I started experimenting with Ubuntu after playing with Fedora. I decided to jump to Ubuntu and needed to move data from the Fedora-managed logical volume to Ubuntu. Here's what I...

  • How to create a partition size larger than 2TB on Linux

    How to create a partition size larger than 2TB on Linux Parted is a GNU utility and used to create, manipulate and delete the hard disk partitions. Select the drive that you need to create #...

  • RSZDT

    what is RSZDT mean ? PROCESS STATE CODES -different values that the s, stat and state output specifiers(header “STAT” or “S”) will display to describe the state of a...