Scripts and other stuff for Cpanel boxes

[CPanel Modules] [Admin scripts] [Apache Modules] [Themes] [Links]

Unless indicated otherwise, the following scripts are copyright by Juan R. Pozo (jrpozo at conclase dot net) and are licensed under the GPL (General Public License).

You can use them for free, but the GPL license applies.

I offer these scripts and tips in the hope that they'll be useful, but without any warranty. Use at your own risk. See the GNU General Public License for more details.

You can also


Please consider making a donation. I have an Amazon wishlist where I have selected several products that I would gladly accept. Thank you :)

Note: CPanel is a trademark of CPanel, Inc. I have no commercial relationship with CPanel, Inc. at all, other than being a user of their product.

API Modules

These are custom modules I wrote for myself or by request from other CPanel users. As you can see CPanel is very easily expandable. By the way, I am open to suggestions, so if you think you have a good idea for improving any of these modules just email me, thanks.


Bandwidth related API calls: show maximum, used and available monthly data transfer, in the units you specify.


Formatted Date/Time related API calls: Today, StartDate.


DNS related API calls: domain name servers, whois, dig.


The default POP account list in Cpanel works well but has customization and i18n problems which make it desirable to have a better alternative. Cpanel's new API can be used to solve most problems but does not address them all. The HCCEmail module allows you to completely customize the POP account list. It allows for multipage listings, diverse ordering schemes, and has full i18n support. HCCEmail also contains an API call to add several accounts at once, which is useful for customers migrating from other providers. The list of addresses is a list of lines like: address@domain, password[, quota].

Thanks to Wilton Bennet for the Portuguese translation.


This is a replacement for Cpanel's FTP account list API call. It permits you to select the accounts you want to show and has full i18n support.


API calls to include web documents: Include, IncludeBodyContents.


This is a replacement for CPanel's Serverinfo API call. It permits you to choose the type of information you want your users to see, and has full i18n support.


This is a very basic module to log the IP and time that users login in their CPanel. It uses a MySQL database to store all the information. A helper application is included to see the latest entries of all or one of your users.


Note: this module is obsolete now, use the SetLang API instead.


Note: This module currently does not work. CPanel must have some sort of cache mechanism that prevents theme changes from taking effect immediately.


This is my catch-all module. Currently it just contains the remnants of the old HCCApi module. Take a look at the documentation for details.


I was having lots of problems with stats generation, especially with Analog cache files and Webalizer DNS reverse resolution, among several other issues. Therefore I decided to write my own logrunner for Analog and Webalizer. I still haven't used AWStats so it's not included yet. More info about HCCStats...


This is a very simple module I wrote as an example for another CPanel user. It just displays a list of subdomain redirections. Use it as an example module if you wish.

Admin tools


Since Apache runs as user nobody, all email sent from scripts executed by Apache is sent by user nobody by default. There are several exceptions to this:

In any other case, the message's Return Path address will be nobody@hostname. This has the nasty effect that the postmaster will receive all the bounces of mail sent by these scripts. "2somebody" is an Exim filter file that tries to determine who the real sender of the bounced message is (by looking for Reply- To and From headers that the user may have set when sending the message), and forwards the bounced message to them instead. Installation instructions are enclosed in the filter file.

The file includes installation notes.


This Perl script emails a plain text and/or HTML bandwidth report to your specified address. It highlights users who have used more than 80% of their alloted bandwidth (data transfer to be precise) and more than 100%. This can be run by root or by any reseller.


This Perl script emails a plain text and/or HTML quota report to your specified address. It highlights users who have used more than 80% of their alloted disk space and more than 100%. This can be run by root or by any reseller.


This Perl script removes the "Added by cpanel" lines from httpd.conf (except the most recently added ones).


This is a replacement for Cpanel's PHP wrapper. The current wrapper doesn't properly pass the POST variables to CPanel. Released under the MIT license.

This was my first incursion in Unix IPC and it was really interesting. I still wonder if it's possible to do the task whithout using an intermediate temp file... Maybe using the CLI SAPI of PHP instead of the CGI one...

Copy this file as /usr/local/cpanel/cpanelphp and make it immutable so it won't be updated by CPanel (or use postupcp):

# /bin/su -
# cd /usr/local/cpanel
# wget
# chown root.root cpanelphp.txt
# chmod 0755 cpanelphp.txt
# cp -a cpanelphp cpanelphp.orig
# mv cpanelphp.perl.txt cpanelphp
# chattr +i cpanelphp


This simple script can be used to determine how an attacker is trying to find a vulnerability in a formmail script. You can then use this information to strengthen your formmail script security.


Allows you to automatically setup and customize an index page for all new created accounts. Instructions enclosed in source file.


Allows you to automatically setup the language of all new created accounts (therefore bypassing WHM's limitation by which default language is always English). Instructions enclosed in source file.

removewormedmail + blockmailfromip

Removes from Exim's queue messages containing scr and pif attachments (99,9% of which are infected emails which spread via a well-known pseudo mail user agent).

postupcp samples

A lot of people don't like the way Cpanel handles software upgrades (rewriting config files and such). Actually, it can be quite tricky to customize your system while Cpanel is installed and running. But you have to think of Cpanel as if it was a very stubborn sysadmin who was in charge of thousands of servers, and he was responsible of the security of all of them. If you were in charge of thousands of servers of different owners, and you had to keep them up to date each and every day, and your reputation depended on 100% of the servers being kept secure, how could you possibly adapt to hundreds of different, changing configurations? So, if you don't want to get rid of this stubborn sysadmin, you'll have to adapt yourself to Cpanel.

Quota scripts


This Perl script displays a list of CPanel users who have used more than 80% of their alloted quota. This is intended to be run by root from the console. (In particular when one of those kernel error messages pops up saying someone is over quota without saying what user it refers to!)

quotafree and quotaused

These are two small scripts which return the available space a user has, in MB; and the space a user has used, as a percentage. They are used by the HCCStats module above, but you could find them useful for your own scripts. They must be called by root.


This script checks that local domains are really local and warns owners (and optionally users) if they aren't. Released under the MIT license.

Apache 1.3 Modules


This is my first Apache module. It allows to catch certain HTTP requests (using regular expressions) in the early stages of processing by Apache, and to send back an arbitrary HTTP error code (or no response at all). This is intended to minimize the effect of MS worms on Apache logs, but can be used to block any unwanted requests. Caught requests can be logged in a separate log file.


This Apache module allows to specify a fake Server String for connections coming from all hosts, and one or more IP addresses or domains from where the real Server String will be seen. That way, when specifying CPanel's as the only allowed domains, WHM will still be able to detect the current version of each loaded module (Note: as of November 11 2005 you need to specify and as allowed domains).


Whis this Apache module and the accompanying helper application you can view the Apache running processes in a top-like display (including domain, %CPU and HTTP request). This module requires Ralph Engelschall's MM library to be installed. You may download it from The latest version supports output to a log file and has a greater time resolution than the initial release.


WHM Themes

The Canarias and Trueblue themes are similar to the standard WHM theme, but they are less fatiguing visually (bigger, scalable fonts, and more comfortable background colors), and will spare you from having to scroll the left frame so much, which will save you a lot of time if you already know where each function is.

These themes can be installed and kept up to date from WHM itself. The -es themes are in Spanish.

I use these themes myself, so I always keep them up to date with CPanel development.

CPanel themes

There are no Cpanel themes at the moment. Developing Cpanel themes requires a lot of work and time. I don't think I could offer a free Cpanel theme without charging for support and upgrades.

One of interesting place to visit: the (unofficial) #cpanel IRC channel on EFnet.

Community forums

Third party themes

Add-ons sites

Articles, tutorials...

Third party support offers CPanel server management and outsourced support services in Spanish.