-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Local Companion (alpha) #3958
Merged
Merged
Local Companion (alpha) #3958
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/werft run 👍 started the job as gitpod-build-cw-login-local.32 |
/werft run 👍 started the job as gitpod-build-cw-login-local.33 |
to make using the token easier in cookies and HTTP header
2344fa9
to
a064c77
Compare
akosyakov
reviewed
Apr 22, 2021
akosyakov
approved these changes
Apr 22, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This was referenced May 10, 2021
Closed
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Disclaimer
This PR adds the first spike towards a local Gitpod companion app. In this iteration the app can:
~/.ssh/id_rsa.pub
to the workspace's~/.ssh/authorized_keys
to facilitate SSH authenticationssh
and VS Code that maps workspace IDs to portsBelow is a quick demo of those features:
To make all of this happen, this PR
localhost:<free-port>
, opens a browser to$GITPOD_HOST/api/auth/local-app?returnTo=localhost:<free-port>
. Gitpod, if the user is logged in, redirects to thereturnTo
URL passing an OTS URL from which the local app downloads a narrowly scoped Gitpod machine token. Passing the OTS prevents the token from ending up in the browser history or logs. We really should replace this with OAuth2 PKCE.x-gitpod-owner-token
header will be properly authenticated as if that header's value came from the owner cookie.chmod("/dev/pts")
calls as they are commonly made by SSH servers (like OpenSSH or dropbear). Those calls fail in a Gitpod workspace because/dev/ptmx
and subsequent/dev/pts/
devices are bind mounts to the Kubernetes container where the "root" user inside a workspace has no privileges. Turns out that the ssh servers work just fine even if we degrade this particularchmod
call to a noop.23001
. This way supervisor runs on22999
, the IDE on23000
and SSH on23001
. We also produce a host key for each workspace usingdropbearkey
prior to starting the SSH server. I considered making use ofSO_REUSEPORT
(which dropbear supports) to multiplex the SSH server into22999
but don't think the complexity is worth it.echo $PUBLIC_KEY >> ~/.ssh/authorized_keys
, and closes the terminal again.How to test
client: supervisor: Connected
andclient: ssh: Connected
ssh -F /tmp/gitpod_ssh_config <your-workspace-id>
/tmp/gitpod_ssh_config
you can connect to your workspace using the Remote SSH extension:Immediate Next Steps
figure out why themake dropbear pass on the env vars to the children it spawns$PATH
is broken (Go and Python are missing)