Useful CSF SSH Command Line Commands

This article covers some useful ConfigServer Firewall (CSF) SSH command line commands in a "cheat sheet" format.

Command Description Example
csf -e Enable CSF root@server[~]#csf -e
csf -x Disable CSF root@server[~]#csf -x
csf -s Start the firewall rules root@server[~]#csf -s
csf -f Flush/Stop firewall rules (note: lfd may restart csf)
root@server[~]#csf -f
csf -r Restart the firewall rules root@server[~]#csf -r
csf -a [IP.add.re.ss] [Optional comment] Allow an IP and add to /etc/csf/csf.allow
root@server[~]#csf -a 187.33.3.3 Home IP Address
csf -td [IP.add.re.ss] [Optional comment] Place an IP on the temporary deny list in /var/lib/csf/csf.tempban root@server[~]#csf -td 55.55.55.55 Odd traffic patterns
csf -tr [IP.add.re.ss] Remove an IP from the temporary IP ban or allow list.
root@server[~]#csf -tr 66.192.23.1
csf -tf Flush all IPs from the temporary IP entries
root@server[~]#csf -tf
csf -d [IP.add.re.ss] [Optional comment] Deny an IP and add to /etc/csf/csf.deny root@server[~]#csf -d 66.192.23.1 Blocked This Guy
csf -dr [IP.add.re.ss] Unblock an IP and remove from /etc/csf/csf.deny root@server[~]#csf -dr 66.192.23.1
csf -df Remove and unblock all entries in /etc/csf/csf.deny root@server[~]#csf -df
csf -g [IP.add.re.ss] Search the iptables and ip6tables rules for a match (e.g. IP, CIDR, Port Number) root@server[~]#csf -g 66.192.23.1
csf -t  Displays the current list of temporary allow and deny IP entries with their TTL and comments  root@server[~]#csf -t


Whitelisting an IP Address

In order to prevent specific IPs from being blocked, even for a temporary deny, you need to list their IP address in the files csf.ignore and csf.allow. The first step is to enable IGNORE_ALLOW in csf.conf. The value for IGNORE_ALLOW will appear as "0", you will need to adjust it to "1" and restart CSF and LFD.

This will allow lfd to reference csf.ignore. If you add an IP address to csf.ignore, the IP address will no longer be checked by lfd and failed login attempts will not trigger temporary denies.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

CSF command not found in cPanel/WHM server

CSF – Config server firewall is a firewall configuration tool for WHM/cPanel server. CSF is...

How to install ConfigServer Security & Firewall

ConfigServer Firewall, also known as CSF, is a firewall configuration script created to provide...

How to install ConfigServer Explorer (cse)

To install or upgrade cse simply do the following from the root shell via SSH: cd /usr/src rm...

Fix False Downtime Reports of Your Server

Many of our clients are using uptimerobot to ensure the uptime status of their servers. Some of...

How to ignore emails/messages sent by CSF/LFD

Many peoples would like to ignore messages sent by CSF/LFD. So, we're writing a tutorial to guide...