WHM doesn’t currently have a way to clear out the modsec hit lists under ModSecurity Tools, but it is possible to clear that out by moving the existing database out of the way and running the cPanel script to create a new, empty one. These commands will achieve that:
# mv /var/cpanel/modsec/modsec.sqlite /var/cpanel/modsec/modsec.sqlite-bak
After that is done, the list in WHM will no longer show any hits.
Chris June 18th, 2017
Posted In: cPanel Hosting
If you are running a cPanel server, you are able to use EasyApache to add and remove many PHP extensions. cPanel has the ability to also install and uninstall PHP modules on the fly using the phpextensionmgr, which can be found at /scripts/phpextensionmgr. You are able to see the usage and option by using the –help flag, as shown below.
[email protected] [~]# /scripts/phpextensionmgr --help Usage: phpextensionmgr [options] [action] [extension] Options: --help Help message --prefix Installation prefix for PHP (normally /usr/local or /usr/local/php4) Actions: install Install or update the extension uninstall Uninstall the extension status Display the installation status of the extension list Show available extensions
As you can see, you are able to install, uninstall, display whether or not the extension is installed, or list all of the available modules. Running the list command as below will show all of the modules that are available to be added on your server.
[email protected] [~]# /scripts/phpextensionmgr list Available Extensions: EAccelerator IonCubeLoader Zendopt Xcache SourceGuardian PHPSuHosin
You can also find the status of a single module by using the status flag.
[email protected] [~]# /scripts/phpextensionmgr status Xcache Updating md5sum list Fetching http://httpupdate.cpanel.net/cpanelsync/easy/targz.yaml (connected:0)....... (request attempt 1/12)...Using dns cache file /root/.HttpRequest/httpupdate.cpanel.net ......searching for mirrors (mirror search attempt 1/3)...... mirror search success......connecting to 126.96.36.199... @188.8.131.52......connected......receiving...100%......request success......Done Downloading tarball for Xcache Fetching http://httpupdate.cpanel.net/cpanelsync/easy/targz/Cpanel/Easy/Xcache.pm.tar.gz (connected:0)....... (request attempt 1/12)......connecting to [email protected] receiving...100%......request success......Done Determining status of Xcache Xcache extension is NOT installed
If we wanted to install Xcache, we would use the install flag, which will take care of the entire install process. Keep in mind that we are only using Xcache as an example and it’s usage will depend on your server configuration as well.
[email protected] [~]# /scripts/phpextensionmgr install Xcache Installing Xcache Determining PHP version Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626 Will now run system( ./configure,--with-php-config=/usr/local/bin/php-config ) 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... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ANSI C... none needed ..... ..... (More compiling stuff) .... .... /bin/sh /home/cpeasyapache/phpextensions/xcache/xcache-1.3.2/libtool --mode=install cp ./xcache.la /home/cpeasyapache/phpextensions/xcache/xcache-1.3.2/modules cp ./.libs/xcache.so /home/cpeasyapache/phpextensions/xcache/xcache-1.3.2/modules/xcache.so cp ./.libs/xcache.lai /home/cpeasyapache/phpextensions/xcache/xcache-1.3.2/modules/xcache.la PATH="$PATH:/sbin" ldconfig -n /home/cpeasyapache/phpextensions/xcache/xcache-1.3.2/modules ---------------------------------------------------------------------- Libraries have been installed in: /home/cpeasyapache/phpextensions/xcache/xcache-1.3.2/modules If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- Build complete. Don't forget to run 'make test'. Got ret value 0 from system( make ) Will now run system( make,install ) Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20090626/ Got ret value 0 from system( make,install ) Will now run system( make,clean ) find . -name \*.gcno -o -name \*.gcda | xargs rm -f find . -name \*.lo -o -name \*.o | xargs rm -f find . -name \*.la -o -name \*.a | xargs rm -f find . -name \*.so | xargs rm -f find . -name .libs -a -type d|xargs rm -rf rm -f libphp.la modules/* libs/* Got ret value 0 from system( make,clean ) Xcache extension activated ./cpanel-install exiting with exit code 0
If you wanted to remove that module, you could do so with the uninstall flag.
[email protected] [~]# /scripts/phpextensionmgr uninstall Xcache
Removing xcache from /usr/local/lib/php.ini
Using /scripts/phpextensionmgr can help you to add, remove, find the status of particular modules and list the available modules. In you day to day work, this can help you to save time by not needing to run EasyApache to install the PHP modules which can save time and unnecessary load on your server.
Chris May 16th, 2012
Posted In: How To
If you have ever used cPanel, there may have been a time that a DNS zone was missing even though your domain was already added on. If you have root access, you are able to fix this by using the adddns script. This is located in the /scripts directory, but only if you are using cPanel. So to use this, you will define the domain and the IP that it is for.
/scripts/adddns --domain=site.com --ip=123.456.7.89
That will create a dns zone for the domain site.com with the address on the server of 123.456.7.89. You can then check /var/named/site.com.db to make sure that it created successfully.
Chris January 18th, 2011
You are able to create a backup of a cPanel user’s account by using the pkgacct command in the /scripts directory that can be found on any server that has cPanel installed. If you needed to create a backup of the account for a user named user1, you would need to be in a root shell, then run the following command.
Unfortunately, cPanel backups are limited to 4GB, but using the command line, you are able to surpass that limitation and force it to back up the account by using the following:
/scripts/pkgacct user1 --skip-limit-flag
Adding on the –skip-limit flag will allow it to skip the 4GB limit and create the backup. Then, when the script is finished and the backup has completed, it will tell you the path that it placed the backup and you can move it to whichever directory you would like. If you are creating this for a user that does not have root access, you will want to put it in their home directory as well as chown it to the user so that they are able to download the backup as well.
Chris January 18th, 2011
If you are hosting with cPanel and had a domain removed and would like to find out when, you can check in the cPanel access logs like this:
~]#grep cpaneluser /usr/local/cpanel/logs/access_log |grep domain|grep dodeldomainconfirm
Also, using the same method, you can find out when a subdomain was deleted
~]#grep cpaneluser /usr/local/cpanel/logs/access_log |grep subdomain|grep dodeldomainconfirm
Be sure to replace cpanel user with the cpanel username that owned the domain and domain or subdomain with the actual domain or subdomain that you are looking for.
Chris January 13th, 2011
Posted In: cPanel Hosting