How to Disable a Domain From Sending Email

You can easily disable inbound email for a single domain simply by switching off the MX records and/or removing the domain from /etc/localdomains.  However, disabling a domain from sending email off of your server is slightly more complicated.  Even if you manage to disable the domain of an account from sending out, you still have to deal with the fact that the cPanel user itself can send email.  This user has the address of user@serverhostname, and is the default sender for scripts that utilize sendmail.  In other words, any PHP or Perl script that sends email off of your server without using proper SMTP authentication will send mail as the cPanel user.

Disable Email from Specific Domains

First, create a file called /etc/blockedsenderdomains, and add the list of domains to block email from to this file, one line at a time.
Then go into WHM > Exim Configuration Manager > Advanced Editor, and add the following to “Section: CONFIG” part:

domainlist blocked_domains = lsearch;/etc/blockedsenderdomains

In the ROUTERSTART section, add:

reject_domains:
 driver = redirect
 domains = +blocked_domains
 allow_fail
 data = :fail: Connection rejected: SPAM source $domain is manually blacklisted.

Then save the file.

New cPanel Installer Requirements

As of this writing, the newest version of the cPanel installer poses some additional requirements for new installations:

  • cPanel must be installed on target version 11.40
  • For any Redhat-based OS (RHEL, CentOS, CloudLinux), you must be on version 6

If your server does not meet these requirements, you have two options:

A.  Install version 11.38 as a target version

To do this, you’ll need to create a file called /etc/cpupdate.conf before cPanel is installed on your server.  In this file, add:

CPANEL=11.38

Then run the installer normally:

wget http://layer2.cpanel.net/latest
sh latest

From here, you can upgrade to the latest version by replacing “CPANEL=11.38” with:

CPANEL=stable

or the version you want to upgrade to, ie:

CPANEL=11.42

Then run /scripts/upcp to update.

B. Force the installation

Download the installer and run with the –force flag:

sh latest --force

Note that these instructions will become invalid once cPanel 11.38 becomes EOL.  The restrictions are intended to encourage system administrators to run the latest software.

How to Clean up the /boot Partition

As updates run on your server over time, you’re likely going to accumulate a number of different kernel versions.  When upgrading within the same OS version, old kernels don’t typically get cleaned up automatically.  This is to enable you to “roll back” to an older kernel if you experience problems with a newer one.

A common consequence of this is the /boot partition filling up with old kernel images.  You can safely uninstall any kernel version that you are not currently running.  To get your current running kernel, use uname:

uname -r

This will output something like:

2.6.32-431.3.1.el6.x86_64

Now find a list of all installed kernels:

rpm -qa |grep kernel

You can remove the kernel and kernel-devel packages for any kernel that you are not currently running.  In this example, you’ll not want to remove kernel-2.6.32-431.3.1.el6.x86_64.  You will usually not find more than one instance of kernel-headers or kernel-firmware, but if you do, you can remove the unused version of those too.

Note: If you’re running Ksplice for kernel updates, there are actually two kernels you should not remove: that’s the one listed above, as well as the one shown in the output of “uptrack-uname -r”.  While Ksplice patches the kernel in memory, removing an existing RPM for the acting kernel can cause unpredictable behavior.

Remove the old kernels as so:

rpm -e kernel-2.6.32-358.0.1.el6.x86_64

rpm -e kernel-devel-2.6.32-358.18.1.el6.x86_64

And so on.  Doing this will free up the unneeded files from /boot.

 

 

How to Upgrade to MySQL 5.6 on cPanel

cPanel 11.42 and higher supports MySQL 5.6.  Upgrading is simple, and if you’re coming from MySQL 5.5 you will not need to recompile PHP after the upgrade.

If you’re coming from a version prior to 5.5, it’s recommended that you upgrade to 5.5 first, then to 5.6.  The following upgrade process can be used for essentially any supported MySQL upgrade in cPanel versions 11.36 and higher.

First, set the cpanel.config file to the intended version:

/var/cpanel/cpanel.config

Look for mysql-version=, and set this to 5.6.

Then run the following script:

/usr/local/cpanel/scripts/check_cpanel_rpms –fix

This will remove the old MySQL version, install the new one, and update all tables.

If you are coming from a version earlier than 5.5, you will likely need to reinstall PHP by running EasyApache.  This is due to the fact that PHP is compiled against the MySQL client libraries, which will be different after the MySQL is upgraded.

#cpanel, #mysql-version, #php