When setting up your cPanel & WHM installation, a few items, such as your server's firewall, require configuration. Specific ports need to be set up for the cPanel & WHM software to function accordingly.
You should make sure that you only select ports required by the cPanel & WHM software and that the server is configured to add back the firewall rules when the server is rebooted. This way, you can minimize unforeseen events.
Before setting up, we recommend making sure that you have the best practices in place. You should ensure that you have access to your server at all times, ideally from the system console or other out-of-band access.
To begin setting up, you have a few options available to choose from, depending on your Operating System. Here are the steps to open the ports.
For CentOS 7, CloudLinux 7, and RHEL 7 firewall management. Firewalld packages should be installed by default. In case it's not available, you can install it by running the following command:
yum install firewalld -y
In cPanel, we have an available script that will apply all the required cPanel firewall rules. On an important note, our configuration script will remove all existing rules from the iptables rules. Make sure that you have made a copy of those before running our script; you can create a backup with a command like this one:
iptables-save > /root/iptables.save
To configure the cPanel firewall rules:
More documentation is available here to help you to configure your firewall: