Restricting access to essential ports by country

Post Reply
Junior Member
Posts: 2
Joined: 27 Feb 2017, 12:33

Restricting access to essential ports by country

Post by IMKS »


I am a newbie with WHM and because of this I would like to verify my settings before making changes.

My goal is to restrict access to some essential ports (SSH, WHM login etc.) to just one country so that logins to these chosen ports is possible only from IP's from this chosen country but at the same time let HTTP and HTTPS traffic from anywhere and also make sure that WHM and csf updates work and any other needed protocol or function to work as expected for my web server to work normally. I have done some research on how to do this and because I am a newbie with WHM, I would like to confirm my findings here before making any changes..

I have latest WHM and CSF plugin installed and I am using CSF to get to my goal.

Ports that I was going to secure in this way are:
20 = FTP
21 = FTP
22 = SSH
2082 = cPanel login (non-HTTPS)
2083 = cPanel login (HTTPS)
2086 = WHM login (non-HTTPS)
2087 = WHM login (HTTPS)
2095 = Webmail login (non-HTTPS)
2096 = Webmail login (HTTPS)
3306 = MySQL Remote Database Connections

(Any ideas on these ports?)

First, I would need to block chosen ports from firewall. To do this, I would need to go to Firewall Configuration, in IPv4 Port Settings and remove the desired port numbers from the TCP_IN and UDP_IN fields.

Second, I would need to go to Country Code Lists and Settings section and add the chosen country code to CC_ALLOW_PORTS.

Third, I would need to go to CC_ALLOW_PORTS_TCP and CC_ALLOW_PORTS_UDP fields and add those chosen closed ports to those fields.

Fourth, I would need to restart csf+lfd.

Did I get this correctly?

Post Reply