RSS Feed
Jul 14

Small application for disabling mod_security for specific domains on cPanel server

Posted on Tuesday, July 14, 2009 in cpanel, linux, mod_security, script

Alright, I’m lazy so I always make a script/utility for anything and everything. Another fine piece of lazygineering.

This little script disables mod_security on specific domains that you pick, mod_security2 does not allow disabling it from .htaccess and it’s pretty annoying to do the same work all over and over again, why not make it one line only. :)

Introducing, disable_modsec — Enjoy lazy cPanel server admins.

#!/usr/bin/perl

use strict;
use lib qw(/usr/local/cpanel);
use Cpanel::AcctUtils::DomainOwner;

if ($ARGV[0])
{
# Get username
my $username = Cpanel::AcctUtils::DomainOwner::getdomainowner($ARGV[0]);
my $domain = $ARGV[0];

# Create directory for config
system ('mkdir -p /usr/local/apache/conf/userdata/std/2/'.$username.'/'.$domain);

# Create config file
open (CONFIG, ">>/usr/local/apache/conf/userdata/std/2/".$username.'/'.$domain.'/modsec.conf');
print CONFIG "\nSecRuleEngine Off\n";
close CONFIG;

# Enable vHost includes
system ('/scripts/ensure_vhost_includes --user='.$username);
} else {
print("Usage: disable_modsec [domain]\n");
}

Jan 5

Horde broken or not working correctly on cPanel server

Posted on Monday, January 5, 2009 in cpanel, fix, horde, linux, quick fix

Simple, short & sweet post, this should easily fix any problems you’re having

/usr/local/cpanel/bin/update-horde --force

Also, this might be useful to run hourly, I leave this on our servers “just in case”.

(mysqlcheck --auto-repair eximstats ; mysqlcheck --auto-repair horde) >/dev/null 2>/dev/null