How to manage csf via command line in linux server

    Posted in Linux Servers on Jan 02, 2019


    We can install the csf firewall to secure the Linux servers. We can manage the firewall via command line easily. Please read our the following article and command structure.

    Start the firewall rules
    Csf -s

    Example: #csf -s

    Flush/Stop firewall rules (note: lfd may restart csf)
    csf -f

    Example: #csf -f

    Restart the firewall rules
    csf -r

    Example: #csf -r

    Deny an IP and add to /etc/csf/csf.deny
    csf -d 

    Example: #csf -d

    Flush all IPs from the temporary IP entries
    csf -tf

    Example: #csf -tf

    Remove an IP from the temporary IP ban or allow list
    csf -tr

    Example: #csf -tr

    Allow an IP and add to /etc/csf/csf.allow
    csf -a

    Example: #csf -a

    Unblock an IP and remove from /etc/csf/csf.deny
    csf -dr

    Example: #csf -dr

    Displays the current list of temporary allow and deny IP entries with their TTL and comment
    csf -t
    Search the iptables and ip6tables rules for a match (e.g. IP, CIDR, Port Number)
    csf -g

    Example: #csf -g

    Remove and unblock all entries in /etc/csf/csf.deny
    csf -df