Security Guide

How to Install, Configure & Use CSF Firewall on Rocky Linux

Step-by-step guide to installing and configuring CSF via SSH on Rocky Linux, including essential commands to secure your server.

πŸ”’ Server security β€’ ⚑ SSH commands β€’ πŸ› οΈ Easy setup

If you're new to CSF (Config Server Firewall), or even if you’ve used it before, it’s always useful to have a quick reference for installation and SSH commands when managing a server.

This guide covers installing CSF on Rocky Linux (also compatible with CentOS), basic configuration steps, and a handy command cheat sheet for everyday firewall management.

Note: As of August 2025, CSF development has been discontinued. It can still be used, but it no longer receives updates, which may introduce future security risks.

Download SSH Client

To connect to your server via SSH, you’ll need an SSH client such as PuTTY or a terminal.

Installing CSF

Install wget:

yum -y install wget

Go to directory:

cd /usr/src/

Download CSF:

wget https://download.configserver.com/csf.tgz

Extract and install:

tar -xzf csf.tgz
cd csf
sh install.sh

Testing CSF

Install dependencies:

yum install perl-libwww-perl perl-LWP-Protocol-https perl-GDGraph

Run test:

perl /usr/local/csf/bin/csftest.pl

Configuring CSF

Edit config:

nano csf.conf

Change:

TESTING=1 β†’ TESTING=0

Restart:

csf -r

CSF Command Cheat Sheet

CommandDescription
csf -eEnable CSF
csf -xDisable CSF
csf -sStart firewall
csf -fFlush rules
csf -rRestart firewall
csf -a IPAllow IP
csf -d IPBlock IP
csf -dr IPUnblock IP
csf -td IPTemporary block
csf -tr IPRemove temp rule
csf -tView temp rules
csf -g IPSearch rules

Summary

CSF is a powerful firewall tool for managing server security through SSH. Even though it is no longer actively maintained, it is still widely used for controlling access and blocking malicious traffic.