ssh attacks
I knew botnets testing ssh passwords was a thing but I didn’t realize it was this bad. Here’s one minute for my home server which I need to be able to ssh into.
Jan 11 01:14:00 tt sshd[294770]: Failed password for root from 98.97.59.56 port 27496 ssh2
Jan 11 01:14:09 tt sshd[294773]: Invalid user ftp from 212.70.149.150 port 62358
Jan 11 01:14:13 tt sshd[294773]: Failed password for invalid user ftp from 212.70.149.150 port 62358 ssh2
Jan 11 01:14:22 tt sshd[294789]: Failed password for root from 43.159.32.231 port 44228 ssh2
Jan 11 01:14:40 tt sshd[294795]: Failed password for root from 127.0.0.1 port 44192 ssh2
Jan 11 01:14:46 tt sshd[294816]: Failed password for root from 35.194.181.153 port 54910 ssh2
Jan 11 01:14:49 tt sshd[294818]: Failed password for root from 165.22.51.149 port 35608 ssh2
Jan 11 01:14:52 tt sshd[294838]: Failed password for root from 180.101.88.236 port 13566 ssh2
Jan 11 01:14:54 tt sshd[294838]: Failed password for root from 180.101.88.236 port 13566 ssh2
Jan 11 01:14:57 tt sshd[294838]: Failed password for root from 180.101.88.236 port 13566 ssh2
There are 97,354 of these attempts in five days, or a rate of once every 5 seconds.
The simple protection is to disable root login in sshd. I’d rather not deal with the requests. Some folks run ssh on an unusual port; that’ll at least cut down the traffic. fail2ban is also a popular solution but I’ve never liked how it works. Scanning logfiles? Really? And what if it blocks my legitimate logins somehow?
Here’s the top 20 users other than root being probed. Passwords really are a terrible form of authentication.
796 admin
601 user
505 ubuntu
389 debian
238 test
147 oracle
92 ftpuser
88 postgres
72 deploy
67 git
66 mysql
59 hadoop
51 guest
47 student
47 es
47 centos
46 dev
44 test1
43 www
42 pi
Comments
One option to prevent yourself from getting locked out when using fail2ban is to update the "jail.local" file with an "ignoreip" parameter.
As mentioned in the the conf. file:
# "ignoreip" can be an IP address, a CIDR mask or a DNS host
fail2ban worked for me for many years when I had internet servers. Never any issues but I also did the other changing the port and also removing root login.
As the other person commented you can ignore ip as well to prevent issues
I don't use ssh(d), seems it 'won't' be killed?
How to stop it please?
(Fedora)
I used fail2ban for many years without issues, so I wouldn’t worry about it. That said, disable everything but public key authentication and this becomes much less of a concern since you’re mostly worried about a server vulnerability at that point and we did hopefully get this decade’s exploit out of the way with Terrapin.
The attempt from 127.0.0.1 is odd. I assume it wasn't you. Spoofed IP address? Which would also be odd, since the response packets wouldn't go back to them, so I don't know what they'd have to gain from it.
oh good catch, I didn't even notice that. it probably was me; I was testing at the same time.