How to Install ConfigServer Security & Firewall (CSF) on cPanel

ConfigServer Security & Firewall (CSF) is a popular security tool that provides a comprehensive suite of features to enhance server security. It’s particularly favored by cPanel users due to its ease of integration and powerful firewall capabilities. In this guide, we’ll walk you through the steps to install CSF on a cPanel server.

Prerequisites

Before you begin, ensure you have the following:

  • Root access to your server: You need to be logged in as the root user or a user with sudo privileges.
  • cPanel installed: This guide assumes that cPanel/WHM is already installed on your server.

Step-by-Step Installation

Step 1: Access Your Server via SSH

The first step is to log in to your server via SSH. You can use an SSH client like PuTTY (for Windows) or the terminal (for Linux and macOS).

ssh root@your-server-ip

Replace your-server-ip with the actual IP address of your server.

Step 2: Change to the Root Directory

Once logged in, change to the root directory to keep things organized.

cd /root

Step 3: Download the CSF Package

Next, download the latest version of CSF directly from the official website. This command will download a compressed tarball containing the CSF files.

wget https://download.configserver.com/csf.tgz

Step 4: Extract the CSF Package

After the download is complete, extract the contents of the tarball using the following command:

tar -xzf csf.tgz

This will create a csf directory containing all the necessary files.

Step 5: Navigate to the CSF Directory

Change into the csf directory to prepare for the installation.

cd csf

Step 6: Install CSF on cPanel

Finally, run the installation script specifically designed for cPanel. This script will automatically configure CSF to work with your cPanel installation.

./install.cpanel.sh

Step 7: Verify the Installation

After the installation is complete, you can verify that CSF is installed correctly by running the following command:

csf -v

This command should return the version of CSF you have installed, confirming that everything is set up correctly.

Step 8: Configure CSF

CSF comes with a default configuration that’s generally good enough for most users. However, for enhanced security, it’s recommended to fine-tune the settings according to your server’s needs. The main configuration file is located at:

/etc/csf/csf.conf

You can edit this file with any text editor like nano or vi:

nano /etc/csf/csf.conf

Step 9: Restart CSF and LFD

Once you’ve made your desired changes, restart CSF and its companion service, LFD (Login Failure Daemon), to apply the new settings.

csf -r

Conclusion

Congratulations! You’ve successfully installed and configured ConfigServer Security & Firewall on your cPanel server. CSF provides a robust firewall solution that helps protect your server from various security threats. Don’t forget to periodically update CSF and review your firewall rules to maintain optimal security.

If you encounter any issues or have any questions during the installation process, feel free to reach out or consult the official CSF documentation.