Skip to content

SSH connection fails if workspace image does not contain "/home/gitpod" directory and "gitpod" user #12143

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

Closed
Acepie opened this issue Aug 15, 2022 · 3 comments · Fixed by #12498

Comments

@Acepie
Copy link

Acepie commented Aug 15, 2022

Bug description

We very recently ran into a weird issue when trying the new direct ssh connection with public/private keys. The behavior is that when trying to connect to the workspace (either directly via ssh command or via the vscode desktop integration) it "appears" to succeed authentication but immediately gets a closed by remote host error. After looking in the logs of the workspace pod itself, it turned out that the authentication was attempting to get the /home/gitpod/authorized_keys file despite the fact that the base image for this workspace did not actually include that file/user yet (we needed a tool that is only available internal and were using its build image). I think previously when starting a workspace, if that user/dir did not exist than it was being autocreated but it seems like that autocreation process happens after the ssh auth check?

Steps to reproduce

  1. Create a workspace using an image that is not natively setup for gitpod (some basic ubuntu image for example)
  2. Add valid ssh public keys to user config if not already done
  3. Attempt to use the ssh connection command to ssh
  4. Get connection closed by remote host error

Workspace affected

No response

Expected behavior

SSH connection should succeed assuming the public/private key setup is valid

Example repository

No response

Anything else?

No response

@Acepie Acepie added the type: bug Something isn't working label Aug 15, 2022
@Acepie Acepie changed the title SSH connection fails if workspace image does not contain "/home/gitpod" directory/user SSH connection fails if workspace image does not contain "/home/gitpod" directory and "gitpod" user Aug 15, 2022
@axonasif
Copy link
Member

axonasif commented Aug 16, 2022

Hi @Acepie, thanks for reporting this issue 👍
I'm not sure if you've tried, as a temporary workaround you could try to symlink your custom home dir to /home/gitpod until this issue is fixed.

@Acepie
Copy link
Author

Acepie commented Aug 16, 2022

I ultimately worked around the issue by making a new multi stage dockerfile starting from a full workspace and just copied the relevant binaries from our old image into the final image. That resolved my issues

@akosyakov
Copy link
Member

akosyakov commented Aug 16, 2022

@iQQBot is it because we don't check for content readiness while trying to establish ssh connection from ssh gateway to workspace?

I don't think one cannot have /home/gitpod and gitpod user. The supervisor has these assumptions built in all over the place?

@iQQBot iQQBot moved this to In Progress in 🚀 IDE Team Aug 30, 2022
@iQQBot iQQBot self-assigned this Aug 30, 2022
Repository owner moved this from In Progress to Done in 🚀 IDE Team Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants