r/github • u/Jou_See • 18d ago
Discussion Do you use a passphrase on your SSH keys?
I am building an app that interacts with local SSH keys and trying to decide how much time to invest in edge-case ssh-agent support. So I wonder how many people do use the passphrase for ssh keys?
85
Upvotes
26
u/pdath 18d ago
I use a passphrase on an older SSH key, but my newer keys have been moved to hardware YubiKeys.
I shifted to Yubikey because it needs a physical touch, which an AI agent can't do, yet.
17
u/SouthCollar2929 18d ago
You're not getting a representative sample here
6
u/Motor-Concentrate788 18d ago
At first i did, but then after a while it gets tedious having to open my password manager just to ssh so i removed the passphrase. My reasoning being if someone stole my laptop, full disk encryption would protect the key anyway. And if malware somehow got into my laptop and stole my key files, it could probably still extract my keys from ssh-agent.
54
u/mbround18 18d ago
Every time, at its core the ssh key gives you access to systems and code. I also use a physical security key ed25519-sk & gpg with password for code signing. Does it get tedious? Yes haha but its worth it
19
u/pconwell 18d ago
I am sure I'm in the minority here and I recognize it's not a good idea, but I do not.
7
u/Soapy-Cilantro 18d ago edited 18d ago
There are only a few situations where a passphrase is going to really protect you, but it's mostly just protecting the key at rest on disk. As others have said, proper malware can extract your keys from ssh agent, or a keylogger could snag the passphrase if typed out. If an infostealer just scrapes ~.ssh/ then the passphrase will help.
The better thing to do is to use FIDO2 hardware like yubikey or nitrokey. IMO it's not tedious once it's a part of your workflow and the default habit.
1
u/Atmosck 18d ago
Wouldn't you like to know?
3
u/jonwolski 18d ago
Yes, and I use ssh-agent along with MacOS’ keychain support (
ssh-add -k $KEY_FILE), so that I never have to type the password. In fact, my ssh config has BatchMode yes, so that I get errors instead of prompts.2
u/j0x7be 18d ago
Pretty much always. I use a password manager that adds keys to agents.
2
u/MarsupialLeast145 18d ago
Yes, and no.
2
u/runnercola 16d ago
No because most of my ssh keys are “sk” keys now.
1
u/ridobe 18d ago
I use a simple passphrase and a yubikey.
1
u/countnfight 18d ago
Yes. I have one set of keys for everyday things that use a passphrase that I know, so it's not in any password managers. I have a separate key for other things that requires a Yubikey with touch.
1
u/shgysk8zer0 18d ago
I use Secritive on Mac. My key is stored in Secure Enclave. So technically no, but it's more secure because of how it's stored and the biometrics to access it.
1
u/nakfil 18d ago
No because I used 1Password’s SSH integration so the keys aren’t even stored on disk.
1
u/Current-Ant-9047 18d ago
If you have MacBook with Touch ID just use Secretive and keep your SSH key there. It uses security enclave, ask AI to learn more about this
1
u/enigmamonkey 18d ago edited 18d ago
I definitely do, but I'll qualify...
Since I'm not sure what you're building: What do you mean by "edge-case" and when you say "passphrase", is the password length important in your situation? I presume not but asking just in case it matters.
For me using an SSH agent itself isn't an edge case at all since I believe it should be standard practice. So, when building an app that is somehow impacted by that, my opinion is that you aught to take it into account.
p.s. I'm saying this since technically having a password in your SSH key doesn't necessitate the use of an SSH agent, but not having an SSH agent results in you being required to manually type your password repeatedly, both on local systems and on remote systems if you don't use agent key forwarding (e.g. if you SSH to yet another server). The SSH agent merely stores the decrypted key it for you in memory (avoiding storing an unencrypted key at rest) and handles handshakes for you once you've provided your password.
1
u/JVAV00 18d ago
Depends, check this vid first and see if you are one of them using this setup: https://youtu.be/NGWwUQWzpIc
1
u/Connir 18d ago
Yes and an agent.
1
u/mbsp5 17d ago
Bitwarden with an ssh agent and forwarding. Works flawlessly once setup. It’s only decrypted after you use biometrics.
1
u/Poat540 17d ago
Nope, my home pi’s do, work don’t care
1
u/yiyufromthe216 17d ago
It only makes sense if you don't have full disk encryption. Most of people have the agent socket set it up anyway at login, so it's the same as you unlocking the encrypted partition once at boot time
1
u/0kth4t5fin3 17d ago
what even the fuck absolutely of course
1
u/lugpocalypse 17d ago
My ssh keys are in 1password. Also, ssh agent is your friend. But, for work and professionally its all ssh certificates. No long lived creds that could leak.
1
u/chalbersma 17d ago
Support ssh-agent
1
u/AdDirect6138 16d ago
La clef ssh est ouverte avec un mot de passe très fort uniquement avec mon ip, si je dois me connecté sur une autre ip il demande un 2FA supplémentaire, c'est pas parfait mais c'est toujours mieux que rien
1
u/ConsonantEcho 7d ago
For a GUI, the case I’d test is the user coming back after a restart: the repo is still there, but their key isn’t loaded in the agent. A useful error tells them “your key is locked or not loaded” instead of sending them down the “do I even have access to this repo?” rabbit hole.
1
u/tblancher 18d ago
I unlock mine with systemd+TPM2 when I log into my laptop.
0
u/CollegeElectricalKid 18d ago
This is underrated advice. We did exactly this and realized two of our top three jobs could be handled by Slack’s built-in workflows. We only needed an AI tool for answering repeat questions. Saved us from paying for an expensive platform we’d have used 20 percent of.
0
u/ShogiOne 18d ago
I am developing a project that helps to see exactly this: https://github.com/suelio/guardrail-code