Every operator who installs CSF for the first time eventually locks themselves out of SSH. Once. Then they never forget the testing-mode flag again. CSF on cPanel is straightforward to install — the value is in the baseline config, which determines whether the firewall protects you or just frustrates you.
What’s happening
CSF is two daemons: csf is the iptables/nftables ruleset manager, lfd is the login-failure-detection daemon that watches log files for brute force and writes temporary blocks. cPanel does not ship CSF — you install it from configserver.com. The defaults are conservative and useful, but a handful of values must be edited before reload.
How to verify
csf --version
csf -l | head -20
csf -t
lfd --status
grep -E "^(TESTING|TCP_IN|TCP_OUT|DENY_IP_LIMIT) " /etc/csf/csf.conf
csf -t shows temporary blocks. csf -l shows current iptables rules.
The fix
- Install via the configserver.com tarball into
/etc/csf/. Runcsftest.plto confirm the kernel supports the required modules. - Edit
/etc/csf/csf.confbefore first reload:TESTING = 1(yes, leave testing mode on for the first 24h)TCP_INandTCP_OUT: include 20,21,22,25,53,80,110,143,443,465,587,993,995,2078,2079,2080,2082,2083,2086,2087,2089,2095,2096RESTRICT_SYSLOG = 3to prevent log spoofingCC_DENYempty initially — country blocking is opinionated, leave it for week two
- Run
csf -rto reload. Confirm you can still SSH in from a second window before going further. - Flip
TESTING = 0after 24 hours of clean behavior. - LFD baseline:
LF_TRIGGER = 5,LF_SSHD = 5,LF_FTPD = 10,LF_CPANEL = 5. AddLF_ALERT_TO = ops@yourdomainandLF_ALERT_FROM = lfd@yourhostso you actually see notifications. - Whitelist your management IPs in
/etc/csf/csf.allowbefore anything else, and document them.
Stack Harbor installs and maintains CSF baselines as part of cPanel server management.