How to Open a Port in CSF Firewall?

What is a port

port is a communication endpoint. At the software level, within an operating system, a port is a logical construct that identifies a specific process or a type of network service. A port is identified for each transport protocol and address combination by a 16-bit unsigned number, known as the port number. The most common transport protocols that use port numbers are the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP).

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 using the Command Line Interface as listed below.

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 Command Line Interface.

We hope you’ve found this useful! 

Leave a Comment

Your email address will not be published. Required fields are marked *