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
  • i_am_not_a_robot@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    3
    ·
    24 hours ago

    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.

    • CorrectAlias@piefed.blahaj.zone
      link
      fedilink
      English
      arrow-up
      10
      ·
      23 hours ago

      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.

    • Shimitar@downonthestreet.eu
      link
      fedilink
      English
      arrow-up
      7
      ·
      23 hours ago

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

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