Skip to content

Get ssh identity file from ssh config and ssh agent #11

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

Merged
merged 6 commits into from
Aug 4, 2022

Conversation

mustard-mh
Copy link
Contributor

@mustard-mh mustard-mh commented Jul 29, 2022

Description

Support default ssh behaviors of IdentityFile

SSH Config code is a copy of https://github.com/jeanp413/open-remote-ssh/blob/master/src/ssh/sshConfig.ts

Related Issue(s)

Fixes gitpod-io/gitpod#11467

How to test

IdentityFile

  • Setup your ~/.ssh/config (mac) with gitpod host and custom identity file
  • Add an ssh key to the ssh agent with ssh-add
  • Run extension with this branch
  • Open Gitpod workspace with Desktop VSCode and connect using your debug vscode window
  • See if your custom identify file works

IdentityAgent

  • Follow the doc to add and turn on 1Password ssh-agent, i.e. id_ed25519
# you can gen one by command below, which is recommend by 1password
ssh-keygen -t ed25519 -b 4096
  • Remove related ssh key files in your computer. i.e. id_ed25519 id_ed25519.pub
  • Upload that ssh key to https://gitpod.io/keys and make sure only that one exists in https://gitpod.io/keys
  • Run extension locally and make sure debug one is activated
  • Open a new workspace with desktop VSCode
  • Check if we can access without copy password modal

Errors

Fill up incorrect identityFile and identityAgent

@mustard-mh mustard-mh requested a review from jeanp413 July 29, 2022 10:21
@mustard-mh mustard-mh marked this pull request as ready for review July 29, 2022 10:21
@jeanp413 jeanp413 changed the title Get ssh identity file from ssh config Get ssh identity file from ssh config and ssh agent Jul 30, 2022
@jeanp413
Copy link
Member

@mustard-mh I also added logic to read ssh key from the ssh agent so we can completely close gitpod-io/gitpod#11467

@akosyakov
Copy link
Member

Please add [1] to How to test to prove that code is reliable for all kind of use cases. If not we need a way to enable not captured use cases.

@akosyakov
Copy link
Member

Also cc @loujaybee we will need to update docs and the announcement blog about expectations.

@mustard-mh
Copy link
Contributor Author

mustard-mh commented Aug 3, 2022

I added IdentityAgent in How to test section. cc @akosyakov

@mustard-mh
Copy link
Contributor Author

Could you help test and review 🙏 ? @felladrin @iQQBot

@jeanp413
Copy link
Member

jeanp413 commented Aug 3, 2022

@mustard-mh I think latest commit is not necessary so I would say just revert it and do a 1 line change in line 465 adding the untildify call

This reverts commit 9e4f9a7.
@jeanp413
Copy link
Member

jeanp413 commented Aug 4, 2022

I'll go ahead and address the comments as I want to test on windows/mac as I won't be available tomorrow/friday because holidays 🙂

@mustard-mh
Copy link
Contributor Author

@mustard-mh I think latest commit is not necessary so I would say just revert it and do a 1 line change in line 465 adding the untildify call

Ahh, just realized that untildify is working for this 🌴

@mustard-mh
Copy link
Contributor Author

I tested (MacOS) with IdentityFile and IdentityAgent, works well.

Note that:

  • .pub file can be deleted, fingerprint calc in default ssh behavior works well, but not in our extension because we use .pub file to calc the fingerprint
  • Tried not to use .pub but the package we are using (ssh2) does not support calc fingerprint for private key with password, maybe find another package that can resolve it

They are not the reasons to block this PR, but we can mark it

@jeanp413
Copy link
Member

jeanp413 commented Aug 4, 2022

I just finished testing in windows, did a fix and it's working 🎉

.pub file can be deleted, fingerprint calc in default ssh behavior works well, but not in our extension because we use .pub file to calc the fingerprint

what's the point of deleting the .pub file? I don't think is a useful edge case we should worry about, ssh-keygen always creates a key pair as far as I know

@mustard-mh
Copy link
Contributor Author

what's the point of deleting the .pub file?

No, just said it can be deleted, and in case users have this habit (😅) and face it in the future

@jeanp413
Copy link
Member

jeanp413 commented Aug 4, 2022

I tested (MacOS) with IdentityFile and IdentityAgent, works well.

I tested on windows and linux and looks there are no regression, so I'll go ahead and merge it and release a pre-release version, I'll ask tarun to try it (he's using with 1password integration) and a user in discord who is reporting some issues with previous behavior

@jeanp413 jeanp413 merged commit 72a07b7 into master Aug 4, 2022
@jeanp413 jeanp413 deleted the hw/ssh-config branch August 4, 2022 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update supported SSH locations for VS Code Desktop
3 participants