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
  • Bloefz@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    11 hours ago

    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
      link
      fedilink
      English
      arrow-up
      2
      ·
      11 hours ago

      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.