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 103.129.97.14
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 103.129.97.14
Allow an IP and add to /etc/csf/csf.allow
csf -a
Example: #csf -a 103.129.97.14
Unblock an IP and remove from /etc/csf/csf.deny
csf -dr
Example: #csf -dr 103.129.97.14
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 103.129.97.14
Remove and unblock all entries in /etc/csf/csf.deny
csf -df