-
Notifications
You must be signed in to change notification settings - Fork 891
Cannot bring your own SSH key to clone #3126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I also ensured the key has proper permissions |
Ahh this is due to the lack of an SSH agent running. I suppose we can manually detect |
hmm... I am seeing this still happens with I specify an SSH config
|
Interesting. Maybe our SSH command isn't properly passing the identity file... I'll test! |
Ahh, I see. It's because we explicitly specify our SSH identity, even if one is already passed in. Testing a fix now. |
Alright, so I believe I understand the issue. Our Git SSH feature passes During implementation, I expected multiple identities could be added, but I'm wrong. Seems like a clean way to handle this is allowing the disabling of |
We could use an agent like we do in v1, Golang has an agent server implementation in |
@deansheather I kind of like that idea, but our current implementation has the benefit of working in tandem with SSH agent forwarding, if we used our own agent, the forwarded agent would disable the Coder SSH key. It could be considered acceptable behavior/tradeoff but I suspect it would be unexpected for the user. @kylecarbs To my knowledge passing The only thing is that the One thing we could do is parse the users SSH config using
These are the default values (for me anyway), i.e. user did not change anything. What we could do here is check if any of these files exist -- if yes, add them as The output is reduced to as many identity files as have been defined for the host, e.g. with a single entry in
I don't know if we should take the value of PS. If the user wants to to work around the issue right now, one option would be to |
Based on the above, this would be my proposal:
|
In SSH sessions we could detect agent forwarding and proxy the requests to the original agent and tack on our own keys. |
@mafredri's proposal of adding more Agent forwarding detection + proxying sounds complicated. |
I do think @deansheather's suggestion has merit, but I also agree with @johnstcn, there may be unexpected complications. I once tried to write a multi-agent (I have two locally and sometimes I'd like to forward both) and noticed that some agents allow you to re-use the socket connection between invocations whereas others require you to re-connect to the socket every time you use it. (I abandoned that project though, for other reasons.) Writing the agent is fairly easy using |
I've unassigned myself! This one is up for grabs 😎 |
Added to the EE milestone since we're working with a group who'd like this. |
I can grab this one, I'll go with the simple approach of adding |
It just dawned upon me that there would be one benefit to going the proxy-agent route. It would allow us to enable git commit signing via SSH key without exporting the private key to the filesystem. Might be an alternative approach to #3318. The user should in theory only need to to update their git config:
(Note we should implement Since we'd be setting |
My previous comment inspired me to look deeper into the SSH agent (proxy) method. Oh boy. When it comes to Windows, the SSH agent seems like a minefield. First and foremost, agent forwarding on Windows doesn't seem to work (or at least properly in all scenarios, see PowerShell/Win32-OpenSSH#1865, the issue tracker has many more like it). When I say a minefield, check out this graph (borrowed from masahide/OmniSSHAgent): So take-aways here are that:
This makes me confident we should go ahead with the |
This change means that users can place SSH keys in the default locations for OpenSSH, like `~/.ssh/id_rsa` and it will be automatically picked up (as per a default OpenSSH experience). Fixes #3126
This change means that users can place SSH keys in the default locations for OpenSSH, like `~/.ssh/id_rsa` and it will be automatically picked up (as per a default OpenSSH experience). Fixes #3126
* feat: Improve experience with local SSH keys This change means that users can place SSH keys in the default locations for OpenSSH, like `~/.ssh/id_rsa` and it will be automatically picked up (as per a default OpenSSH experience). Fixes #3126 * fix: Ensure gitssh cleans up temporary file on interrupt Co-authored-by: Dean Sheather <[email protected]>
I used
scp
to transfer my local SSH key into$HOME/.ssh/id_rsa
. However, usinggit clone
inside my workspace does not work. It seems to only respect the Coder-generated key.The text was updated successfully, but these errors were encountered: