Jump to content

Featured Replies

Posted
comment_117

CSF (ConfigServer Security & Firewall) is a popular firewall and security tool for Linux servers. CSF is full featured firewall which contains many features and works on Linux out of the box. Its a Stateful Packet Inspection (SPI) firewall, Login/Intrusion Detection and Security application for Linux servers.

Here are some common commands that you can use with CSF:

Start CSF:

To start CSF, use the following command:

csf -s

you can also use systemctl to restart csf and lfd server 

systemctl start csf lfd


Stop CSF:

To stop CSF, use the following command:

csf -x

you can also use systemctl to restart csf and lfd server 
 

systemctl stop csf lfd

Restart CSF:

To restart CSF, use the following command:

csf -r


you can also use systemctl to restart csf and lfd server 

systemctl restart csf lfd

Check CSF status:

To check the status of CSF, use the following command:

csf -status


Allow an IP address:

To allow an IP address through the firewall, use the following command:

csf -a 


you can add the comment after the ip with space

example :

Quote

csf -a 1.1.1.1 allowed by admin

Unblock an IP address:

To unblock an IP address that has been blocked by CSF, use the following command:

csf -dr 


Block an IP address:

To block an IP address, use the following command:

csf -d 


you can add the comment after the ip with space

example :

Quote

csf -d 1.1.1.1 blocked by admin

View blocked IP addresses:

To view a list of blocked IP addresses, use the following command:

csf -g


to find specific ip in blocked list use below command :

Quote

csf -g 1.1.1.1

Unblock all IP addresses:

To unblock all IP addresses that have been blocked by CSF, use the following command:

csf -df


Check for updates to csf but do not upgrade :

csf -c


To update CSF :

csf -u


To Force update :

csf -uf


Get an IP’s information country of origin & hostname/ptr :

csf -i IP

usage :

Quote

csf -i 1.1.1.1

Hope this helped and you can add your own commands below in the comment to help others.

  • Sandeep B. changed the title to Useful CSF firewall Commands list for System Admins

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now