Jul 4 12

SpamAssassin and cPanel

by dt

I was wondering why some emails contain no spamassassin headers at all even if it’s globaly set to on. There is a message size limit in cPanel that prevent scanning of messages bigger than 200 KB *by default). Increase it in WHM -> Exim Configuration Manager -> SpamAssassin: message size threshold to scan to 1-2 MB at least.

May 30 12

Uninstall cPanel

by dt

I found an interesting tutorial about cPanel uninstall here:

Test most scripts, works fine. At the end I also remove unnecessary rpms.

May 26 12

Disable eximstats

by dt

Eximstats (installed by default in cPanel) use MySQL database to store log information. Over time, the database can grow up to few gigabytes. In my opinion those stats are useless, so I remove them. First go in WHM -> Service Manager and disable Eximstats. Then open eximstats database using for example phpMyAdmin from WHM, select all tables and truncate them.

Aug 14 11

Clean Magento Logs

by dt

A small shell script that search for magento databases and clean their logs:

for i in `find /var/lib/mysql/ | grep dataflow_batch_export | awk 'BEGIN { FS = "/" } ; { print $5 }'`; do
echo -n $i " ... "
mysql -e "TRUNCATE dataflow_batch_export; TRUNCATE dataflow_batch_import; TRUNCATE log_url_info; TRUNCATE log_visitor; TRUNCATE report_event; TRUNCATE log_visitor_info; TRUNCATE log_url; TRUNCATE log_quote;" $i
echo "[ DONE ]";

Apr 6 11

Quick & Dirty WordPress Upgrade

by dt

You need to upgrade WordPress each time a new version is released (at least for security reason). Below is a shell script I use to upgrade WP from console. Pay attention to rm -rf lines!

cd wordpress
export WPUSER=`ls -l . | awk {'print $3'} | tail -1`
echo $WPUSER
rm -f latest
wget wordpress.org/latest
rm -rf wordpress
tar xzf latest
rm -f latest
chown -R $WPUSER:$WPUSER wordpress
/bin/cp -aR wordpress/* .
rm -rf wordpress
export WPUSER=''

Sep 15 10

cPanel does not update SpamAssassin

by dt

Looks like a fresh installed cPanel has an outdated SpamAssassin rules that mark legitimate emails as spam. There are 2 obsolate rules: DNS_FROM_OPENWHOIS and FH_DATE_PAST_20XX

Try search /var/log/maillog for these rules. If found, you need to run sa-update

# grep -l DNS_FROM_OPENWHOIS /var/log/maillog

Jan 3 10

Clean Swap

by dt

Quickly clean the swap on linux:
swapoff -a && swapon -a

To see it’s empty, use free command

Oct 29 09


by dt

A new and rewritter php class for cPanel XML API was just published by cPanel:

Oct 29 09

ClamAV 0.95.3 Released

by dt

A new ClamAV version was released few hours ago. If you want to upgrade your cPanel to latest ClamAV version, use this tutorial (version updated).

Oct 28 09

How to Send Mail from Multiple IPs in Exim

by dt

Sometimes you need to configure exim mail server to use multiple IPs for sending mail (for example, when you host a newsletter with too many subscribers) . By default, exim is bound to primary interface, but this can be changed.

Please note that this will break “mailip” feature from cPanel (that allow users with dedicated IPs to send mail from these instead of main server IP). Also, if you enabled SPF, take care to add all new IP addresses to the list of allowed IPs.

First, you need a function that pick a random IP from a list. Add it to /etc/exim.pl (somwhere at the end, above last line)

sub randinet {
@inet = ("x.x.x.1", "x.x.x.2", "x.x.x.3", "x.x.x.4");
return $inet[int rand($#inet+1)];

Then edit /etc/exim.conf and search for a line that start with “interface=”

driver = smtp
interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}

replace last line with

interface = "${perl{randinet}}"

You can do the same for dk_remote_smtp section (this is used for sending signed mails). Restart exim and search the logs for possible errors.