You can't afford to keep your SSH keys on disk jola.dev · 6 points · 0 comments ...
HN Best 200 @best
You can't afford to keep your SSH keys on disk jola.dev · 6 points · 0 comments · HN thread
TL;DR Johanna Larsson describes moving her SSH private keys off disk and into Bitwarden's SSH agent, so keys are no longer readable by malicious code scanning her filesystem. She gives setup steps (importing keys, enabling the agent, editing ~/.ssh/config and SSH_AUTH_SOCK) and a bonus section on signing git commits with SSH keys. After a couple of weeks she reports it works with only occasional approval prompts.
- Keys loaded with ssh-add stay in memory and the on-disk copies remain readable by any malicious code that scans the disk, so she moved them into Bitwarden.
- Keys are imported into Bitwarden by copying the private key and using the upload icon on the Private Key field in the SSH key edit form.
- Bitwarden's SSH agent is enabled in app settings, with prompts set to appear whenever the vault locks (she uses a four-hour lock interval).
- Config changes: an IdentityAgent line pointing to ~/.bitwarden-ssh-agent.sock in ~/.ssh/config, and exporting SSH_AUTH_SOCK in the shell for tools like ssh-keygen.
- Git commit signing uses a separate dedicated SSH key, so creating a commit and pushing it require two separately authorized keys; forges like GitHub need the key added as a signing key.
- She chose this over Secure Enclave-style hardware options because it was easier to use with minimal disruption.
Discussion No comments yet, so there is no discussion to summarize. The post was submitted with 6 points and has not drawn responses.