this post was submitted on 07 May 2026
62 points (97.0% liked)

Selfhosted

59353 readers
541 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

  7. No low-effort posts. This is subjective and will largely be determined by the community member reports.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 3 years ago
MODERATORS
 

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
you are viewing a single comment's thread
view the rest of the comments
[–] phoenixz@lemmy.ca 7 points 1 week ago (2 children)

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.

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

[–] helix@feddit.org 0 points 1 week ago (1 children)

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

[–] nibbler@discuss.tchncs.de 2 points 1 week ago (2 children)

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 3 points 1 week ago (1 children)

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 0 points 1 week ago (1 children)

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 1 points 1 week ago (1 children)

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

[–] helix@feddit.org 1 points 1 week ago

Yeah, exactly my sentiment :)

[–] helix@feddit.org 1 points 1 week ago (1 children)

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 2 points 1 week ago (1 children)

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 1 points 1 week ago

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 :)