CSF Firewall command line

Here you can find useful commands you can use from your terminal.
To get the list of all options please use this commands

csf --help
man csf

Configuration location is in the folder /etc/csf/
Main configuration file: /etc/csf/csf.conf

Enable CSF Firewall

csf -e

Disable CSF Firewall

csf -x

Restart CSF Firewall (iptables rules)

csf -r

Restart CSF/LFD Firewall (iptables rules and LFD service)

csf -ra

Restart LFD only

service lfd restart

Check blocked IP reason (replace IP with the IP address)

csf -g IP
grep "IP" /var/log/lfd.log

Block IP (permanently)

csf -d IP

Block IP (temporarily for 24 hours, define in seconds)

csf -td IP 86400

Unblock IP

csf -dr IP

Whitelist IP (allow access to all ports)

csf -a IP

Whitelist IP range /24 (allow access to all ports)

csf -a 192.168.0.0/24

Whitelist (temporarily) IP range /24 for 24 hours (allow access to all ports, define in seconds)

csf -ta 192.168.0.0/24 86400

Remove all temporary IP blocks

csf -tf

Remove all permanent IP blocks

csf -df

You may also like...