News for hackers. Stuff that matters.
Re:Show HN: My SSH server knows who you are by JoshTriplett on Tuesday August 04, 2015 @02:44PM (#10005379)
> (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...

Re:Show HN: My SSH server knows who you are by phamilton on Tuesday August 04, 2015 @04:17PM (#10005991)
For 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.
Re:Show HN: My SSH server knows who you are by javajosh on Tuesday August 04, 2015 @05:16PM (#10006339)
I 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.
Re:Show HN: My SSH server knows who you are by JoshTriplett on Tuesday August 04, 2015 @05:59PM (#10006547)
The 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.

Re:Show HN: My SSH server knows who you are by javajosh on Wednesday August 05, 2015 @02:03AM (#10008232)
The 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.

Re:Show HN: My SSH server knows who you are by hamburglar on Wednesday August 05, 2015 @05:13AM (#10008643)
Not exactly. The remote host, which you have forwarded your agent to, tries to log onto your production host using your public key, and when the production host sends it a signing challenge to prove it has the authority of your private key, it can simply ask your ssh agent to do that signing. Once that is complete, you are logged in and the session has a session key that has nothing to do with your pub/private keys. The ssh agent does not do decryption, it just gets the session started.
Re:Show HN: My SSH server knows who you are by micaeked on Wednesday August 05, 2015 @06:18AM (#10008787)
Another example is if I want to transfer something from server A to server B, without it going through my shitty little pipe, and without storing the private key on either server.
Re:Show HN: My SSH server knows who you are by throwaway2048 on Wednesday August 05, 2015 @02:25AM (#10008266)
its very useful for so called "Bastion Hosts", an SSH server that allows further access into the network and is totally locked down.
Re:Show HN: My SSH server knows who you are by beagle3 on Wednesday August 05, 2015 @06:27AM (#10008822)
I know it as a "jump host" or "jump box". Regardless, it's still not a good idea to have agent forwarding - what about the boxes you forward to? Do you trust them not to abuse the forwarding trust (Is there a way to limit forwarding trust to just one machine?)

Also, I used to add every jump combination into my .ssh/config file, but came across a wonderful trick that makes it unnecessary: https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_J...

Re:Show HN: My SSH server knows who you are by creshal on Wednesday August 05, 2015 @04:22AM (#10008511)
You don't need agent forwarding for that. Just use ssh's dumb tcp forwarding and keep your agent on your local host.

Ex.:

    Host bastion.company
    	ProxyCommand none

    Host *.company
    	ProxyCommand ssh -W %h:%p bastion.company
Re:Show HN: My SSH server knows who you are by mentat on Wednesday August 05, 2015 @07:48AM (#10009064)
Because enabling tcp forwarding is so much more safe on a jump box? That's just asking for another pile of unauditable trouble.
Re:Show HN: My SSH server knows who you are by creshal on Wednesday August 05, 2015 @09:17AM (#10009467)
Safer than dumping all your private keys onto the jump box and using that to validate the final target? Why yes. This way, your local ssh client validates the final target public key, not the jump box.
Re:Show HN: My SSH server knows who you are by mentat on Wednesday August 05, 2015 @01:11PM (#10011240)
The whole point of agent forwarding is that you don't have to place your keys on the jump box. With -c for per use confirmation it seems much more secure.
Re:Show HN: My SSH server knows who you are by creshal on Thursday August 06, 2015 @02:49AM (#10014951)
> The whole point of agent forwarding is that you don't have to place your keys on the jump box.

A socket that allows dumping the keys isn't really an improvement. If the box is compromised, agent forwarding can still be abused.

> seems much more secure.

Emphasis on "seems".

Re:Show HN: My SSH server knows who you are by laumars on Wednesday August 05, 2015 @03:35AM (#10008414)
This is what I do for my home network. I hadn't realised it had a name (though not at all surprised)
Re:Show HN: My SSH server knows who you are by saurik on Tuesday August 04, 2015 @05:34PM (#10006425)
Well, 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.)
Re:Show HN: My SSH server knows who you are by Sevrene on Tuesday August 04, 2015 @11:40PM (#10007929)
There'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

Re:Show HN: My SSH server knows who you are by scintill76 on Tuesday August 04, 2015 @06:35PM (#10006715)
I 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.
Re:Show HN: My SSH server knows who you are by JoshTriplett on Tuesday August 04, 2015 @07:04PM (#10006891)
I wish gnome-keyring's integrated ssh agent supported that.
Re:Show HN: My SSH server knows who you are by scintill76 on Tuesday August 04, 2015 @08:40PM (#10007365)
It'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-comm... for how to override in your user dir, or find it in the GUI somewhere. [2] https://launchpad.net/ssh-askpass-keyring is the Ubuntu page

Re:Show HN: My SSH server knows who you are by JoshTriplett on Tuesday August 04, 2015 @09:27PM (#10007554)
I 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.
Re:Show HN: My SSH server knows who you are by skarap on Tuesday August 04, 2015 @03:44PM (#10005757)
> EDIT: Check out this search: 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?

Re:Show HN: My SSH server knows who you are by riffraff on Wednesday August 05, 2015 @01:41AM (#10008184)
I 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.
Re:Show HN: My SSH server knows who you are by jsmeaton on Wednesday August 05, 2015 @04:31AM (#10008541)
Thanks 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.