daytonaio / daytona

The Open Source Dev Environment Manager.
https://daytona.io
Apache License 2.0
12.42k stars 866 forks source link

X11 forward option in daytona ssh #1206

Open divanshu-go opened 1 month ago

divanshu-go commented 1 month ago

Add support for X11 forwarding via a flag in the daytona ssh command (e.g., -X or -Y)**

Description: Daytona CLI currently does not support X11 forwarding for SSH connections, making it difficult to run GUI applications remotely.

For reference, a useful guide on enabling X11 forwarding is available here. It outlines configurations for both Linux and MacOS, and there's also a guide for Windows.

Solution: Users should be able to pass a flag to daytona ssh to enable X11 forwarding, or receive steps on how to configure it manually.

Note: the current ssh server implementation lacks support for X11 requests.

https://github.com/daytonaio/daytona/tree/main/pkg/agent/ssh

Tpuljak commented 1 month ago

@bryans-go thanks for opening this issue. Everything in the description makes sense.

One thing we should avoid is bundling multiple issues into one. More specifically,

Notes the current daytona ssh command does allow arguments(dtn ssh ) to it but those arguments are only executed to the remote machine and it doesn't support flags like the ssh do for eg. ssh -flag remote@ does The user given -flag should be used like the ssh -flag remote@host or dtn ssh -flags -otherflag -thirdflag dtn ssh should support all the ssh flags

This can be its own issue.

also the dtn ssh -edit should allow the users to edit the ssh_config of specific ProjectHostname

And this can be its own issue.

Please split those up so it's easier to track and discuss.

divanshu-go commented 1 month ago

@bryans-go thanks for opening this issue. Everything in the description makes sense.

One thing we should avoid is bundling multiple issues into one. More specifically,

Notes the current daytona ssh command does allow arguments(dtn ssh ) to it but those arguments are only executed to the remote machine and it doesn't support flags like the ssh do for eg. ssh -flag remote@ does The user given -flag should be used like the ssh -flag remote@host or dtn ssh -flags -otherflag -thirdflag dtn ssh should support all the ssh flags

This can be its own issue.

also the dtn ssh -edit should allow the users to edit the ssh_config of specific ProjectHostname

And this can be its own issue.

Please split those up so it's easier to track and discuss.

Done

quest-bot[bot] commented 1 month ago

New Quest! image New Quest!

A new Quest has been launched in @daytonaio’s repo. Merge a PR that solves this issue to loot the Quest and earn your reward.


Loot of 20 USD has been stashed in this issue to reward the solver!

🗡 Comment @quest-bot embark to check-in for this Quest and start solving the issue. Other solvers will be notified!

⚔️ When you submit a PR, comment @quest-bot loot #1206 to link your PR to this Quest.

Questions? Check out the docs.

divanshu-go commented 1 month ago

@quest-bot embark on to it !

RS-labhub commented 1 month ago

Hi @Tpuljak , do I need to make it compatible for macOS, linux, and Windows? I would like to work on this.. But I guess it's open for all, right??

If not assign me this 🙂

@quest-bot embark

Tpuljak commented 1 month ago

@RS-labhub no need to get assigned. You're free to work on it of course.

Hi @Tpuljak , do I need to make it compatible for macOS, linux, and Windows? I would like to work on this.. But I guess it's open for all, right??

That's correct.

RS-labhub commented 1 month ago

starting to work on it!

RS-labhub commented 1 month ago

Oh wait.. someone is already working on it... Sorry @bryans-go, I didn't know about it.. Just going to the threads now and saw it. Nevermind, but are you still working on it?

Loll, I don't know how to cancel my attempt!

RohanMishra315 commented 1 month ago

Hey @Tpuljak the changes should be made in the daytona/pkg/ssh file right ? whatever new commits need to be done.

Tpuljak commented 1 month ago

Hey @Tpuljak the changes should be made in the daytona/pkg/ssh file right ? whatever new commits need to be done.

I don't think so. I think a new option needs to be added to the ssh config that we add (https://github.com/daytonaio/daytona/blob/main/cmd/daytona/config/ssh_file.go). I'm not completely sure so you'll need to test this out yourself.

Abiji-2020 commented 1 month ago

@bryans-go any further update on this? If not let me start working on it?

divanshu-go commented 1 month ago

@Abiji-2020 feel free to open a PR. I'm still working on it but couldn't find a solution for it. I'm not assigned to the issue means you can even raise a PR without asking from me.

Abiji-2020 commented 1 month ago

Add support for X11 forwarding via a flag in the daytona ssh command (e.g., -X or -Y)**

Description: Daytona CLI currently does not support X11 forwarding for SSH connections, making it difficult to run GUI applications remotely.

For reference, a useful guide on enabling X11 forwarding is available here. It outlines configurations for both Linux and MacOS, and there's also a guide for Windows.

Solution: Users should be able to pass a flag to daytona ssh to enable X11 forwarding, or receive steps on how to configure it manually.

In this we need to implement the client or server i.e we need to run a remote GUI app in the daytona or we need to forward the daytona server to be connected from external server??

vedranjukic commented 1 month ago

@Abiji-2020, what would be the use case for connecting the daytona server from an external server?

Tpuljak commented 1 month ago

@bryans-go can correct me if I'm wrong, but I believe the use case for X11 forwarding would be that users can run GUI application inside a Daytona project and them being able to view the app when connected via SSH.

divanshu-go commented 1 month ago

@Tpuljak Exactly ! Thanks for this because a lot of users are not aware about this functionality of ssh. and thats why I am referencing https://www.baeldung.com/linux/forward-x-over-ssh .

divanshu-go commented 1 month ago

Note: the current ssh server implementation lacks support for X11 requests. https://github.com/daytonaio/daytona/tree/main/pkg/agent/ssh

Tpuljak commented 1 month ago

Note: the current ssh server implementation lacks support for X11 requests. https://github.com/daytonaio/daytona/tree/main/pkg/agent/ssh

@bryans-go are you saying that the lib that we use for SSH does not have support for X11 or is it simply lacking from our implementation?

divanshu-go commented 1 month ago

I meant that the lib (gliders/ssh) doesn't have direct support or inbuilt support for x11, we can do a workaround using crypto ssh (gossh) to implement x11 request handler in our ssh server implentation you can visit here https://pkg.go.dev/github.com/juser0719/teleport/lib/sshutils/x11 for more related functions to it

Tpuljak commented 1 month ago

I meant that the lib (gliders/ssh) doesn't have direct support or inbuilt support for x11, we can do a workaround using crypto ssh (gossh) to implement x11 request handler in our ssh server implentation you can visit here https://pkg.go.dev/github.com/juser0719/teleport/lib/sshutils/x11 for more related functions to it

If there's a way to "inject" that functionality without completely rewriting the SSH server, then I don't see why not.