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

Make it possible to connect to a container via SSH #22756

Closed
vitaliy-guliy opened this issue Jan 10, 2024 · 2 comments
Closed

Make it possible to connect to a container via SSH #22756

vitaliy-guliy opened this issue Jan 10, 2024 · 2 comments
Assignees
Labels
area/udi Issues and PRs related to the universal developer image https://github.com/devfile/developer-images kind/task Internal things, technical debt, and to-do tasks to be performed. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. severity/P1 Has a major impact to usage or development of the system.

Comments

@vitaliy-guliy
Copy link
Contributor

vitaliy-guliy commented Jan 10, 2024

Is your task related to a problem? Please describe

It is a part of VS Code desktop flow, but it is better to decouple as a separate feature.

In general, as a user I want to open a terminal on my laptop and connect to a container in a running workspace via SSH.

Describe the solution you'd like

For that we need

  • add ssh service ( openssh-server ) to universal developer image
  • configure sshd to be able to run in rootless mode
  • expose TCP port 21 (or 2121) to allow external connections
@vitaliy-guliy vitaliy-guliy added kind/task Internal things, technical debt, and to-do tasks to be performed. severity/P1 Has a major impact to usage or development of the system. area/udi Issues and PRs related to the universal developer image https://github.com/devfile/developer-images labels Jan 10, 2024
@RomanNikitenko RomanNikitenko moved this to 📅 Planned for this Sprint in Eclipse Che Team B Backlog Jan 10, 2024
@vitaliy-guliy vitaliy-guliy moved this from 📅 Planned for this Sprint to 🚧 In Progress in Eclipse Che Team B Backlog Jan 15, 2024
@vitaliy-guliy
Copy link
Contributor Author

vitaliy-guliy commented Feb 13, 2024

At the moment we have some issues when trying to use and configure SSH server inside a container.
I tried to use Open SSH and the alternative Dropbear.

The current state of the attempts to configure both services is in the draft pull request che-incubator/che-code#327

The main problem that I see at the moment that is user in the container is not properly configured (seems not properly configured). Open SSH require PAM to be properly configured. But all the changes made in developer container were overwritten by the kubernetes when workspace startup.

Alternative Dropear service is not very talkative and do not explain in the details the reason of failure.
It says only, that user user is wrong

Login attempt with wrong user user from 127.0.0.1:34192

Third option I have tried is to build the image based on ubuntu.

FROM ubuntu:16.04
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
# Set root password for SSH access (change 'your_password' to your desired password)
RUN echo 'root:your_password' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]

It is possible to test how does it work, but locally, not in the container

  • Download and launch the service
docker pull quay.io/vgulyy/ssh-ubuntu:test
docker run --name ssh-ubuntu quay.io/vgulyy/ssh-ubuntu:test
  • Take the IP address
sudo docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ssh-ubuntu
  • Connect to the service

But it does not work if create a container with this image, because of configuration files are overwritten.

@vitaliy-guliy vitaliy-guliy moved this from 🚧 In Progress to 📅 Planned for this Sprint in Eclipse Che Team B Backlog Feb 19, 2024
@ibuziuk ibuziuk moved this from 📅 Planned for this Sprint to 📋 Backlog (not in current Sprint) in Eclipse Che Team B Backlog Feb 21, 2024
@che-bot
Copy link
Contributor

che-bot commented Nov 21, 2024

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

@che-bot che-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 21, 2024
@che-bot che-bot closed this as completed Nov 28, 2024
@vitaliy-guliy vitaliy-guliy reopened this Dec 19, 2024
@che-bot che-bot closed this as completed Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/udi Issues and PRs related to the universal developer image https://github.com/devfile/developer-images kind/task Internal things, technical debt, and to-do tasks to be performed. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

2 participants