Live data from Hacker News

Ask HN: What are the best practises for using SSH keys?

news.ycombinator.com

31–40 of 114 posts

Re: Ask HN: What are the best practises for using SSH keys?

#31

I consider best practice to be using a hardware token. My favoured solution is to use a yubikey via gpg: with this method you use your gpg subkey as an ssh key. The yubikey 4 supports RSA 4096 bit keys, if you need NFC then the Yubikey Neo supports max RSA 2048 bit keys.

The other nice benefit of this is that now you have pgp keys for your organization to which you can encrypt backups and suchlike.

Re: Ask HN: What are the best practises for using SSH keys?

#33
post #16

From my experince as an attacker -- - Is it better to use a different passphrase on each key, or does using the same one not matter much? - How much less secure is it to not use a passphrase on a key? - Should you use a different key per user account, per server, or per use-case (i.e. personal or work)? None of these things really matter that much. Make sure you use full disk encryption and never stand up from your m…

Nobody seemed to answer this question, and neither did the original blog post (besides "trust me and do it"), so maybe you can shed more light on the main point:

Why are ED25519 keys better than RSA, how compatible are they with different systems, and are they worth the hassle and risk of generating and using a new one?

Re: Ask HN: What are the best practises for using SSH keys?

#34
post #12

If you use fail2ban make sure to pin the right key to the right host. Otherwise ssh will try all the keys and get you banned from your own host. The easiest way is to use the ~/.ssh/config: Host myhost IdentityFile ~/.ssh/myhost

You should do this even if you're not using fail2ban. Otherwise any box you connect to can enumerate all of your public keys, which could be a problem for some people.

Re: Ask HN: What are the best practises for using SSH keys?

#35
The first rule: never share a private keys between physical devices. Apart from reducing the opportunities for it to go walkies in transit, or accidentally get left on a USB stick, it allows you to revoke a single credential if you lose (control over) that device.

From that, we get:

  - you're not sharing passphrases between keys, you're 
  sharing them between devices, and whether that's safe
   depends how likely it is that a compromised passphrase 
  on one device can be transferred by an attacker to another.
  - Similarly, whether a blank passphrase is a good idea or
   not depends on what other measures are protecting access 
  to that private key.
  - If a private key ever turns up on the wrong machine, 
  you *know* the key and both source and destination 
  machines have been compromised.

Re: Ask HN: What are the best practises for using SSH keys?

#37
post #23
post #19

https://github.com/philipWendland/IsoApplet + some blank java cards + card reader. Something about Yubico rubs me the wrong way.

Use a GPG Card - much simpler than acquiring blank Java cards.

And what is hard exactly about acquiring blank Java cards? Not harder than ordering anything else over the Internet.

Re: Ask HN: What are the best practises for using SSH keys?

#38
post #18

Earlier quoted context omitted.

> It is better to use a different passphrase for each key but it is also less convenient unless you're using a password manager (personally, I'm using KeePass) If you are going to use a password manager to store them there's no point in using different passphrases.

Why not? Granted the passphrase are in one place but as long as your password store doesn't get compromised managing to brute force a key's password then only gives you access to the machine(s) that one key is accepted on. Also, the keys don't have to reside on the same device the password store is on. If you have one key per client device for example.

Because if your password manager is compromised, so are all of the passphrases stored in it. So what would the point, then, be of using different ones?

Re: Ask HN: What are the best practises for using SSH keys?

#39
post #16

From my experince as an attacker -- - Is it better to use a different passphrase on each key, or does using the same one not matter much? - How much less secure is it to not use a passphrase on a key? - Should you use a different key per user account, per server, or per use-case (i.e. personal or work)? None of these things really matter that much. Make sure you use full disk encryption and never stand up from your m…

Nobody seemed to answer this question, and neither did the original blog post (besides "trust me and do it"), so maybe you can shed more light on the main point: Why are ED25519 keys better than RSA, how compatible are they with different systems, and are they worth the hassle and risk of generating and using a new one?

ED25519 keys are cryptographically more secure, and are more politically secure if you want to call it that due to the undermining of NIST the NSA was/is doing. (plus it comes from djb, all hail djb!)

OpenSSH already has support built in, as does Mosh, and therefore, I do think it's worth it.

I do sometimes disagree with using keys though, despite everyone pushing it so hard, there are cases where I think passwords are the way to go, but thats a long post for another time.

Also, I really like usin pam auth mods, such as yubikeys or google auth for two factor. That combined with regular hardening, and yes Ill admit it, non standard ports (reduces log alert fatique) does a pretty good job.

Re: Ask HN: What are the best practises for using SSH keys?

#40
post #16

From my experince as an attacker -- - Is it better to use a different passphrase on each key, or does using the same one not matter much? - How much less secure is it to not use a passphrase on a key? - Should you use a different key per user account, per server, or per use-case (i.e. personal or work)? None of these things really matter that much. Make sure you use full disk encryption and never stand up from your m…

Nobody seemed to answer this question, and neither did the original blog post (besides "trust me and do it"), so maybe you can shed more light on the main point: Why are ED25519 keys better than RSA, how compatible are they with different systems, and are they worth the hassle and risk of generating and using a new one?

> Why are ED25519 keys better than RSA

Two reasons: 1) they are a lot shorter for the same level of security and 2) any random number can be an Ed25519 key. To generate an RSA you have to generate two large random primes, and the code that does this is complicated an so can more easily be (and in the past has been) compromised to generate weak keys.

Post reply on HN