How to Open a Port in CSF Firewall? ( cPanel )

What is a port

A port is a process-specific or an application-specific software construct serving as a communication endpoint. It is used by the transport layer protocols of the Internet Protocols suite such as UDP and TCP. The term port is also used in the hardware devices. They are the physical setup of the systems to get connected with another hardware media. Here, we are going to see about the logical construct that identifies a specific process or network service. An IP address and a protocol will be always associated with the ports and thus completes the destination or origination address of a communication session. Normally, a port is identified for each address and protocol by a port number. The port number is a 16-bit number. Usually, various port numbers are used to identify various services. There are thousands of ports and among them 1024 are reserved by convention to identify specific service types by a host. In the client-server model of application architecture, the ports that network clients connect for service initiation provide a multiplexing service. After initial communication binds to the well-known port number, this port is freed by switching instances of service requests to a dedicated connection-specific port number, so that additional clients can be serviced. In this article, we are going to see how to open ports in CSF with WHM.

What is CSF

CSF is a free and advanced firewall for Linux distributions and Linux based VPS. In addition to the basic functionalities of a firewall, CSF includes other security features such as login, intrusion, and flood detections.

We can open ports in CSF by two methods as listed below.

1) Using the WHM interface.

2) Using the Command Line Interface.

Using the WHM interface

Let’s take a look on how to open a port in CSF with the help of WHM interface.

Steps to open port in CSF

1) Login to your WHM with the root password.

2) Go to the Plugins sections, click on the option ‘ConfigServer Security & Firewall’.

3) Click on the ‘Firewall Configuration’ button to enter into advanced settings.

 

4) In the coming window, go to the ‘IPv4 Port Settings’ section.

5) Now, edit the fields ‘Allow incoming TCP ports’ and ‘Allow outgoing TCP ports’

# Allow incoming TCP ports

TCP_IN = “20,21,22,25,26,53,80,110,143,443,465,587,993,995,2077”

# Allow outgoing TCP ports

TCP_OUT = “20,21,22,25,26,37,43,53,80,110,113,443,465,873,2087”

 6) Save the changes made.

7) Restart the firewall.

This is how to add a port in the CSF using the WHM interface. Now let’s see how to open a port in the Command Line Interface.

Using the Command Line Interface

Steps to open port in CSF

1) Login to the server using the SSH.

2) Open the configuration file of the CSF as follows.

 # vi /etc/csf/csf.conf

3) Add the required ports to the csf.conf file

# Allow incoming TCP ports

TCP_IN = “20,21,22,25,26,53,80,110,143,443,465,587,993,995,2077”

# Allow outgoing TCP ports

TCP_OUT = “20,21,22,25,26,37,43,53,80,110,113,443,465,873,2087”

4) Restart the CSF for the changes to take effect. Run the below command to restart the CSF.

 # csf -r

This is how to open ports in the CSF with the help of WHM interface and Command Line Interface.

If you need any further assistance please contact our support department.

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)