• Johannes Jacobs@lemmy.jhjacobs.nl
    link
    fedilink
    English
    arrow-up
    12
    arrow-down
    1
    ·
    18 hours ago

    Which issues are you referring to?

    Using port 2222 may not prevent any real hackers from discovering it, but it sure does prevent a lot of them scripttkiddie attacks that use automated software.

    • martinb@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      9
      ·
      18 hours ago

      Passwordless login only. No root login. Fail2ban. Add ufw to stop accidental open port shenanigans, and you are locked down enough

        • martinb@lemmy.sdf.org
          link
          fedilink
          English
          arrow-up
          3
          ·
          12 hours ago

          Felt a bit like a faff to me, so I never bothered. Does depend upon your threat model though

          • Botzo@lemmy.world
            link
            fedilink
            English
            arrow-up
            1
            ·
            12 hours ago

            Totally.

            Port knocking is one of those “of course someone did that” things to me too. A replay attack is enough to make it security theater.

            An IP allowlist is a more useful addon.

      • StrixUralensis@tarte.nuage-libre.fr
        link
        fedilink
        English
        arrow-up
        2
        arrow-down
        1
        ·
        edit-2
        13 hours ago

        Passwordless login only

        Never understood this

        I don’t think that anyone or anything, computer or mentalist, will guess my 40+ characters long password

        • non_burglar@lemmy.world
          link
          fedilink
          English
          arrow-up
          7
          ·
          14 hours ago

          With ssh, over 90% of the vulnerabilities are abusing the password mechanism. If you setup pre-shared keys, you are preventing the most common abuses, including in the realm of zero days.

        • truthfultemporarily@feddit.org
          link
          fedilink
          English
          arrow-up
          1
          ·
          13 hours ago

          The idea behind keys is always, that keys can be rotated. Vast majority of websites to that, you send the password once, then you get a rotating token for auth.

          Most people don’t do that, but you can sign ssh keys with pki and use that as auth.

          Cryptographically speaking, getting your PW onto a system means you have to copy the hash over. Hashing is not encryption. With keys, you are copying over the public key, which is not secret. Especially managing many SSH keys, you can just store them in a repo no problem, really shouldn’t do that with password hashes.

        • surph_ninja@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          arrow-down
          1
          ·
          15 hours ago

          Especially paired with Fail2Ban preventing any brute force attempts.

          But with a WireGuard setup, you need not have the port exposed at all.

    • emhl@feddit.org
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      17 hours ago

      Privileged ports can be used by processes that are running without root permissions. So if the sshd process would crash or stop for some other reason, any malicious user process could pretend to be the real ssh server without privilege escalation. To be fair this isn’t really a concern for single user systems. But setting up fail2ban or only making ssh accessible from a local network or VPN would probably be a more helpful hardenening step

      And regarding port 2222 it is the most popular non-provileged port used for SSH according to shodan.io So you ain’t gaining much obscurity

      • Laser@feddit.org
        link
        fedilink
        English
        arrow-up
        3
        ·
        16 hours ago

        Privileged ports can be used by processes that are running without root permissions.

        I guess you mean unprivileged ports?

        So if the sshd process would crash or stop for some other reason, any malicious user process could pretend to be the real ssh server without privilege escalation.

        Not really, except on the very first connection because you need access to the root-owned and otherwise inaccessible SSH host key, otherwise you’ll get the message a lot of people have probably seen after they reinstalled a system (something like “SOMEONE MIGHT BE DOING SOMETHING VERY NASTY!”).