5 ms·
> (And if you have agent forwarding active I show you a big WARNING [0].) It amazes me that people enable that for random servers. Seems like SSH should make
by JoshTriplett 11y ago
> (And if you have agent forwarding active I show you a big WARNING [0].)
It amazes me that people enable that for random servers. Seems like SSH should make that harder. Enabling it for a specific server you trust makes sense; enabling it for all servers doesn't. SSH could reject "ForwardAgent" outside a Host block, for instance, and force you to at least write a "Host *" block.
EDIT: Check out this search: https://github.com/search?utf8=%E2%9C%93&q=ForwardAgent&type=Code&ref=searchresults https://github.com/search?utf8=%E2%9C%93&q=ForwardAgent&type...
- skarap 11y ago> EDIT: Check out this search: https://github.com/search?utf8=%E2%9C%93&q=ForwardAgent&type.. https://github.com/search?utf8=%E2%9C%93&q=ForwardAgent&type.... Holy mother of god, can we somehow return to the time when almost nobody used *nix and Microsoft was the one struggling to keep systems of these people secure?
- riffraff 11y agoI don't think this time ever existed, I remember some fifteen years ago using google to search for unshadowed /etc/passwd and vulnerable cgi scripts, and there were tons of results.
- phamilton 11y agoFor those who don't get why this is terrible, imagine if GitHub were compromised and their ssh agent tampered with. When you clone a repo, they could use your forwarded agent to log into your production hosts. That's pretty bad.
- javajosh 11y agoI don't fully understand how this would work - the key being "forwarded agent". My (poor) understanding is that in order for compromised github to get to a host I'm connected to they would somehow need to invoke ssh on my host, somehow. The only way that would not be the case is if ssh maintains an in-memory persistent thing that a) maintains connections to foreign hosts, and b) can somehow be signaled from active connections. If that's true, then a) I didn't realize it could do that, and b) it would be quite handy sometimes, although the security implications are rather serious.
- saurik 11y agoWell, what you describe (pretty much) is the "agent", and many people do, in fact, find it "quite handy" ;P. (I do not use this feature, myself.)
- deleted 11y ago[deleted]
- JoshTriplett 11y agoThe SSH agent maintains your private keys and provides the necessary responses to ssh when it wants to authenticate to a server. If you ssh to a server and forward your SSH agent, that server can then run ssh themselves and impersonate you to a different remote server, and your SSH agent will supply the necessary authentication information. Or, in short: never use ForwardAgent (or ssh -A) to a server you don't trust.
- javajosh 11y agoThe remote ssh process asks your host to unencrypt it's traffic? Your process takes an encrypted stream, sends the plaintext, and your keys never leave your machine. That's...incredibly clever, although I can only think of one scenario where it would be necessary (navigating securely through a sequence of ssh sessions where some of the secondary hosts are inaccessible from your originating host. E.g. a kind of "secure trojan horse". Sometimes I feel just so awed at the ingenuity of people, especially with software and computers.
- throwaway2048 11y agoits very useful for so called "Bastion Hosts", an SSH server that allows further access into the network and is totally locked down.
- laumars 11y agoThis is what I do for my home network. I hadn't realised it had a name (though not at all surprised)
- scintill76 11y agoI also use the -c (confirm) flag with ssh-add. I don't forward the agent willy-nilly, but if someone still manages to compromise the agent, I will hopefully know when I'm getting confirmation popups I didn't initiate.
- JoshTriplett 11y agoI wish gnome-keyring's integrated ssh agent supported that.
- scintill76 11y agoIt's been awhile since I set it up, but I believe I've disabled gnome-keyring's agent[1], use the OpenSSH one instead, use ssh-askpass-keyring[2] as the SSH_ASKPASS environment variable to ssh-add to read key passphrases from the keyring (manually invoked via a shell script helper; but only needs to be done once per login session), and GNOME's gnome-ssh-askpass installed as the system default, for key confirmations. (This is on the Cinnamon desktop, so other GNOME setups could be different.) [1] See https://askubuntu.com/questions/63407/where-are-startup-commands-stored https://askubuntu.com/questions/63407/where-are-startup-comm... for how to override in your user dir, or find it in the GUI somewhere. [2] https://launchpad.net/ssh-askpass-keyring https://launchpad.net/ssh-askpass-keyring is the Ubuntu page
- JoshTriplett 11y agoI know how to override it, but I prefer all the other behavior of gnome-keyring's agent. -c is literally the only feature I want that it doesn't have.
- deleted 11y ago[deleted]
- Sevrene 11y agoThere's something I found on hacker news awhile back that can allow you to use ForwardAgent while limiting your identities so that you can forward your ssh agent, but it only forwards the identity you used to connect to that server. It starts up a separate agent for each identity when you invoke it. You can find it at: https://github.com/ccontavalli/ssh-ident https://github.com/ccontavalli/ssh-ident
- jsmeaton 11y agoThanks for the tip. I use ForwardAgent for all my servers at work, but I had it defined in a "Host *" block. I've now setup separate blocks for my work domains and have moved ForwardAgent into there alone. Never knew it was a risk until this thread.