You can't afford to keep your SSH keys on disk

(jola.dev)

22 points | by shintoist 6 hours ago ago

5 comments

  • jon-wood a minute ago ago

    I’m currently trying to get to a point where I don’t keep long lived credentials on disk, and as much as possible keep them out of environment variables as well. I don’t want random processes running as my user account to be able to go sniff out my GitHub, AWS, and so on API tokens. Unfortunately It’s a massive pain to get right at the moment. I particularly don’t want long lived credentials where if a process sends them to a server somewhere they’re valid for ages afterwards.

    SSH keys are pretty much solved, I’m using 1Password’s SSH agent similar to what OP is doing with Bitwarden. It works wonderfully.

    Various API keys are a pain in the backside. 1Password has some features which kind of maybe help by allowing you to keep credentials in 1Password and then exposing them either as a named pipe that requires auth to read, or via CLI wrappers that inject the credentials at runtime. Both of those still require long lived credentials though.

    At some point I’ll probably snap and build something analogous to what 1Password are doing but using OAuth or similar to request short lived, scoped, credentials as needed. I assume there’s approximately six hundred things like this which are targeted at agent use but I’d like something that doesn’t require me to run everything in a sandbox.

  • 201984 20 minutes ago ago

    Why not just use the regular SSH agent with a password? Still encrypted on disk, so I don't see what the difference is.

    • mingus88 6 minutes ago ago

      If your threat model includes rogue LLM agents on your system then your passphrase can be compromised by a logger or just getting it from memory

      I use yubikey Fido keys so I need to touch the key to unlock it

      It’s quite wild to be working and see my yubikey flash waiting for input because I have an agent running a task and it’s trying things like GitHub auth without asking me. Not hard to imagine it taking the next step and just grabbing tokens it needs to do whatever it needs to complete its task

    • abound 5 minutes ago ago

      Yeah I'm really curious why using a key passphrase is not an option for the author. Seems like it has everything they're looking for:

      - Good ergonomics

      - No private key sitting unencrypted on disk

      Hell, isn't it even the default when using `ssh-keygen`? As in, it prompts you for a passphrase if you don't explicitly tell it not to?

  • a3w 4 minutes ago ago

    cat ~/.ssh/id_rsa | pbcopy

    feels wrong. Unnecessary uses of cat.

    `pbcopy < ~/.ssh/id_rsa`