Chromatic cPanel Login theme

Today I am releasing Chromatic, a unique cPanel login theme that VlexoFree members have gotten use to now, free to the public. I have licensed it under GPLv3 so you’re free to do what you wish with it.

Chromatic is fully XHTML 1.1 and CSS3 valid. The theme uses no images (except for the favicon) and all styling is done via CSS. It’s tested with Firefox3 and 4, Opera 10, Safari 5, Google Chrome 6 and IE8.

This theme is great as a elegant streamlined login thats considerably smaller then the default cPanel login theme.

A screenshot (using Chrome on Mac) is below:

Chromatic cPanel Login theme

Chromatic

Demo: WHM | cPanel | webmail

Let me know how you like it and if you see any problems. Also, read the INSTALL file included.

Download Chromatic:
Chromatic-1.0.0.tar

Changelog:
1.0.0 – Initial release

How to use PECL with /tmp mounted with “noexec”

The situation here is that you run a server and when trying to install a PHP module via PECL you receive the “checking whether the C compiler works… configure: error: cannot run C compiled programs.” error followed by the build failing.

The problem is that PECL is trying to write and run the files its trying to build in your /tmp directory, but your /tmp directory is mounted with “noexec” so the files can not be executed. What you will see will look something like this:

Note: I’m building APC on a cPanel CentOS server.

$ pecl install apc
downloading APC-3.0.19.tgz ...
Starting to download APC-3.0.19.tgz (115,735 bytes)
.........done: 115,735 bytes
47 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Use apxs to set compile flags (if using APC with Apache)? [yes] : yes
building in /var/tmp/pear-build-root/APC-3.0.19
running: /root/tmp/pear/APC/configure --with-apxs
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
ERROR: `/root/tmp/pear/APC/configure --with-apxs' failed

One solution out there is to unmount then remount /tmp without ‘noexec’ when trying to build via pecl, but this method opens up a security hole in the server for the time you have it mounted without ‘noexec’. The next method is to build the module yourself using the typical “phpize”, “./configure” then “make install”. This method is better then the first but this one is just a workaround for the problem making you unable to use PECL and still makes you od much more work then you have to with PECL.

My solution to this seems to be the most simple, and easiest one of the bunch. All you have to do is create a symlink from where PECL wants to save and run the files to somewhere where it can run them, in this case /root/tmp, with the following command:

$ mkdir /root/tmp/pear-build-root && ln -s /root/tmp/pear-build-root /tmp/

After running that command (as root or other super user) retry installing your module via PECL and it should now work without issue.

Automatically install DomainKeys on new accounts in cPanel

DomainKeys is an e-mail authentication system designed to verify the DNS domain of an e-mail sender and the message integrity. cPanel supports this but the feature is disabled by default on new accounts. If you want to make it easy on your users and enable this automatically you just need to add a few lines to your postwwwacct file.

The following code runs the domain_keys_installer script at then end of a new account creation, thus enabling DomainsKeys for all new accounts.

Create (if not already there) /scripts/postwwwacct then copy and past the following code into the file:

#!/usr/bin/php
<?php
$opts = array();
$argv0 = array_shift($argv);

while(count($argv)) {
 $key = array_shift($argv);
 $value = array_shift($argv);
 $opts[$key] = $value;
}
shell_exec("/usr/local/cpanel/bin/domain_keys_installer " . $opts['user']);
?>

DomainsKeys will now be installed on all new accounts you create.

Automatically exclude backing up new accounts in cPanel

cPanel is setup so is that if automatic backups are enabled in WHM then every new account will be added to the backup list. If you’re picky about which accounts you want the be backed up and don’t want to manually exclude the accounts upon creation, you can use this method.

What the following code does is writes the username of the account currently being created to the system’s /etc/cpbackup-userskip.conf file to be excluded from backups.

Create (if not already there) /scripts/postwwwacct then copy and past the following code into the file:

#!/usr/bin/php
<?php
$opts = array();
$argv0 = array_shift($argv);

while(count($argv)) {
 $key = array_shift($argv);
 $value = array_shift($argv);
 $opts[$key] = $value;
}

$fp = fopen('/etc/cpbackup-userskip.conf','a');
fwrite($fp,$opts['user'].chr(10));
fclose($fp);
?>

All new accounts will now be excluded from the backup list!