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?

    1. Log into the WHM panel as the root user.
    2. Under the Plugins section, select the ConfigServer Security and Firewall.
      whm csf
    3. Scroll down to the CSF – ConfigServer Firewall section and click the Firewall Deny IPs button.
      whm csf deny ip
    4. 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.
      whm csf deny ip change
    5. 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.
      whm csf restart

    How To Whitelist IP Address Using GUI In CSF?

    1. Log into the WHM panel as the root user.
    2. Under the Plugins section, select the ConfigServer Security and Firewall.
      whm csf
    3. Scroll down to the CSF – ConfigServer Firewall section and click the Firewall Allow IPs button.
      whm csf allow ip
    4. 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.
      whm csf Allow ip change
    5. 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.
      whm csf restart

Blacklist/Whitelist IP addresses in WHM using CLI

    How To Blacklist IP Address Using CLI In CSF?

    1. Log in to your Linux server via SSH as root or sudo user.
    2. Run the below command.
      csf -d denyipaddress
      Note: replace the denyipaddress with the IP address you want to blacklist.
    3. Restart the firewall using the below command.
      csf -r

    How To Whitelist IP Address Using CLI In CSF?

    1. Log in to your Linux server via SSH as root or sudo user.
    2. Run the below command.
      csf -a allowipaddress
      Note: replace the allowipaddress with the IP address you want to whitelist.
    3. Restart the firewall using the below command.
      csf -r

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!

Add a Comment

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