Wednesday 20 August 2014

Can't connect to socket. Maybe governor is not started- dbtop command error

Issue:
# dbtop
Can't connect to socket. Maybe governor is not started

Analysis:
Check error log for db governor /var/log/dbgovernor-error.log when running this command. I got below errors from log.
---------------------
Try to connect with options from dbgovernor config file
Try to connect with no password under root
Update your MySQL to CLL version from repo.cloudlinux.com. Current is 5.5.37-cll
Incorrect mysql version
Failed governor daemon, restart daemon
---------------------

 The db governor configuartion is looking for a different version of MySQL hence the issue. We need to correct the db governor configuartion with current MySQL version.

Fix:
Run the following commands:

# /usr/share/lve/dbgovernor/db-select-mysql --mysql-version=MYSQL_VERSION
# /usr/share/lve/dbgovernor/mysqlgovernor.py --install

Thats it!!

Sunday 17 August 2014

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
it is not the error bcoz when mysql deamon starts it 1st checks the /tmp/mysql.sock
if /tmp permission changes to other than 777 then the above error comes
i've faced the same error
when i checked /var/lib/mysql/ for mysql.sock it didn't found there it never happens when it is not found but if not found then try to create uor self command is

cd /var/lib/mysql
touch mysql.sock
chown mysql:mysql mysql.sock
chmod 1777 mysql.sock

now make a sym link into /tmp

ln -s /var/lib/mysql/mysql.sock /tmp
then
chmod 1777 /tmp

now
/scripts/mysqlup --force


now just restart mysql
/etc/rc.d/init.d/mysql restart

Saturday 2 August 2014

Mod security disable for an account

In cpanel follow the steps below:

mkdir -p /usr/local/apache/conf/userdata/std/2/<username>/<domain.com>
nano /usr/local/apache/conf/userdata/std/2/<username>/<domain.com>/mod_security.conf
Add the following code to mod_security.conf:
 <IfModule mod_security2.c>
 SecRuleEngine Off
 </IfModule>
/scripts/ensure_vhost_includes --user=username


Reference: http://forums.cpanel.net/f185/how-disable-mod_security2-rule-one-domain-73135.html

Find files which are above 1G in size

Find files which are above 1G in size

find /home/ -type f -size +1048576 -printf "%s:%h%f\n"

WordPress xmlrpc vulnerability

There are four ways that WP‘s XML-RPC API  could be abused by an attacker:

Intel gathering — attacker may probe for specific ports in the target’s internal network
Port scanning — attacker may port-scan hosts in the internal network
DoS attacks — attacker may pingback via large number of sites for DoS attack
Router hacking — attacker may reconfigure an internal router on the network

Possible workarounds:

1. If you aren’t using the XML-RPC functionality for anything, to protect against any vulnerabilities, add below lines .htaccess:

# protect xmlrpc
<IfModule mod_alias.c>
RedirectMatch 403 /xmlrpc.php
</IfModule>

----------------------------------------------
2. To redirect requests for xmlrpc.php to a custom page, modify the RedirectMatch like so:

# protect xmlrpc
<IfModule mod_alias.c>
Redirect 301 /xmlrpc.php http://example.com/custom-page.php
</IfModule>

----------------------------------------------
3. Denying all access to xmlrpc.php:

# protect xmlrpc
<Files xmlrpc.php>
Order Deny,Allow
Deny from all
</Files>

----------------------------------------------
4. Allow access to xmlrpc.php for specific IP addresses only.

# protect xmlrpc
<Files xmlrpc.php>
Order Deny,Allow
Deny from all
Allow from <IP>
Allow from <IP>
</Files>