Basic CSF Firewall Command to Secure Your Server
#howto ,#tutorial #VPS – Basic CSF Firewall Command to Secure Your Server – This tutorial explains step by step guide (with pics) about Basic CSF Firewall Command to Secure Your Server
Here in this page I put a nice compilation of some common unix command to use CSF security tool providing basic and necessary security level on your VPS. Sawiyati has posted few days ago a nice tutorial on how to install / setup ConfigServer Security and Firewall (CSF) on VPS but she forgot to also mention some basic command on how to use that very popular firewall tool.
Obviously, before you go with these command examples, make sure you firstly install CSF on your server following what’s described on previous guide.
- Add sudo prefix if you are not logged in as root.
- Change 22.214.171.124 with actual IP address you wish.
This is an example why you gonna need a firewall or at least a tool to block failed login attempts like Fail2ban.
Allow an IP Address
You can whitelist a specific IP so any connection from that IP will be allowed on CSF:
csf -a 126.96.36.199
That will add IP address 188.8.131.52 in /etc/csf/csf.allow. Do not forget to restart the firewall after whitelisting the IP address.
Remove a blocked IP address
You can remove a specific IP from CSF blocked list without having to add it to your whitelist
csf -dr 184.108.40.206
That will remove 220.127.116.11 from CSF deny list.
Block an IP address
csf -d 18.104.22.168
That will add 22.214.171.124 to CSF list of denied IP address (blocked)
Check whether an IP is blocked by CSF or not
csf -g 126.96.36.199
That will show whether an IP is blocked by CSF service or not.
Disable CSF and lfd completely
That will disable CSF service completely from running.
Enable CSF service
That will enable CSF service.
Restart CSF service
Flush CSF firewall
Remove an IP from CSF allow list
csf -ar 188.8.131.52
That will remove IP address from /etc/csf/csf.allow.
Thanks for reading. Please have no doubt to leave me comment for some more opinions or tips regarding basic command we can use to secure a VPS with CSF firewall.
This post Basic CSF Firewall Command to Secure Your Server is part of ServerMom.