How To Blacklist/Whitelist IP Addresses in WHM Using Command Line And GUI In CSF Firewall?
What Is CSF?
WHM recommends the use of ConfigServer Security & Firewall (CSF), a free product that ConfigServer provides. CSF contains a stateful packet inspection (SPI) firewall, a login and intrusion detection mechanism, and a general security application for Linux servers.
CSF allows you to whitelist or blacklist IP addresses and ports using the GUI or CLI mode of your Linux servers. In this article, we will discuss how to blacklist/whitelist IP addresses in WHM using CSF.
Blacklist/Whitelist IP addresses in WHM using GUI
- How To Blacklist IP Address Using GUI In CSF?
- Log into the WHM panel as the root user.
- Under the Plugins section, select the ConfigServer Security and Firewall.
- Scroll down to the CSF – ConfigServer Firewall section and click the Firewall Deny IPs button.
- On the new page, enter the IP address that you want to blacklist and click on the Change button at the bottom of the page.
- After redirecting to the new page, click the Restart csf+lfd button. It will restart your CSF and IP will be added to your deny list.
- Log into the WHM panel as the root user.
- Under the Plugins section, select the ConfigServer Security and Firewall.
- Scroll down to the CSF – ConfigServer Firewall section and click the Firewall Allow IPs button.
- On the new page, enter the IP address that you want to Whitelist and click on the Change button at the bottom of the page.
- After redirecting to the new page, click the Restart csf+lfd button. It will restart your CSF and IP will be added to your Allow list.
How To Whitelist IP Address Using GUI In CSF?
Blacklist/Whitelist IP addresses in WHM using CLI
- How To Blacklist IP Address Using CLI In CSF?
- Log in to your Linux server via SSH as root or sudo user.
- Run the below command.
csf -d denyipaddress
Note: replace the denyipaddress with the IP address you want to blacklist. - Restart the firewall using the below command.
csf -r - Log in to your Linux server via SSH as root or sudo user.
- Run the below command.
csf -a allowipaddress
Note: replace the allowipaddress with the IP address you want to whitelist. - Restart the firewall using the below command.
csf -r
How To Whitelist IP Address Using CLI In CSF?
If you enjoyed this tutorial, then you would love our support! All Kemuhost hosting plans include 24/7 support from our amazing support team. Check out our web hosting plans and have your website migrated for free today!