8 votes

Harden your Linux server using SSH keys (and turn off password auth)

7 comments

  1. [4]
    Eric_the_Cerise
    Link
    Also change the port number, create a user acct with 'sudo' rights, use that acct for the ssh key, and then turn off root ssh access. That's my routine, anyway.

    Also change the port number, create a user acct with 'sudo' rights, use that acct for the ssh key, and then turn off root ssh access.

    That's my routine, anyway.

    7 votes
    1. [2]
      TonyLozano
      Link Parent
      Same, though usually I add in Fail2ban. Using ed25519 for your keys is also easy and better. For serious business, you need to fiddle with the ciphers and stuff too, that's where...

      Same, though usually I add in Fail2ban.

      Using ed25519 for your keys is also easy and better.

      For serious business, you need to fiddle with the ciphers and stuff too, that's where https://github.com/jtesta/ssh-audit/ comes in. https://www.sshaudit.com/hardening_guides.html

      4 votes
      1. skybert
        Link Parent
        Hi Tony, thanks for the comment. I also run fail2ban and these days prefer ed25519 keys over the default rsa-sha2-512. It's even a shorter line to copy and past over IM ;-) Cheers for mentioning...

        Hi Tony, thanks for the comment. I also run fail2ban and these days prefer ed25519 keys over the default rsa-sha2-512. It's even a shorter line to copy and past over IM ;-)

        Cheers for mentioning ssh-audit, I'll have a look.

        1 vote
    2. skybert
      Link Parent
      Thanks for the feedback. I tried to keep the video simple, but perhaps I should've covered more. For the record, I too run sshd on a non-standard port, and turn off root login (that should be the...

      Thanks for the feedback. I tried to keep the video simple, but perhaps I should've covered more.

      For the record, I too run sshd on a non-standard port, and turn off root login (that should be the default IMO).

      1 vote
  2. [3]
    cmccabe
    Link
    Some people (not me) will take it a step further and toy with malicious login attempts by using an ssh tar pit. Endlessh is one example. It sends an endless ssh banner to requesters, thereby tying...

    Some people (not me) will take it a step further and toy with malicious login attempts by using an ssh tar pit. Endlessh is one example. It sends an endless ssh banner to requesters, thereby tying them up rather than letting them hit your real ssh server which you host on an alternate port.

    2 votes
    1. [2]
      skybert
      Link Parent
      I didn't know about Endlessh, thanks. Nice.

      I didn't know about Endlessh, thanks.

      The purpose is to put your real SSH server on another port and then let the script kiddies get stuck in this tarpit instead of bothering a real server.

      Nice.

      1 vote
      1. cmccabe
        Link Parent
        In concept it's pretty funny. The reason I won't use it is because it potentially attracts a lot of angry attention by someone who already has malicious intent. I would prefer they just see my...

        In concept it's pretty funny. The reason I won't use it is because it potentially attracts a lot of angry attention by someone who already has malicious intent. I would prefer they just see my servers as no different from the thousands of other servers that they tried a few common passwords on and moved on from.

        3 votes