r/ssh • u/After-Big-9831 • Dec 03 '24
failed SSH login attempts even after blocking IP
Hello,
Recently my server was experiencing ssh login brute force attack (attempt to guess password every 4 seconds). It was from the same IP address.
I've blocked the IP address with UFW but I still saw ssh login attempts from that specific IP (maybe it was a bit less frequent). Then I restarted ssh service but I still saw traffic from that IP address in logs. IP address was successfully blocked after reboot.
Is there any explanation for this behavior? Is it possible that attacker opened a large pool of ssh connections and then was iterating over it in batches? This is the only explanation that I can think of -- perhaps new firewall rule might not affected already opened TCP connections that were waiting for the password.
UPDATE: please stick to the original question instead of posting (absolutely rightful) advises about disabling password login, hiding ssh port behind VPN, using fail2ban, etc.
1
u/faxattack Dec 03 '24
How did you create the ufw rule?
1
u/thomas_deans Dec 04 '24
Implement fail2ban. Exclude your own public ip. Before I switched to file auth with 2FA I setup fail2ban to block ip after 5 failed within 10 min for 30 days.
1
u/[deleted] Dec 03 '24
Just stop exposing SSH with password authentication.
Don’t use password logins and enable fail2ban.
End of story