https://developer.hashicorp.com/boundary/tutorials/credentia...
it completely replaces the need for bastion hosts and ssh-agent at scale (I'm a hashicorp's paying customer)
Using this teams can share an SSH key without exposing the key; nor do you need to configure certificate PKI, use jump hosts, or otherwise change your existing software or workflows.
The Github example complicates things, but the correct solution is actually another key:
Generate a separate private key on foo and place that one in github, ideally per project as a deploy key.
Generating a key per host is just a different security model than key forwarding, and arguably a worse one if key forwarding is done defensively (i.e. forward a separate key, with only those permissions you would give to a key present on the connected host itself).
That is a TERRIBLE idea, if foo can be compromised. Even if you secure the private key with a passphrase, it still needs to be loaded into foo's memory, by a binary resident on foo, which can be used to exfiltrate that private key.
If you're confident foo cannot be compromised, then the whole point is moot anyway.
The best solution in that situation is a separate key that's private to foo.
c) use proxyjump (-J) to access bar (https://www.man7.org/linux/man-pages/man1/ssh.1.html), and/or
d) generate a new private key on foo and use that to access github.
You might think that's a crazy waste of time compared to forwarding, but it's actually much, much safer and actually only takes a moment:
ssh-keygen -t ed25519
cat ~/.ssh/id_ed25519.pub
and then just paste that in Github.See also https://userify.com/docs/jumpbox for more jumpbox docs.
> [...] only takes a moment [...]
Not every org's policy allows adding unaudited ad-hoc SSH keys.
> [...] much, much safer [...]
Definitely not always, if the hosts you store these keys on are not as hardened as you local machine (or a hardware key connected to it).
Then audit them and get them in the process. Agent forwarding is too big of a risk.
> Definitely not always, if the hosts you store these keys on are not as hardened as you local machine (or a hardware key connected to it).
Once you use agent forwarding, the keys are no longer protected on your local machine. (Ironically, this RCE is precisely because of the requirement to whitelist hardware keys!)
Between local and jump host, there will be two layers of encryption. The jump host decrypts the outer layer, and the two ends the inner layer.
e.g. how would I ssh into foo, and then later into bar, or perhaps pull some code from github onto foo that is authenticated by my key?
It seems like the answer is either: a) ssh -A, or b) install my private key on foo.