Linux : How to open a port from a specific source IP address with CSF

By | December 13, 2019

It is possible with Config Security Firewall (CSF) to open an inbound port from a specific source IP address. This is defined outside of the global configuration (csf.conf), within a dedicated config file.

1. Open the following file with your favorite text editor :

/etc/csf/csf.allow

2. Follow this syntax to open a specific port for a specific IP [tcp/udp|in/out|s/d=port|s/d=ip] :

Protocol|TrafficDirection|SourceDestinationIP

Example : To open port 8443, using TCP protocol from IP 192.168.15.15, the syntax would be :

tcp|in|d=8443|s=192.168.15.15

Note : One statemet per line must be entered.

3. Save the file and reload CSF :

csf -r