12 ms·
How often should I rotate my SSH keys?
- LogicX 6y agoI don’t get it. Use ssh keys with a passphrase? Then stolen keys are useless?
- pat2man 6y agoWhat if the passphrase gets stolen as well?
- notretarded 6y agoOr don't use them at all, then you don't need to worry about them getting stolen
- genericstorage3 6y agoBrute force. Usually people put a simple one
- dawnerd 6y agoOr worse, none at all since a lot of guides, especially for CI, tell you to just use none.
- staticassertion 6y agoA passphrase on your key is a great idea, but as soon as you unlock it once it's cached in memory. Since processes are not isolated within a user they're allowed to scrape the memory of other processes. If you check your running processes you're going to see that ssh-agent is running as your current user. But a far more likely scenario is that the attacker will simply leverage existing sessions/ steal a socket, which, notably, will bypass any sort of 2FA on SSH connections.
- chousuke 6y agoOn Linux, you can harden a bit against memory dumping by disabling ptrace. Set the "kernel.yama.ptrace_scope" sysctl to 3 and the easiest attack will no longer work, if you have processes that don't explicitly request disallowing ptrace.
- staticassertion 6y agoI actually don't believe that scraping memory is the easiest attack, I just mentioned it informationally. I strongly believe attackers are more likely to hijack sessions. But yeah, ptrace is definitely something to watch out for. Monitoring ptrace is also something defenders can do if they're not in a position to disable it (if you're working for a software company your engineers will ptrace).
- ikiris 6y agoNo, you should use short lived certificates, ideally locked inside hardware tokens and 2fa. This is just snake oil that doesn't actually add protection.
- chousuke 6y agoBut it does help; in most cases, it requires no effort whatsoever, in contrast to using something like SSH certificates which may not even be possible, depending on the environment. There's no such thing as perfect security, but that doesn't mean you shouldn't lock your door.
- dotancohen 6y agoOr store your keys in a different user. I personally use have the users dotancohen and dotancohens (trailing s for Secure) on my laptop. I simply su into dotancohens and then from there SSH into various servers. The /home/dotancohens/ directory has 0700 permissions.
- jiveturkey 6y agoHow does this help you? If your dotancohen acct is compromised, I will just capture the password for dotancohens when you su to that account.
- beermonster 6y agoYou'd want to use a strong passphrase. Even if you do, it's protecting the physical key. If an attacker has access to the that they can perform an offline attack. i.e. attacking a passphrase offline with decent hardware and no likelihood for being noticed means it had better be strong!
- alex_young 6y agoIsn’t the real problem here having too many cooks in the kitchen? If you have a small number of people who have access to your production environment, and they practice their trade like they are actually trusted with said production access, that provides a very small attack surface which can be analyzed and hardened.
- makotoNagano 6y agoBut then you're forcing an organisation style/hierarchy because of a tech problem. If I want all my developers to be able to access production directly for quick development, then that should be possible
- alex_young 6y agoWhat about setting up a staging environment mirroring production? Most security experts recommend restricting prod access away from your dev team because doing so alleviates risks from a compliance perspective, and prevents bugs and regressions from being introduced inadvertently. I’m not providing links here because I do think it’s worth googling and discovering more of the nuanced points many others have made. Sure, you’ll find some shops that use another model, but for most use cases separate environments exist for a reason.
- Agingcoder 6y agoIn my experience ( as a developer) this doesn't work in practice, since mirroring an actual, complete bunch of production systems in a large company is a difficult task unto itself! More often than not, you end up with a staging environment as per the security guys recommendations, but which is unfortunately barely usable. It also makes investigating difficult bugs extremely difficult (staging tends to be slightly different from prod, smaller as well, different hardware, network, etc) since you can't reproduce them, and your prod team can't help you much, since what you need is actual full box access to poke around. I agree with you on the compliance point.
- genericstorage3 6y agoIn addition, any node_modules can read your .ssh folder (on windows).
- usr1106 6y agoAll code you install to your machine. System packages, Python packages in virtualenvs, scripts. I don't keep important private keys in my .ssh folder. Well, it's just security by obscurity. An educated, determined attacker would find them. But some random malicious code would not immediately find them. I run the Web browser in firejail (Linux).
- henvic 6y agoThe main issue here is that in the JavaScript ecosystem there is this trend of using external dependencies for everything, regardless of size (i.e., leftpad), and trusting forward versions blindly. Security in npm / JS / node_modules ecosystem is quite reactive, instead of active. If there is a bad actor that releases a widely using dependency, for sure it's going to be gone from npm quite fast most of the time! However, it'll take some time for it to get noticed, and people will invariably get affected. You shouldn't bring an open honeypot to a place where bears can attack you easily, right?
- marcosdumay 6y agoIf you remove the "regardless of size" part, you'll be describing any modern language dependency system. And most of them also execute external code on module importation... what I'm not sure if it's even relevant, because you will run the module at some point anyway. So, yeah, JS makes the problem one or two orders of magnitude larger. But the problem is still there, whether you use npm or avoid it.
- jtsiskin 6y agoWoah, this just gave me an uneasy feeling...
- jlgaddis 6y ago
- pmorici 6y agoHardware tokens like a Yubi key prevent this.
- surround 6y agoA rouge employee could steal a physical key left lying out, much like they can steal keys from computers.
- hiq 6y agoThe point is that you would realize much sooner, since it's real theft, not copying.
- lanstin 6y agoNot necessarily in a company. Lots of inventory can be unaccounted for.
- MrManatee 6y agoBut it’s not enough to steal a blank YubiKey from the office storage room. You would have to steal some specific person’s activated YubiKey, and that person will notice it if they need the key regularly to do their job.
- dastx 6y agoSure, inventory is unaccounted for but you as an engineer knows it's not accounted for. So you go to IT, and you ask for a new one. IT revokes access of the original key, and gives you a new one. No one in that transaction cares if it was lost or stolen.
- sneak 6y agoYubikeys used to store gpg keys for use with gpg or ssh require a pin code to do any signing/decryption. You only get some limited number of pin attempts before it locks you out. A stolen key is useless for gpg/ssh.
- staticassertion 6y ago> But the problem with static ssh keys is that if they are stolen, it’s undetectable. It's like, super detectable. You have endpoint logs for the file access, you have network logs, you have sshd logs (which contain the public key and the IP), etc. > if you have your ssh private key on several machines, you have to remember to copy it to all those places Your ssh key should never leave a host. That should be a policy and you should write rules to detect when that policy is being violated (check for processes accessing the file). If you need access from N computers you should be generating N keys. The reason rotation isn't recommended is because it leads to bad practices (people just add a '1' to their password), it's a hassle, and it can never be fast enough to meaningfully impact an attacker - once they have SSH keys it's likely they can gain persistence and C2 before your rotation takes place. Not because people reuse their passwords in multiple places. Setting up a CA for SSH is definitely a really good practice but I think that most companies would find it far simpler to just enforce 2FA for SSH access. Still, I'd really like to see an article about how you set that up, especially if it targets smaller enterprise customers. For others who might be interested, here's bless from Netflix: https://github.com/Netflix/bless https://github.com/Netflix/bless edit: Oh, and just to be clear, 2FA for your SSH is not a silver bullet - even a yubikey. But it's a cheap, scalable, near-zero overhead way to protect against an attacker who's got access to your key (but not one who has access to your system, assuming an active session!).
- amenghra 6y ago> Still, I'd really like to see an article about how you set that up, especially if it targets smaller enterprise customers. https://github.com/square/sharkey https://github.com/square/sharkey
- staticassertion 6y agoOh I mean I know how to do it, I just mean I'd like to see companies talking about how they do it, and I'd really really like to see someone make it drop-dead simple. It's valuable to hear how companies are protecting their infrastructure if they're going to break down how they accomplished it, how they continue to maintain it, etc.
- rzimmerman 6y ago> or Bluetooth (which works maybe 97% of the time Best description of Bluetooth I've ever read.
- dylan604 6y agoseems too high in my experience with certain devices.
- rzimmerman 6y agoSimilar to the recommendations to use a YubiKey/hardware token, SeKey on a Mac lets you use a key generated in the Secure Enclave in an unexportable form (https://github.com/sekey/sekey https://github.com/sekey/sekey)
- tn1 6y agoDoes anyone know of the TPM equivalent for this? I found this [1] but when I tried it, the Windows Hello prompt only accepts USB security keys and not the fingerprint sensor in my laptop (already set up for login). My knowledge of WebAuthn is limited but their invocation of the relevant API seems like it should work for fingerprints also. [1] https://github.com/tavrez/openssh-sk-winhello https://github.com/tavrez/openssh-sk-winhello
- pram 6y agoSecretive also does this, and works on any Mac with the T2. I use it for all my ssh keys these days. It’s super slick! https://github.com/maxgoedjen/secretive https://github.com/maxgoedjen/secretive
- 8fingerlouie 6y agoSo if your mac dies, you effectively lock yourself out of any servers ? Or do you have a backup key ? If so, how do you protect that ? Not criticizing, just genuinely interested in how to best manage keys.
- GekkePrutser 6y agoYou can always add more authorized keys.. That's what I do and definitely the way to go for this scenario.
- archi42 6y agoWith ssh the situation is quite good, and it should serve as an example on "how to do it right". I find web services to be a huge pain, though: Obviously most don't offer any kind of 2FA, or maybe Google Authenticator or SMS at best (which means those websites must be so bad that people don't login to it on their phone?). But even those who do "proper" 2FA often will only allow a single U2F token - and enforce GA, SMS or a secondary email as fallback. (Putting this rant here so maybe a webdev or even two do it better the next time they do some auth stuff ;-))
- kayson 6y agoThe article mentions copying a Let's encrypt style architecture where keys are tied to user+device which can be rotated frequently, and some service blasts the public keys around as necessary. Are there any good, existing open source implementations of such a setup?
- deleted 6y ago[deleted]
- jlgaddis 6y agoAssuming one existed, how would it handle the passphrases used to protect your ("the user's") new keys and how would it securely communicate the new key's passphrase to you ("the user")?
- tptacek 6y agoThe cool-kids answer to this problem is --- in very Tailscale-fashion --- not to have static keys at all. Instead, you issue short-expiry certificates, ideally from a strong root of trust, like an IdP that does 2FA. There are other benefits; for instance, you don't have to directly provision keys to machines anymore.
- xyzzy_plugh 6y ago> ideally from a strong root of trust, like an IdP that does 2FA. I understand the concepts, but how does this work in practice? Do you have an example of generating a short-expiry certificate from an IdP, such as Google?
- AlphaSite 6y agoVault can do something like this.
- ThePhysicist 6y agoYou can do it directly with OpenSSH, no need for third-party software. There are many good blog articles / tutorials on the subject, e.g. search for "ssh ca certificate". Most people don't know that you can do this but it's actually quite easy.
- vaylian 6y agoI did a bit of reading on the topic. But it is still unclear to me what the workflow is. How would a typical day look like for an admin and one of the users?
- jkire 6y agoOne thing that always has scared me a bit with using CAs for SSH is how you protect the signing certificates? After all, if an attacker gets that cert then they get full access to everything, and can masquerade as anyone. You end up with a choice between a) have lots of SSH keys out in the wild, each with varying degrees of access, or b) have a single cert that is on your infrastructure but has access to everything. (Not to mention how you deal with the operating the site, what happens if it crashes? How do you log in without the site to sign your ssh key? Using standard trusted SSH keys to access feels like its somewhat undermining the point of using CAs). Has anyone solved this, or got a write up of some best practices for running this? All I've managed to find are articles about how to run such apps, rather than how it fits into the broader security architecture. Ideally ideally, what I would actually like is the ability to configure OpenSSH to require multiple things to log in, i.e. both that they SSH key is trusted and that it has recently been signed by the signing service. That way gaining access to the signing certificate doesn't help without also gaining a trusted SSH key (it's still bad, but not quite Game Over levels of bad). I had a quick look to see if I could hack together a patch to do this, but alas I had forgotten how weak my C foo is :(
- xaduha 6y agohttps://en.wikipedia.org/wiki/PKCS_11 https://en.wikipedia.org/wiki/PKCS_11
- slaymaker1907 6y agoI like using KeypassXC to manage my SSH keys. It can cooperate with an SSH agent and avoids leaving SSH keys unencrypted on disk if you care about that. Honestly though I use it so I can keep my secrets together in an easy to sync location.
- pisipisipisi 6y agoThere is sekey app for macs, use it. There are also yubikeys which can be used for SSH and OpenSSH knows how to use fido keys, so even more to choose from.
- avaika 6y agoAlso ssh supports "from" stanza, which allows you to limit networks from where you can login. Ideally it should set to either corporate network (and make people to vpn to your corporate perimeter before going ssh) or to your home ISP range (if you're not a company). It's not a replacement for key rotation, but significantly reduces probability of described case.
- jlgaddis 6y ago> Also ssh supports "from" stanza, which allows you to limit networks from where you can login. Additionally, sshd supports "Match", which can limit where any or all of your users can log in from. There's also "AuthenticationMethods publickey", "PasswordAuthentication no", and "PermitRootLogin no", all of which one should also be using -- ideally, on top of (both host- and network-based) access lists / firewall rules preventing access to 22/TCP from everywhere except the hosts and/or networks you've explicitly permitted.
- mdriley 6y agoDefinitely not appropriate for protecting Real Infrastructure, but for my handful of personal machines I put my authorized keys in a Google Doc and configure hosts to download it using `AuthorizedKeysCommand`. Makes it easy to add and revoke hosts in one place, which also makes rotation possible. I have a hardware-backed "doomsday key" to use if the Google Doc stops working. Writeup and script at https://github.com/mmdriley/authorized_keys https://github.com/mmdriley/authorized_keys
- sodality2 6y agoI read "I put my keys in a Google Doc" and my heart rate doubled until I read "authorized keys". But still, surely there's a better way than relying on google not controlling your "key infrastructure", even for personal use?
- c3141 6y agoHave you thought about using https://github.com/mmdriley.keys https://github.com/mmdriley.keys instead of Google Docs?
- juskrey 6y agoYeah, if I was an evil mastermind, I'd silently gather all private keys I come across. Then check them against all that zillions of public keys available all over the internet
- knorker 6y agoHardware keys. In my opinion it's no longer optional. Nor is it expensive or hard. E.g. just get a yubikey per employee (or more). Yes, they can be stolen (put PINs on them), but they can't be copied. I have just one software key, because i don't have a solution for SSH from my phone with hw key yet.
- anticristi 6y ago> An even more robust approach is to use some kind of hardware token that can sign short-lived ssh keys, and teach all your servers how to deal with those. That’s neat, but it’s hard to deploy (needs custom ssh settings). Ahem, no. I use Yubikeys for a few years now. They are literally braindead to use, and works out of the box in recent Ubuntu. Here is an Ansible role to get started: https://github.com/cristiklein/stateless-workstation-config/blob/master/roles/cklein.security/tasks/main.yaml https://github.com/cristiklein/stateless-workstation-config/... Stop making excuses and start protecting your SSH keys! Disclaimer: I'm not compensated in any way by Yubico, but their product is so darn good that I really want people to start using it.
- 8fingerlouie 6y agoI'm currently testing the "longevity" of them. I've had one on my keychain for a couple of years now, and so far it appears to hold up pretty darned well. It sits in my pocket unprotected with all my other keys, and despite its fair share of scratches it still works. The reason for the "testing" is that they appear kinda "flimsy" compared to my Nitrokey, but so far it has stood up to every beating i've given it. +1 for Yubikey.
- darkr 6y agoHave used them for the past 6 or so years, and issued as standard to any engineers needing sensitive system access - over 30 or so keys that have been used and thoroughly abused over that time I've only ever seen one broken - somehow an engineer managed to snap off the top half of it that attaches to a keyring. The hardware was still functional though.
- 8fingerlouie 6y agoI have not looked into it, but isn't there some way to "backup" a Yubikey ? There is probably a difference between company usage and personal usage. In a company setting i would expect to have backup yubikeys, but for a personal setup a recovery situation would involve getting your keys "out of it" until a replacement arrives.
- ThePhysicist 6y agoI understand why they don't talk about the CA functionality in OpenSSH (they want to sell their own product after all), but OpenSSH supports CA-based certificates out of the box, which makes it easy to generate auto-expiring SSH credentials. Then again, with a CA-based approach the root key becomes the golden key and needs to be protected, which might still be easier than protecting individual keys though. I recommend using a bastion host through which all SSH connections go and to use a DevOps tool like Ansible to automate certificate/key placement on every single host. In addition, if you have a trusted network that people log in via VPN you should also limit SSH connections to the bastion host to addresses from this network, which will make it harder again to use stolen credentials. Finally, only a handful of people should have such credentials, most maintenance should be performed in an automated way via DevOps tooling.
- SahAssar 6y agoIf you use the u2f support in openSSH the risk of credentials being stolen without you knowing basically goes down to zero (as in, if you have the physical key the credential isn't stolen).
- gitanovic 6y agoActually a ssh key-rotation could be scripted in a cron-job and be completely transparent to the user... Every X days generate a new RSA key pair, connect to all the hosts and replace the public key matching the previous one in the ~/.ssh/authorized_keys Is there any issue with this solution?
- SahAssar 6y agoYou can't have a passphrase on the key which IMO probably provides better security than rotating SSH keys.
- ItsMrMe 6y agoHow is a ssh jumphost helping with rotating your keys? You still need to update the jumphost and all other servers with the new key right?
- orwin 6y agoI strongly disagree with the article, but: Have a yubikey to connect to your jumphost(we called that access vm), then have a cronjob that will, every month, deploy ansible, generate a key pair on the accessvm and deploy those new key on accessible vms (ideally not your log collecting vm, that should be even more secured.).
- jlgaddis 6y agoWere you using some awesome new cryptographically secure method to manage the passphrases of the newly generated keys (and communicate them to the user)? Or, more likely, were all of these new private keys granting access to all of your hosts just sitting there on disk unencrypted -- and, as a result, freely available to and easily stolen and used to gain access to all of your production machines by the first attacker to come along and compromise the bastion host?
- jasongill 6y agoI will never understand people who think a bastion host or "jump box" is a good idea. I've seen so many companies that have experienced extended downtime because they had an issue and it also broke their jumpbox - so nothing could be fixed until their bastion host was fixed. Plus, the companies I've bought that used bastion hosts ended up having the worst security on the jumpbox machine because it's a "set it and forget it" machine that isn't normally treated like a production server. I've seen bastion hosts that had root kits for years and nobody noticed because they never really logged in to look around at the bastion host itself. I've never understood the appeal, nor have I seen anyone do it well, honestly. It seems to get mentioned in all of these novice and semi-pro SSH related articles as a good idea and just makes my eye twitch when I see it.
- arichard123 6y agoLogically you're going to need some kind of digital key, and logically keys can get stolen. So the problem is detecting theft. Rotating keys is not detecting theft, YubiKey is not detecting theft. Could some kind of jump server where all your ssh connections for your company's servers have to originate from do the trick of logging, reporting and restricting usage to detect theft? You log in with key1 to an unprivileged account on the jump server, and it decides if you look genuine (based on ip/ time of day/ time since last usage/ whatever) and then alerts an admin if a trigger is ticked. Then if you get access, you as a user are given logs to help you detect theft. Then if all is well you SSH to your actual destination, perhaps through port forwarding using key2 stored on your local machine, or perhaps from the jump server with key2 stored there.
- GekkePrutser 6y agoI just have my SSH keys on a yubikey: They're generated on token and the private key can't be exported. This makes them unique and unstealable. They can still be abused "live" while they are inserted via an SSH agent, but I turned on the "touch to sign" feature so for every use you have to touch the token button as well.
- jlgaddis 6y agoHopefully your Yubikey was manufactured AFTER the last bug in the (Infineon) key generation library was found and fixed.
- sshexpert 6y agoEvery 360 degrees
- egberts 6y agoI recall a problem with using a enterprise SSH portal a while back in which to centralize not only keys but logging as well. — Did a MitM affected that design ... still? Asking for a friend.
- bombcar 6y agoIt would be really nice if there was an "ssh update" feature similar to ssh-copy-id but built into the ssh command itself. So I could somehow indicate to SSH on my machine that key_2 is a replacement for key_1 - and any host that I ssh into that has key_1 in authorized_keys should be replaced with key_2 (and leave everything else the same). That way I could rotate keys and painlessly update them (and still have the old key for rarely accessed machines). Sure it's not perfect, but it's a sight better than never rotating. I wonder if there's something similar for the ssh_host_key - somehow to say "old key is deprecated but still here so ssh doesn't scream bloody murder, but use the new key from now on".
- jlgaddis 6y ago> I wonder if there's something similar for the ssh_host_key ... There is, since version 6.8 (~6 years ago) [0]. Make sure you have "UpdateHostkeys" set to "yes" (or "ask") on the client side. It was off by default when it was first added but I think I remember reading at some point that it changed to enabled by default. -- [0]: https://lwn.net/Articles/637156/ https://lwn.net/Articles/637156/
- loftsy 6y agoI haven't worried about SSH keys in years since moving everything to GCP or AWS. One less thing to worry about.
- martin_a 6y agotl;dr: How often should I rotate my ssh keys? More often than never! As often as you can.
- tonoto 6y agoI believe this article is a bit out of context, yes? In an ordinary environment (at home, at big corp.) you treat your keys as highly personal valuables and would not store keys at shared storage (unless special circumstances, due to air gaps or because shared non personal jobs need to run with a key - and then by a separately generated key). If I'm at that point that I would have to rotate my private SSH key, then game is lost anyway. If the storage at your personal device cannot be encrypted, might it be a solution to pass along something like ssh-add - <<< "$(pass show ssh/env1-key1)", and have that gpg-key on a yubikey for instance. In my (perhaps too small) view, this issue is not the issue, and the issue should instead be tackled. For instance, not by letting SSH be publicly accessible as the first thing and educate staff on locking their personal workstations. With the correct mindset other things should be of focus in the area of security.
- igneo676 6y agoYubikey + OpenGPG + Enable SSH support on your gpg agent Unless I'm missing something, that essentially solves the issue, no? Persistent private key, usable across all your machines that can't be exfiltrated. Bonus since you can even generate the key directly on the device! This gets even easier with newer OpenSSH versions if you use FIDO2 auth for SSH. I've not played with it personally, but word is you just plug in the key and off you go
- EthanHeilman 6y agoFor a single person that a pretty good solution just make sure you backup you SSH key so you can recover if you lose your yubikey. In a multi-person enterprise the issue becomes how to manage all these keys with on-boarding, off-boarding, logs, access policies as people's roles change. Maybe someone only needs access for a day? How do you ensure their key is removed tomorrow morning. Maybe someone never setup their yubikey and their SSH key is just living on their laptop and backed up to dropbox. SSH is a great solution for individuals but I've encountered so many anti-patterns when used among large teams.
- jon-wood 6y agoIf you're on AWS I strongly recommend EC2 Instance Connect, which uses the AWS CLI and IAM to issue short lived SSH keys that are automatically accepted by EC2 instances you have been granted access to via IAM policies.
- rhuber 6y agoThe author of this article should consider following their own advice, since they have a woefully outdated RSA-1024 ssh key securing their GitHub account. $ curl -s https://github.com/apenwarr.keys https://github.com/apenwarr.keys > blah $ ssh-keygen -l -f blah 1024 SHA256:1IWAUSXOcCKLcmOdAec8JbDt3T75udA4KSpRosEWUaU no comment (RSA) (update: they have now replaced it with an RSA 2048 bit key. progress.)
- suifbwish 6y agoIt would still take a long ass time to brute force a 1024 unless there is no brute force detection. Alternatively capturing the traffic can allow brute forcing the applied algorithm itself.
- katbyte 6y agoalternatively theres no reason to use 1024? i've been using 4096 for maybe a decade now?
- rhuber 6y agoI wasn't commenting on the strength of RSA-1024, per se, but on the assumed age of that key. OpenSSH's ssh-keygen hasn't defaulted to 1024 bit RSA keys since before version 4.2, in 2005. (I had to look it up: https://www.openssh.com/releasenotes.html https://www.openssh.com/releasenotes.html) You can still generate a 1024 bit RSA key, but someone would have to go out of their way to do so, and I can't imagine why they would have done that in the past .. decade?
- foolmeonce 6y ago> I can't imagine why they would have done that in the past .. decade? Maybe they aren't using software keys, but rather a low quality/older/small-kb hardware token or following the default guide for one? The vast majority supported 2048 in 2010 though..
- Retr0spectrum 6y agoIt's a public key, you can perform the "brute force" (factorisation) entirely offline, to derive the private key. Hypothetically. For now, RSA-1024 is too expensive to crack, for mere mortals.
- lucideer 6y ago> if you have your ssh private key on several machines, you have to remember to copy it to all those places Private keys should be per-host. I did copy my private key across multiple machines way back when I was a bit greener and first learning about how SSH worked. I did that for years. Not everyone knows best practice automatically and we should try and educate instead of shaming people who do it. BUT When you believe you have enough knowledge on the subject to go and write an article about SSH key best practice and you're still casually doing this as if it's OK, that's different. This is basic stuff; I have no interest in following any advice from this author if they think copying private keys to different hosts is ok.
- seiferteric 6y agoAlso, "ssh -A" allows you to take your keys with you. I also used to copy my keys around, but now I just use "-A" option when ssh'ing into a different host from my main workstation when I need my keys for something (git cloning for example).
- ozim 6y agoAdvice in the article unfortunately applies to people who don't lock their computers so it is talking to the wall. I rotate my ssh keys with a new laptop/pc. Private key should stay on one machine only. I think longest I had usable laptop was 5 to 6 years. I read the article and probably people who are interested in security will click it so it also is preaching to the choir.
- EthanHeilman 6y agoFTA: >The approach we take in our own infrastructure, modeled after TLS certificate infrastructure and Let’s Encrypt in particular, is to authenticate each device+person combination with a separate private key; that way, if a credential is stolen, we always know from where. The startup I co-founded, bastionzero.com, is motivated by this exact problem: What is the best way to do SSH key management. We hope to improve remote shell access by replacing long lived SSH keys stored on your machine with cryptographic identity attestations from multiple sources, e.g. OpenID Connect, FIDO, Network, etc... The end goal is to eliminate both single points of trust and long lived secrets.