Bash Script - Whitelist an account in Mod Security

The following script disable Mod Security for an account.

#!/bin/bash
mkdir -p /usr/local/apache/conf/userdata/std/2/$1/$2

echo -e " \nSecRuleEngine Off \n" > /usr/local/apache/conf/userdata/std/2/$1/$2/mod_security2.conf

/scripts/ensure_vhost_includes --user=$1

echo "Mod security disable for the account:$1 successfully"



Note:- Copy the above commands in a .sh file. Here let it be mod_sec.sh then,

# chmod 755 mod_sec.sh
    -To give execute permission to the script.
# ./mod_sec.sh <user_name>  <domain_name>
    -Execute the command as shown above.

This entry was posted by Arun Ghosh. Bookmark the permalink.