Showing posts with label cPanel. Show all posts
Showing posts with label cPanel. Show all posts

Tuesday, January 26, 2016

Find Files Sending SPAM On cPanel Exim Server

This will check your exim_mainlog and dump the paths from which mail has been sent along with the number. Check the listed directory for malware, shells, etc:
grep cwd /var/log/exim_mainlog | grep -v /var/spool | awk -F"cwd=" '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -n

Tuesday, July 21, 2015

Symlink ClamAV Binaries On A Linux cPanel Server

ln -s /usr/local/cpanel/3rdparty/bin/freshclam /usr/local/bin/freshclam
ln -s /usr/local/cpanel/3rdparty/bin/clamscan /usr/local/bin/clamscan
ln -s /usr/local/cpanel/3rdparty/bin/clamd /usr/local/bin/clamd
ln -s /usr/local/cpanel/3rdparty/bin/clamav-config /usr/local/bin/clamav-config

Install ClamAV From The Command Line On A cPanel Server

Pretty simple task here and makes installing ClamAV easier shot you not have the root password for the customers installation:
/scripts/update_local_rpm_versions --edit target_settings.clamav installed
/scripts/check_cpanel_rpms --fix --targets=clamav

Monday, March 10, 2014

Wednesday, January 29, 2014

How To Disable Eximstats on cPanel

Eximstats does just what it implies, keeps stats on exim(email). Sometimes you don't care about these stats and want to free your database and I/O up for more important things. Luckily you can via the following CLI command:
/usr/local/cpanel/bin/tailwatchd -–disable=Cpanel::TailWatch::Eximstats
You may want to truncate the related tables for eximstats in MySQL before doing this (to save time if they are crashed,etc) but is not required nor necessary as the above will clear the tables (but will bawk if they are crashed, etc)

Wednesday, October 23, 2013

Install Suhosin For PHP 5.4 On cPanel Linux

EDIT: Since the release of this article, new versions of SuHosin have been release with official PHP 5.4+ support.

Please go to:
https://github.com/stefanesser/suhosin/releases

...for the most current version.


1) Grab the current source from github:
cd /usr/local/src

wget https://github.com/stefanesser/suhosin/tarball/master

tar zxvf master
2) Change to the directory just created and then prep Suhosin for PHP
cd /usr/local/src/stefanesser-suhosin-[this will change]

mv session.c session.c.old
wget https://raw.github.com/blino/suhosin/117b6aa6efec61afaa1431c698dad8eb553b55f5/session.c

phpize
Note: We pull the custom session.c above to fix an issue with NULL sessions in PHP 5.4, more info:
https://github.com/stefanesser/suhosin/pull/26

3) Configure, make and install
./configure && make && make install
4) Enable in PHP
echo extension=suhosin.so >> /usr/local/lib/php.ini
5) Restart Apache and check PHP
service httpd restart

php -v
...and you should see:

PHP 5.4.21 (cli) (built: Oct 23 2013 16:48:02)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies
with Suhosin v0.9.34-dev, Copyright (c) 2007-2012, by SektionEins GmbH

Tuesday, September 17, 2013

Install Memcache and PHP Memcache on cPanel

Step 1: Create work directory
cd /usr/local/src
mkdir memcached-sources
cd memcached-sources
Step 2: Download, compile and install LibEvent
mkdir libevent
cd libevent
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar xvfz libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure; make; make install
cd /usr/local/src/memcached-sources/
Step 3: Download, compile and install Memcache
mkdir memcache
cd memcache
wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz
tar xvfz memcached-1.4.15.tar.gz
cd memcached-1.4.15
./configure --with-lib-event=/usr/local/; make; make install
cd /usr/local/src/memcached-sources/
Step 4: Register LibEvent
echo /usr/local/lib/ > /etc/ld.so.conf.d/libevent-i386.conf
ldconfig
Step 5: Download, compile and install PHP Memcache module
mkdir memcache-php
cd memcache-php
wget http://pecl.php.net/get/memcache-3.0.8.tgz
tar xvfz memcache-3.0.8.tgz
cd memcache-3.0.8
phpize
./configure; make; make install
echo >> memcache.so /usr/local/lib/php.ini
service httpd restart
Step 6: Daemonize Memcache
See this article:
http://www.shiftedbytes.com/2013/06/daemonize-memcached-to-run-memcached-as.html

Monday, June 17, 2013

How To Fix ERROR: column "spclocation" does not exist in PostgreSQL 9.2 on cPanel/WHM in phpPgAdmin When Creating Databases

This will patch up the problems with the cPanel supplied version of phpPgAdmin as of cPanel/WHM 11.38.0 (build 16) when creating a database you get:
ERROR: column "spclocation" does not exist
If you are using newer/custom version of phpPgAdmin likely doesn't apply to you and you probably won't be reading this ;)

Step 1: Get to the classes
cd /usr/local/cpanel/base/3rdparty/phpPgAdmin/classes/database/
Step 2: Duplicate the 8.4 file for 9.2
cp Postgres84.php Postgres92.php
Step 3: Add a case statement for 9.2
vi Connection.php
...scroll down to the case section and add:
case '9.2': return 'Postgres92'; break;
...after the case for 8.4

Step 4: Duplicate essential functions
vi Postgres.php
...copy the "getTablespaces" and "getTablespace" functions and add them to the class inside
vi Postgres92.php
Step 5: Edit the functions
vi Postgres92.php
... and replace ", spclocation," with ", pg_tablespace_location(oid) as spclocation," inside both functions

Step 6: Set the proper version
vi Postgres92.php
...edit FROM
class Postgres84 extends Postgres {
var $major_version = 8.4;
... TO
class Postgres92 extends Postgres {
var $major_version = 9.2;
That should fix everything up nicely.

Wednesday, June 5, 2013

Install PostgreSQL 9.2 with cPanel/WHM on CentOS Linux

While cPanel still only officially supports PostgreSQL as provided by the CentOS repo's, the following is a fool proof method for fully integrating PostgreSQL 9.2 into cPanel/WHM on CentOS without any issues.

Note: This was performed on a vanilla CentOS 6.4 installation with cPanel/WHM 11.36.1 (build 6)

Step 1: Grab the correct PostgreSQL 9.2 rpm pacakge for your Linux distribution from:
http://yum.postgresql.org/repopackages.php#pg92

...and then install it
[/usr/local/src]# wget http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm
[/usr/local/src]# rpm -i pgdg-centos92-9.2-6.noarch.rpm 
Step 2: Install the PostgreSQL 9.2 software:
[/usr/local/src]# yum groupinstall "PostgreSQL Database Server PGDG" -y 
[/usr/local/src]# yum install postgresql92-devel.x86_64 -y 
Step 3: Initialize the PostgreSQL 9.2 database:
[/usr/local/src]# service postgresql-9.2 initdb
Step 4: Start PostgreSQL 9.2 on boot:
[/usr/local/src]# chkconfig postgresql-9.2 on
Step 5: Create the proper symlinks for cPanel/WHM integration:
[/usr/local/src]# cd /usr/pgsql-9.2/bin/; for f in *; do echo $f; [ -e /usr/bin/$f ] && mv /usr/bin/$f /usr/bin/$f.8; ln -s $(pwd)/$f /usr/bin/$f; done
[/usr/local/src]# cd /var/lib/pgsql; ln -s 9.2/backups; ln -s 9.2/data; ln -s 9.2/pgstartup.log
[/usr/local/src]# cd /usr/pgsql-9.2/lib; ln -s libpq.so.5.5 libpq.so
Step 6: Start the PostgreSQL 9.2 server:
[/usr/local/src]# service postgresql-9.2 start
Step 7: Install the PostgreSQL 9.2 cPanel/WHM config:

-Log into cPanel/WHM as root
-Navigate to "Home > SQL Services > Configure PostgreSQL"
-Click on "Install config"

Step 8: Install/update phpPgAdmin:
[/usr/local/src]# /usr/local/cpanel/bin/updatephppgadmin --force
Step 9: Exclude PostgreSQL from yum:

You'll want to add "exclude=postgres*" to the [base] and [updates] section of this file:
[/usr/local/src]# vi /etc/yum.repos.d/CentOS-Base.repo
...this will prevent yum from accidentally installing the repo version of PostgreSQL in the future.

That's all there is to it =) Now you can enjoy full, native integration without any fuss

Tuesday, April 9, 2013

Wednesday, March 20, 2013

Install Imagick ImageMagick On cPanel

yum -y install ImageMagick-devel ImageMagick-c++-devel
/usr/bin/pecl install imagick
The PECL installer will not handle the module installation correctly so you have two things to do.

First add "extension=imagick.so" to the end of php.ini (/usr/local/lib/php.ini)

Second, move the module to the correct directory:
cp /usr/lib/php/extensions/no-debug-non-zts-20090626/imagick.so /usr/local/lib/php/extensions/no-debug-non-zts-20090626/
Please note your extension directory migght be different and can be found in php.ini under "extension_dir"

Now restart Apache:
service httpd restart
...and then check to see PHP is loading the module:
php -i | grep -i imagick
...which should provide this if installed:
imagick
imagick module => enabled
imagick module version => 3.0.1
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version => ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP http://www.imagemagick.org
ImageMagick copyright => Copyright (C) 1999-2009 ImageMagick Studio LLC
ImageMagick release date => 2012-05-07
ImageMagick number of supported formats:  => 198
ImageMagick supported formats => A, AI, ART, ARW, AVI, AVS, B, BGR, BMP, BMP2, BMP3, BRF, BRG, C, CALS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DNG, DOT, DPS, DPX, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, FAX, FITS, FRACTAL, FTS, G, G3, GBR, GIF, GIF87, GRADIENT, GRAY, GRB, HALD, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, JNG, JP2, JPC, JPEG, JPG, JPX, K, K25, KDC, LABEL, M, M2V, M4V, MAP, MAT, MATTE, MIFF, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NULL, O, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSD, PTIF, PWP, R, RADIAL-GRADIENT, RAF, RAS, RBG, RGB, RGBA, RGBO, RLA, RLE, SCR, SCT, SFW, SGI, SHTML, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, Y, YCbCr, YCbCrA, YUV
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0

Domain Audit cPanel List Number Of Domains Per User

for x in `ls /var/cpanel/users|grep -v \/`; 
do echo "## Domains for user $x ##"; 
grep DNS /var/cpanel/users/$x|grep -v ^X|cut -d '=' -f 2|cat -n; 
echo; done > /root/domainAudit.txt

Resolve cPanel Update Now Failing MySQL RPM Dependancies

If cPanel is failing nightly UpdateNow based on RPM errors:
error: Failed dependencies:
MySQL conflicts with mysql-5.0.77-4.el5_5.3.i386
W Exit Code: 254
***** FATAL: Test install failed: error: Failed dependencies:
MySQL conflicts with mysql-5.0.77-4.el5_5.3.i386
You can easily fix it using the following:
[~]# rpm -qa | grep mysql-5
mysql-5.0.77-4.el5_5.3

[~]# rpm -e --nodeps --allmatches --justdb mysql-5.0.77-4.el5_5.3

[~]# /scripts/upcp --force

This essentially does the following:
1) Determines the RPM package causing the conflict
2) Removes RPM database entry for package
3) Forces an update of the control panel

Thursday, February 7, 2013

Increase The Size Of securetmp In cPanel

First stop all services that might be accessing /tmp:
/etc/init.d/cpanel stop
/etc/init.d/httpd stop
/etc/init.d/mysql stop
Next, unmount /tmp from the current secured mount:
umount -l /tmp
umount -l /var/tmp
Next, backup the current secured mount:
mv /usr/tmpDSK /usr/tmpDSK_back
Next, edit:
/scripts/securetmp
...and change the variable for $tmpdsksize to what size you want, in kilobytes

Next, run the securetmp script:
/scripts/securetmp
Finally, restart the services stopped previously:
/etc/init.d/cpanel start
/etc/init.d/httpd start
/etc/init.d/mysql start
You can confirm the size of /tmp by checking the output of:
df -h

Tuesday, February 5, 2013

Disable cPanel cPHulk From The Command Line Console SSH

To Disable:
/usr/local/cpanel/bin/cphulk_pam_ctl --disable
--OR--
/usr/local/cpanel/etc/init/stopcphulkd stop
To Enable:
/usr/local/cpanel/bin/cphulk_pam_ctl --enable

Monday, February 4, 2013

cPanel Tweak Settings Configuration File Location

/var/cpanel/cpanel.config
Be sure to run:
/usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings
After making any changes manually to this file.

Friday, February 1, 2013