Skip to content
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

Support ssh public keys configuration #10573

Merged
merged 4 commits into from
Jul 5, 2022
Merged

Support ssh public keys configuration #10573

merged 4 commits into from
Jul 5, 2022

Conversation

mustard-mh
Copy link
Contributor

@mustard-mh mustard-mh commented Jun 10, 2022

Description

This PR works on allowing users to upload their own ssh public key to Gitpod, make copy-paste ssh connect more conventional, and make sharing of ssh connect command more safety

Link of Figma

TODO

Functions for late used time?

Related Issue(s)

Relate #9932

How to test

Modal of ssh copy-paste always shows SSH Key as the default selection, if the user has no public key uploaded, it will show a warning in this section.

  • Start a workspace in prev env
  • Wait until the workspace is ready
  • Connect with ssh copy-paste, get conn A
    • Failed with ssh key conn
    • Success with access token conn
  • add a public key via setting -> ssh keys
  • Connect with ssh copy-paste use ssh key, get conn B
  • Delete that public key you set in the settings
  • Connection B should still work
  • A new conn C which use the same command like conn B, will not works - ask a password

Release Notes

Allow users to add and remove SSH public keys in settings
Change UX of SSH copy-paste to support ssh key connection

Documentation

  • TODO

Werft options:

  • /werft with-preview

@mustard-mh mustard-mh force-pushed the hw/ssh-keys-s branch 2 times, most recently from d69e014 to 2b2c8da Compare June 10, 2022 07:57
@mustard-mh mustard-mh changed the title Hw/ssh keys s Add protocol and implement for ssh public keys Jun 10, 2022
@roboquat roboquat added size/XXL and removed size/XL labels Jun 13, 2022
@mustard-mh mustard-mh changed the title Add protocol and implement for ssh public keys Support ssh public keys configuration Jun 13, 2022
@mustard-mh mustard-mh force-pushed the hw/ssh-keys-s branch 4 times, most recently from 56aa88c to 461e496 Compare June 14, 2022 19:27
@mustard-mh mustard-mh force-pushed the hw/ssh-keys-s branch 4 times, most recently from a8855a4 to b465867 Compare June 15, 2022 17:30
@mustard-mh
Copy link
Contributor Author

/hold

@gitpod-io gitpod-io deleted a comment from werft-gitpod-dev-com bot Jun 15, 2022
@gitpod-io gitpod-io deleted a comment from werft-gitpod-dev-com bot Jun 15, 2022
@gitpod-io gitpod-io deleted a comment from werft-gitpod-dev-com bot Jun 15, 2022
@gitpod-io gitpod-io deleted a comment from werft-gitpod-dev-com bot Jun 15, 2022
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-hw-ssh-keys-s.30 because the annotations in the pull request description changed
(with .werft/ from main)

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-hw-ssh-keys-s.31 because the annotations in the pull request description changed
(with .werft/ from main)

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-hw-ssh-keys-s.32 because the annotations in the pull request description changed
(with .werft/ from main)

@mustard-mh
Copy link
Contributor Author

mustard-mh commented Jun 15, 2022

I'll not change the description anymore until one build success, since werft is crazy now... 😱

@mustard-mh mustard-mh marked this pull request as ready for review June 15, 2022 17:42
Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM! 👍

@akosyakov
Copy link
Member

akosyakov commented Jun 27, 2022

/werft run

👍 started the job as gitpod-build-hw-ssh-keys-s.45
(with .werft/ from main)

@akosyakov
Copy link
Member

@mustard-mh wanted to check out UI, but werft fails

@gtsiolis
Copy link
Contributor

gtsiolis commented Jun 27, 2022

/werft run

👍 started the job as gitpod-build-hw-ssh-keys-s.46
(with .werft/ from main)

@mustard-mh
Copy link
Contributor Author

mustard-mh commented Jun 28, 2022

Resolved merge conflict

/werft run with-clean-slate-deployment=true

👍 started the job as gitpod-build-hw-ssh-keys-s.48
(with .werft/ from main)

@gtsiolis
Copy link
Contributor

@mustard-mh Could you clean deploy another preview environment or delete some users because we've reached the limit of 10 users and no new users can sign up.

@mustard-mh
Copy link
Contributor Author

@mustard-mh Could you clean deploy another preview environment or delete some users because we've reached the limit of 10 users and no new users can sign up.

@gtsiolis Rebased to main again, since some commits may fix this problem (db have only two builtin users)

@mustard-mh
Copy link
Contributor Author

mustard-mh commented Jun 28, 2022

/werft run

👍 started the job as gitpod-build-hw-ssh-keys-s.50
(with .werft/ from main)

@mustard-mh
Copy link
Contributor Author

works now @gtsiolis

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, @mustard-mh! 🔮

Took another look at this and left a few more comments below. 👀

Comment on lines +83 to +85
<a href="/docs/configure/ssh" target="gitpod-ssh-doc" className="gp-link">
Learn more
</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: Do we need this help link here? Asking because we also link below to the same page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can keep that, they are different part link

components/gitpod-db/src/typeorm/user-db-impl.ts Outdated Show resolved Hide resolved
try {
getData(value);
} catch (e) {
return "Key is invalid. You must supply a key in OpenSSH public key format.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue(non-blocking): While we catch some cases, we still allow users adding invalid keys. Is this known? If needed, let's open a follow-up issue to resolve this.

components/dashboard/src/settings/SSHKeys.tsx Show resolved Hide resolved
)}
{!hasSSHKey && selectSSHKey && (
<Alert type="warning" className="whitespace-normal">
You don't have any public SSH keys in your Gitpod account. You can{" "}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: When you don't have an SSH key in place, you still see an SSH command below to connect, which asks for a password. Should we drop (hide) the SSH command below?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we should allow to copy it always. If a user adds keys following a warning then they can use it immediately. Otherwise they need to reopen the dialog

Copy link
Contributor

@gtsiolis gtsiolis Jun 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we should allow to copy it always. If a user adds keys following a warning then they can use it immediately. Otherwise they need to reopen the dialog

Ah, I see. Then the warning dialog becomes obsolete or no longer relevant after adding a key, right?

Maybe it's not worth doing so, but what do you think of rephrasing the copy then to the following when there are no keys in place:

BEFORE

The following shell command can be used to SSH into this workspace with a ssh key.

AFTER

The following shell command can be used to SSH into this workspace with a ssh key, once you add an SSH key.

Otherwise, let's leave this as is and ignore the comment above in #10573 (comment). ✔️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with both. I think they will read a warning when prompted for a password.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEAL—Let's go with any option for now.

@akosyakov
Copy link
Member

akosyakov commented Jun 29, 2022

UI looks good, but then I try first time user flow I cannot connect:

  • i start a workspace
  • then go to dashboard and select connect to SSH
  • it tells me that I don't have public keys
  • i generate a new key on my machine under ~/.ssh/test_rsa
  • i go to setting and add this key
  • i go back to dialog, copy a command, paste it with -i ~/.ssh/test_rsa
  • it asks me for password

Is it because newly installed keys are not automatically propagated to workspaces? Hm it does not work after restart either.

@iQQBot
Copy link
Contributor

iQQBot commented Jun 29, 2022

image
for me it works good @akosyakov Did your really upload correct public key? public key file name should be end with .pub

could your use ssh -vvv ..... command and provider logs?

@akosyakov
Copy link
Member

akosyakov commented Jun 29, 2022

@iQQBot I did everything again and it worked now. So probably some mistake on my side.

Oh, I know why, I did not exit another ssh session 😆 so I was in Gitpod container.

@iQQBot
Copy link
Contributor

iQQBot commented Jul 5, 2022

rebase to main and double-checked everything, now we are in gen51 it's time to merge

/unhold

@roboquat roboquat merged commit 924b20e into main Jul 5, 2022
@roboquat roboquat deleted the hw/ssh-keys-s branch July 5, 2022 05:34
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note size/XXL team: webapp Issue belongs to the WebApp team
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants