LFD (Login Failure Daemon) is the half of CSF that reads log files and reacts. Out of the box it can be too strict for an office full of mail users, or too noisy with alert emails. A few settings in csf.conf balance protection against annoyance.
Before you start
- Root access and CSF installed. See install and configure CSF.
- Open WHM → Plugins → ConfigServer Security & Firewall → Firewall Configuration, or edit
/etc/csf/csf.conf.
Set login failure triggers
Each service has an LF_ value: the number of failures within LF_INTERVAL seconds (default 3600) before the IP is blocked. Set a value to 0 to disable that check.
| Setting | Service | Suggested |
|---|---|---|
LF_SSHD | SSH | 5 |
LF_FTPD | FTP | 10 |
LF_SMTPAUTH | Outgoing mail login | 10 |
LF_POP3D / LF_IMAPD | Mailbox login | 10–20 |
LF_CPANEL | cPanel/WHM login | 5–10 |
LF_MODSEC | ModSecurity hits | 5 |
Mail protocols deserve higher values because one phone with an old password retries constantly.
Choose block durations
LF_SSHD_PERM,LF_CPANEL_PERMand similar: set to1for a permanent block or a number of seconds, such as3600, for a temporary one. Temporary blocks are kinder to customers.LF_PERMBLOCK = "1"withLF_PERMBLOCK_COUNT = "4"turns an IP that was temporarily blocked four times into a permanent block.LF_NETBLOCKcan block a whole /24 when many IPs from it attack. Use it carefully: it can catch innocent users on the same ISP.
Reduce alert noise
- Set
LF_ALERT_TOto the mailbox that should receive alerts. - Turn off alerts you do not act on:
LF_EMAIL_ALERT = "0"stops an email for every block;LF_PERMBLOCK_ALERTandLF_NETBLOCK_ALERTcover the bigger events. - Process tracking (
PT_USERPROC,PT_LIMIT) warns about long-running or high-memory processes. RaisePT_LIMITor add trusted binaries to/etc/csf/csf.pignore, for example:exe:/usr/local/bin/node LF_DIRWATCHreports suspicious files in/tmp; keep it, it often catches malware early.
Apply and verify
- Click Change and Restart csf+lfd, or run:
csf -ra - Watch the log while you test with a wrong password from a spare IP:
tail -f /var/log/lfd.log
Tip: Run only one brute-force blocker per service. If cPHulk already protects cPanel and mail logins, avoid aggressive duplicate LFD rules. See cPHulk brute force protection.
