First VPS — Is 54 SSH bans in 12 hours normal?
from tanka@lemmy.ml to selfhosted@lemmy.world on 07 May 04:35
https://lemmy.ml/post/46987997

So it’s my first time setting up a VPS. Is it to be expected to ban 54 IPs over a 12h timespan? The real question for me is whether this is normal or too much.

$ sudo fail2ban-client status sshd
Status for the jail: sshd
|- Filter
|  |- Currently failed: 3
|  |- Total failed:     586
|  `- Journal matches:  _SYSTEMD_UNIT=ssh.service + _COMM=sshd
`- Actions
   |- Currently banned: 51
   |- Total banned:     54
   `- Banned IP list:   [list of IPs]

fail2ban sshd.conf

$ sudo cat /etc/fail2ban/jail.d/sshd.conf 
[sshd]
enabled = true
mode = aggressive
port = ssh
backend = systemd
maxretry = 3
findtime = 600
bantime = 86400

I have disabled SSH login via password. And only allow it over an SSH key.

$ sudo sshd -T | grep -E -i 'ChallengeResponseAuthentication|PasswordAuthentication|UsePAM|PermitRootLogin'
usepam no
permitrootlogin no
passwordauthentication no

#selfhosted

threaded - newest

pgo_lemmy@feddit.it on 07 May 04:44 next collapse

Normal background noise. ssh is a well known protocol/port and scanning is automated.

tanka@lemmy.ml on 07 May 04:47 collapse

Yeah, I thought so much. But I sort of wanted to be sure. ^^

MalReynolds@slrpnk.net on 07 May 06:27 collapse

Pretty much on the low side, but you’ve not been up long. Using key based login you’re fine.

BlueBockser@programming.dev on 07 May 04:47 next collapse

If you have a public IPv4 address and use port 22, you’ll see lots of login attempts. I wouldn’t worry about it, given that you’ve disabled password login. The only thing I would advise is to disable root login as well (if not done already). Edit: Just saw you’ve already disabled root login.

If you’d like to reduce the noise somewhat, consider changing to a randomly chosen high port. I’ve done this with my VPS and hardly get any login attempts.

tanka@lemmy.ml on 07 May 04:49 next collapse

Yes, I disabled root login, but the port change is a good idea. Thanks.

androidul@lemmy.world on 07 May 05:09 next collapse

port knocking is still there btw

surewhynotlem@lemmy.world on 07 May 05:56 next collapse

I love the concept of port knocking, but it seems like a lot of overhead if the client apps themselves don’t support it.

Now if the SSH client could take a parameter called knock_on_this port, that would be awesome.

BlueBockser@programming.dev on 07 May 08:01 collapse

Good luck getting e.g. Ansible to work with that. At that point I’d just switch to a hosting provider with an actual firewall.

mumblerfish@lemmy.world on 07 May 09:06 collapse

Setup your ssh config to use a proxy command which uses netcat to knock on the ports. Ansible will work with that.

i_am_not_a_robot@discuss.tchncs.de on 07 May 12:27 collapse

Setting the SSH service to a random high port doesn’t make security better and may make security worse. Linux has a restriction that low numbered ports require special permissions but high numbered ports do not. If an attacker manages to get low privilege code execution on your machine, they may manage to bind their service to the SSH port instead. If the server and client are configured correctly, this will cause a host key mismatch error. Continuing anyway could allow the attacker to take over your account on the server. It’s unlikely unless you are a high value target.

BlueBockser@programming.dev on 08 May 06:59 collapse

I never claimed it would make security better. I said it would reduce noise, and it does.

clb92@feddit.dk on 07 May 04:50 next collapse

Seems likely. Cheap VPSs are often used by beginners, so they’re prime targets for hackers. Known VPS IP-ranges probably get hammered constantly by hackers, who are hoping you set up a service temporarily without enabling any security, or perhaps with a weak temporary password of 1234 or something.

Decronym@lemmy.decronym.xyz on 07 May 05:00 next collapse

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I’ve seen in this thread:

Fewer Letters More Letters
HTTP Hypertext Transfer Protocol, the Web
HTTPS HTTP over SSL
IP Internet Protocol
SSH Secure Shell for remote terminal access
SSL Secure Sockets Layer, for transparent encryption
VPN Virtual Private Network
VPS Virtual Private Server (opposed to shared hosting)

5 acronyms in this thread; the most compressed thread commented on today has 7 acronyms.

[Thread #278 for this comm, first seen 7th May 2026, 12:00] [FAQ] [Full list] [Contact] [Source code]

sanitation@lemmy.radio on 07 May 05:32 next collapse

Totally normal

NotEasyBeingGreen@slrpnk.net on 07 May 06:24 next collapse

I got 135 blocks via sshguard over the first 12 hours today. So, yeah, welcome to the Internet! 😄

irmadlad@lemmy.world on 07 May 07:30 next collapse

Just 54? Those are rookie numbers bro. You need to open up a few more ports. LOL Honestly tho, seems pretty standard. You could change the SSH port which might lower some of the noise but bots now days are pretty sophisticated and it would be trivial to just scan your server and find out which port is SSH. If you want to stop tailing fail2ban nervously on the daily, you could use the hosts.allow/hosts.deny which would lock it down even further. Just remember to set host.allow first then host.deny. You could also deploy any number of secondary security packages like CrowdSec, Wazuh, et al.

[deleted] on 07 May 07:39 collapse

.

Bloefz@lemmy.world on 07 May 07:43 next collapse

That’s not a lot even. I’ve seen much worse. Also with password disabled. Some idiot bots still try to send it whole password lists.

Just move your SSH to another port, that is enough to get rid of most of the nuisance scans. Or allow SSH only on IPv6. That usually covers it (The IPv6 address space is too big to scan, unless you have a TLD directly pointing to your IPv6)

What I personally do is run an overlay VPN like tailscale and allow SSH in only via that.

irmadlad@lemmy.world on 07 May 07:53 collapse

What I personally do is run an overlay VPN like tailscale and allow SSH in only via that.

Same. I use Tailscale as an overlay on the pFsense box and the server itself.

bizdelnick@lemmy.ml on 07 May 08:59 next collapse

Yes, it is normal.

# fail2ban-client status sshd
Status for the jail: sshd
|- Filter
|  |- Currently failed: 10
|  |- Total failed:     4433
|  `- Journal matches:  _SYSTEMD_UNIT=ssh.service + _COMM=sshd
`- Actions
   |- Currently banned: 27
   |- Total banned:     668
   `- Banned IP list:   2.57.122.194 45.148.10.183 195.178.110.30 2.57.122.208 92.118.39.195 103.74.123.88 92.118.39.23 2.57.122.196 92.118.39.197 45.148.10.151 92.118.39.236 178.20.210.185 68.178.161.186 80.94.92.183 92.118.39.63 2.57.122.197 2.57.122.191 2.57.122.189 80.94.92.171 94.156.152.18 14.225.7.70 45.78.198.199 211.253.9.160 159.224.213.138 1.214.42.172 103.239.165.114 77.239.111.233
Marthirial@lemmy.world on 07 May 09:09 next collapse

My SSH is only accessible thru a self hosted WireGuard VPN with a dedicated IP. Zero fails.

phase@lemmy.8th.world on 07 May 09:40 collapse

How do you deal with the risk of loosing the VPN (and thus the access)?

Marthirial@lemmy.world on 07 May 10:06 next collapse

The VPN SSH rule is configured at provision level firewall which I can access through HTTPS and temporarily change the whitelisted IP addresses. Never have done this, though. WireGuard is very stable and it is also behind another firewall.

palarith@aussie.zone on 07 May 20:49 collapse

In that case you should be able to login via webconsole

Shimitar@downonthestreet.eu on 07 May 09:22 next collapse

Yeah. Sounds about right.

First of all disable root login over ssh. Second, move your ssh from port 22 to another port of your liking. Third, disable password authentication altogether and use only solid certificates.

i_am_not_a_robot@discuss.tchncs.de on 07 May 12:20 next collapse

Root login and password authentication are already disabled, and it’s very uncommon for self hosters to use SSH certificates at all.

Changing the SSH port away from 22 does not improve security unless your password is “password” or “admin”. Anybody who’s even slightly sophisticated will find your SSH service on the correct port and make requests there instead.

Shimitar@downonthestreet.eu on 07 May 12:34 next collapse

Yes, I meant ssh private/public keys, not certificates …

And changing the port reduces the amount of attempts in any case.

CorrectAlias@piefed.blahaj.zone on 07 May 12:37 collapse

I don’t think changing the port has the intention of better security here, just reduces the amount of requests that dumb bots make. It’s noticable if you try it.

Toribor@corndog.social on 07 May 16:20 next collapse

Switching SSH to a non-standard port can cut down on log noise but it doesn’t really help with security. It’s trivial to identify ssh running on any port and attackers typically do full port scans anyway.

I’d put that effort towards allowlisting only trusted public ips or setting up wireguard/tailscale for ssh access instead.

possiblylinux127@lemmy.zip on 08 May 15:37 collapse

I would use keys instead of certs

julianwgs@discuss.tchncs.de on 07 May 09:45 next collapse

I deactivated the SSH daemon on my VPS and only use Tailscale SSH

m33@lemmy.zip on 07 May 10:51 next collapse

I have only one word to say : w00tw00t 😉

thagoat@lemmy.dbzer0.com on 07 May 12:51 next collapse

<img alt="" src="https://lemmy.dbzer0.com/pictrs/image/788c03cf-c69b-458f-86dc-ebac812ff2f3.webp">

pHr34kY@lemmy.world on 07 May 14:34 next collapse

They’re portscanning bots.

I made SSH IPv6-only and it stopped. You can’t scan IPv6 space for open ports.

Scrollone@feddit.it on 07 May 23:57 next collapse

They can’t or they don’t?

trackball_fetish@lemmy.wtf on 08 May 00:02 collapse

My question too, pretty sure you can

pHr34kY@lemmy.world on 08 May 00:18 collapse

The smallest possible subnet has 18.4 quintillion addresses.

You can’t scan it before encountering the heat death of the universe.

Outgoing connections are made on a different address that does not accept incoming connections. You never disclose your real IP when browsing.

So, no. It can’t be done.

possiblylinux127@lemmy.zip on 08 May 15:14 collapse

That’s only if you use the brute force method

IPs are not secret and can be leaked in various ways. Don’t count on IPv6 as a security mechanism as that’s not what it was designed to do

pHr34kY@lemmy.world on 08 May 16:50 collapse

It’s literally called “IPv6 privacy extension”. It’s what it does.

Unless you’re in the middle and fowarding the packets, you won’t stumble across a connectable IPv6 endpoint.

possiblylinux127@lemmy.zip on 08 May 17:13 collapse

The IPv6 privacy extensions are something else entirely and are not used for anything server side

You should research IPv6 port scanning techniques. It is harder than IPv4 but still doable depending on the context. If your goal is simply to reduce network traffic due to bots that’s one thing. However, it should not be considered a security mechanism.

possiblylinux127@lemmy.zip on 08 May 15:12 collapse

You technically can scan IPv6

It is just less common

nonentity@sh.itjust.works on 07 May 15:21 next collapse

Rookie numbers.

My favourite f2b rule is the one strike ban on SSH root login attempts. Any IP originating a SSH root login attempt is clearly compromised, and gets black holed on all my hosts for a month.

Note: direct SSH login isn’t permitted at all, the daemon is exposed purely to log the attempts.

irmadlad@lemmy.world on 07 May 20:24 collapse

a month.

I do it for a whole year. lol

nonentity@sh.itjust.works on 07 May 21:15 collapse

The actual span is a random period between 2 and 4 weeks, it’s interesting to watch how long it takes for attempts to resume.

I prefer a more granular visibility, repeat offenders automagically ratchet up their stay in the sin bin.

lka1988@lemmy.dbzer0.com on 08 May 07:32 collapse

repeat offenders automagically ratchet up their stay in the sin bin.

Now that is a glorious read first thing in the morning haha

lka1988@lemmy.dbzer0.com on 08 May 07:32 next collapse

Only 54?

phoenixz@lemmy.ca on 08 May 10:32 next collapse

That’s very little actually

Move your SSH port from the standard 22 to one of the higher ones, like 53822

It’ll remove 99.something% of your attacks as nobody bothers with those ports.

helix@feddit.org on 08 May 14:08 next collapse

Wouldn’t use a high port since they’re unprivileged.

nibbler@discuss.tchncs.de on 08 May 16:00 collapse

so everyone can open them… so what? attacker who already gained local access can crash your original sshd and spin up his own one? admittedly a thinkable scenario… but can this even be abused in a pubkey auth scenario?

mavu@discuss.tchncs.de on 08 May 16:10 next collapse

I don’t see a reason to worry about that. Only matters if the machine is alreay compromised, and then it doesn’t matter either.

helix@feddit.org on 09 May 03:03 collapse

There are different levels of compromise: you could have local access or root access. This might allow a hacker to gain root access by faking an SSHd and asking for a password or something like that. Host key verification would save you in that case, but then again, there’s probably funny MITM things you can do with an existing SSHd.

nibbler@discuss.tchncs.de on 09 May 03:09 collapse

I have to admit it widens the attack surface. Not immensely, but every bit counts.

helix@feddit.org on 10 May 08:27 collapse

Yeah, exactly my sentiment :)

helix@feddit.org on 09 May 03:01 collapse

Mostly true, however the thing saving you would be host key verification, not pubkey authentication.

I’m just not into security by obscurity coupled with compromising the inbuilt mechanisms for making sure only root can open an SSHd.

Do you think high ports are irrelevant or only in this case for SSHd? If the former, why do you think the distinction exists in the first place?

nibbler@discuss.tchncs.de on 09 May 03:08 collapse

host key veryfication, right, good point! non-root attacker won’t have your servers key. but thats just on top. so even if you ack the new host key, what could they gain? give you a shell with their permission and wait for you to sudo-tell them their password maybe. until then trying to mimic the system they might not know too much about (whats in /root?)

helix@feddit.org on 10 May 08:29 collapse

Yep, that’s one way. I bet creative hackers can chain some nice exploits together and figure out things we currently don’t think of. Better give them the smallest surface possible :)

cantankerous_cashew@lemmy.world on 09 May 01:52 collapse

I do this too; I changed the actual port to something random and run endlessh-go on 22 to tarpit the skiddies

possiblylinux127@lemmy.zip on 08 May 15:11 next collapse

I personally wouldn’t waste your time with bans

Enable public key authentication and disable passwords

mavu@discuss.tchncs.de on 08 May 16:12 collapse

imagine the modern internet like a school yard of a very large school during recess, and it has just snowed.

Now imagine having ssh on port 22 as you a wearing a bright red wooly cap and standing in the middle of the yard jumping up and down and waving hands.