Start with what the symptom tells you
Permission denied, even when the password or key is correct.
Running SSH in verbose mode from the affected workstation makes this distinction obvious in a few seconds:
BASH
# Run from the machine that cannot log in
ssh -v -p 22 [email protected]
# If output stops around 'Connecting to ...' and then times out,
# packets are being dropped: look at the firewall (CSF/LFD).
# If you see 'Remote protocol version' and authentication methods
# being tried before 'Permission denied', the connection works
# and something is rejecting the login itself: look at cPHulk.How LFD sees and blocks SSH attempts
/var/log/secure on RHEL-family systems such as AlmaLinux or CentOS and /var/log/auth.log on Debian and Ubuntu. It counts failed logins per source IP over a time window, and when an IP crosses the threshold, it tells CSF to add a firewall rule for that address. From then on, that IP cannot reach any port the rule covers. It is not limited to SSH.
The relevant settings live in /etc/csf/csf.conf:
INI
# Illustrative values only; check the defaults in your own csf.conf
# Failed SSH logins from one IP before LFD blocks it
LF_SSHD = "5"
# "1" makes the block permanent; a number of seconds makes it temporary
LF_SSHD_PERM = "1"
# Window (seconds) in which failures are counted
LF_INTERVAL = "3600"
# Same idea for cPanel/WHM/webmail login failures
LF_CPANEL = "5"/etc/csf/csf.deny and temporary ones live in a separate temporary list. That is why an IP can be blocked even though it does not appear in csf.deny.
How cPHulk sees and blocks the same attempts
cphulkd daemon and configured in WHM under the Security Center. Instead of reading logs after the fact, it sits in the authentication path. cPanel, WHM, webmail and the mail services ask it about login attempts, and on a typical WHM server sshd consults it through PAM, the pluggable authentication system Linux uses to check credentials. When cPHulk decides an IP or a username has failed too often, it tells PAM or the cPanel service to refuse the login.
That has a consequence people tend to miss. cPHulk tracks usernames as well as IPs. A botnet hammering root from thousands of addresses may never trip a per-IP limit, but it can trip the per-username limit, and then the real administrator gets refused too, even from a clean IP with the correct password. Using a firewall to block every attacking address would never produce this kind of lockout, because the admin's IP was never blocked.
cPHulk's view of the world is also broader than SSH. It understands cPanel accounts, so it can protect webmail and cPanel logins in ways a generic log watcher only approximates.
Where the two overlap and where they collide
- Adding your office IP with
csf -astops CSF from blocking it, but it does nothing for cPHulk. If cPHulk has locked the username, you are still refused. - Whitelisting the IP in cPHulk keeps PAM from refusing it, but if LFD already put the IP in the firewall, the connection never arrives.
- If cPHulk is set to add firewall-level blocks, those rules live alongside CSF's rules. A CSF restart rebuilds the ruleset and may clear rules that another tool added. Whether that happens depends on versions and configuration, so test it on your own server rather than assuming.
Tracing a lockout to the tool that caused it
ssh -v in hand, confirm on the server, through console access, another whitelisted IP, or WHM if that still works:
BASH
# Is the IP present in any CSF rule, permanent or temporary?
csf -g 203.0.113.10
# Did LFD log a block for it?
grep '203.0.113.10' /var/log/lfd.log | tail -n 20
# Did cPHulk record failures or a block for it?
grep '203.0.113.10' /usr/local/cpanel/logs/cphulkd.log | tail -n 20
# What did sshd itself see? (use /var/log/auth.log on Debian/Ubuntu)
grep '203.0.113.10' /var/log/secure | tail -n 20csf -g shows a match and lfd.log has a matching block line, the firewall is your problem. If CSF is clean but cphulkd.log shows the IP or the username being blocked, cPHulk is refusing the login. You can also see this in WHM under cPHulk's history and blocked lists.
A red herring worth ruling out: sshd lines saying Failed password for your IP do not prove a brute-force tool is involved. A mistyped password, an expired key, or PermitRootLogin set to disallow passwords all produce similar lines. If neither CSF nor cPHulk mentions the IP, the problem is in sshd's own configuration.
To unblock, act in the tool that blocked. In CSF, csf -dr IP removes a permanent deny and csf -tr IP removes a temporary one. In cPHulk, use the WHM interface to clear the block. A command-line script, /usr/local/cpanel/scripts/cphulkdwhitelist, exists on many versions for whitelisting. Whitelisting changes security policy, so only add IPs you control and that are static. A whitelisted dynamic residential IP can end up assigned to someone else.
After unblocking, verify from the original workstation with ssh -v again. You should reach the authentication stage and log in normally. Then check that the IP is gone from csf -g output.
Choosing a setup for your server
ssh -v. A timeout points at the firewall and CSF. A rejected login on a working connection points at cPHulk. Confirm in the matching log, then unblock and whitelist in that tool, and in the other one too if both are running. Treat both tools as noise reduction on top of key-based access, not as the thing that keeps attackers out.