Further Security Steps
WHMCS includes many features to help keep your data safe, but you can simple additional steps to secure your WHMCS installation further.
Contents
- 1 Secure the Writeable Directories
- 2 Secure the configuration.php File
- 3 Move the Crons Directory
- 4 Moving the Crons Directory
- 5 Upgrades and Patches
- 6 Restrict Access by IP
- 7 Change your WHMCS Admin Folder Name
- 8 Restrict Database Privileges
- 9 Enable SSL
- 10 Vendor Directory
- 11 Defending Against Clickjacking
- 12 Server Hardening
Secure the Writeable Directories
We recommend moving all writeable directories to a non-public location to prevent web based access.
For more information and steps to do this, see Securing Writeable Directories.
Secure the configuration.php File
We recommend adjusting the permissions for the "configuration.php" file in your WHMCS root directory. This file contains sensitive data that you can't recover without a backup of the file. To avoid accidentally overwriting, editing or deleting the file, change the permission setting of this file to 400. This provides the system with read-only access and prevents anyone else from reading, editing or executing the file.
To change the permissions on this file, you can run the following command while in your WHMCS root directory:
chmod 400 configuration.php
Attention!
Some systems may require you to set the permission to 440 or 444, depending on the server's configuration. Usually, 400 should suffice, but if you encounter an error loading the application after setting the permission to 400, try 440 and then 444.
License Key Updates
If you need to update your license key, you must set the permissions on this file to 755 to allow the system to edit the file. After the updating the key, you can revert the permissions to 400.
Move the Crons Directory
By default, the system stores cron-related items in the /crons/ directory. We recommend moving the crons directory to a custom private directory above your web root. This will prevent web-based access and help to protect your WHMCS installation.
Moving the Crons Directory
When you customize this location, you must move the directory and update WHMCS's configuration.
For steps to do this, see Moving the Crons Directory.
Upgrades and Patches
Applying updates or patches after customizing your crons directory location requires an additional step. You must upload any updated crons files from the default location to your custom directory.
If you do not move the files, you will see errors and issues with WHMCS's automation.
Restrict Access by IP
For increased protection, if your staff uses fixed IP addresses, you can restrict access to a specific set of IPs. To do this, create a file with the name .htaccess in your WHMCS admin directory with the following content:
Apache 2.2
order deny,allow
allow from 12.34.5.67
allow from 98.76.54.32
deny from all
Apache 2.4
Require ip 12.34.5.67
Require ip 98.76.54.32
You can specify as many different allow from or Require ip lines as you require. You can allow entire IP subnets by specifying just the first part of an IP address (for example, 12.34.). This is .htaccess IP restriction.
Change your WHMCS Admin Folder Name
Optionally, customising the URL of your WHMCS Admin Area can make it harder for bots and malicious users to find it. For steps, see Customising the Admin Directory.
Restrict Database Privileges
Disable any unneeded database privileges.
Most tasks only require the following database privileges:
- DELETE
- INSERT
- SELECT
- UPDATE
- LOCK TABLES
Installation, upgrades, and activating and deactivating modules require the following additional privileges:
- ALTER
- CREATE
- DROP
- INDEX
Enable SSL
As a billing application that handles customer data, there is often private and sensitive data passing between WHMCS and end users' browsers. Having a valid SSL certificate that enables the use of HTTPS and encrypted communication is essential.
After you configure an SSL certificate, enter the https://-enabled URL in the WHMCS System URL text box in the General tab at Configuration () > System Settings > General Settings or, prior to WHMCS 8.0, Setup > General Settings to ensure that the system uses it.
If you do not have an SSL certificate, purchase one.
Vendor Directory
We distribute WHMCS with a vendor directory ("/vendor"). This is a common directory for advanced scripts and applications, such as WHMCS, and includes various common libraries. However, web servers should not serve file requests directly from this path. Only the controlling script or application should load these libraries in order to ensure appropriate context and prevent unexpected behavior.
Apache is the recommended web server software platform on which to run WHMCS. If you are using Apache, the .htaccess file that WHMCS distributes in the /vendor directory should suffice. If you are running Apache and files remain accessible, investigate whether your Apache configuration has disabled the use of .htaccess files or there is a parent configuration that is negating the directive in the provided .htaccess file.
While we don't officially support other web server technologies, we understand that some users do wish to run WHMCS in environments other than Apache. To do this, you must ensure that your web server configuration does not serve files within the /vendor directory.
If you are using NGINX as your web server, see Nginx Directory Access Restriction.
<< Back to Installation Overview
Defending Against Clickjacking
Clickjacking is a type of attack where the attacker commonly uses iframes and styling to load an external page (such as the WHMCS client area) and attempts to trick the user into performing an action that may, unknowingly to the user, give the attacker access to their information. Detailed information on how this type of attack works, the potential effects, and how to defend against it at the server-level by sending the proper Content Security Policy (CSP) frame-ancestors directive response headers that instruct the visitor's browser to not allow framing from other domains can be found in the OWASP Clickjacking article.
Server Hardening
In addition to the above, it is always recommended to perform a general server hardening to help mitigate any possible server security issues, such as preventing unauthorized access.
For help in implementing best security practices, see Security Best Practices and Security Misconfiguration.
Any questions or concerns regarding server security, or items beyond the above, are best addressed to a qualified system administrator. They will be best positioned to review the server, assess the installed software and configuration, and provide tailored recommendations and assistance based on that.