Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
4.24k stars 568 forks source link

Wayland Capturing #2719

Open routerino opened 3 years ago

routerino commented 3 years ago

So the current status is that wayland is a nonstarter in meshcentral due to its restrictions on traditianal frame capture.

I thought it would be worth putting out that OBS has added support for wayland, and their efforts may be applicable to meshcentral.

If there's an option to reuse code for real time capture, then great. I don't think wayland is disappearing any time soon.

Ylianst commented 3 years ago

Good observation. Bryan needs to look into this.

bt90 commented 2 years ago

Teamviewer does also provide experimental Wayland support now implemented via xdg-desktop-portal:

https://community.teamviewer.com/English/discussion/122410/

veitw commented 2 years ago

The wayvnc VNC server for Wayland also exists and should have a much less complex code base than OBS to figure out the workings:

https://github.com/any1/wayvnc

Mannshoch commented 1 year ago

Gnome support RDP on Wayland out of the box. https://wiki.gnome.org/Projects/Mutter/RemoteDesktop

bt90 commented 1 year ago

Would it be possible to use xdg-desktop-portal? This is what Rustdesk is using:

https://github.com/rustdesk/rustdesk/pull/932

DaanSelen commented 9 months ago

What is the status on Wayland support?

hobbes commented 9 months ago

@DaanSelen wayland support has to do with the agent more than with MC itself, so the issue is tracked here: https://github.com/Ylianst/MeshAgent/issues/115

But not much has happened I'm afraid...

si458 commented 8 months ago

closing as duplicate of Ylianst/MeshAgent#115, so please follow there for update

hobbes commented 8 months ago

the right duplicate issue is https://github.com/Ylianst/MeshAgent/issues/115 :-)

si458 commented 8 months ago

sorry reopening, so it reminds users about the issue and they can link to the meshagent repo for code etc

si458 commented 8 months ago

workaround for users for future, will update docs - https://github.com/Ylianst/MeshCentral/issues/2998#issuecomment-894554156

  1. Open /etc/gdm/custom.conf or /etc/gdm3/custom.conf
  2. Uncomment: WaylandEnable=false.
  3. Add the following line to the [daemon] section: DefaultSession=gnome-xorg.desktop
  4. restart machine
marclaporte commented 3 months ago

@lsowen, @timwhite, @nosklo, @flifloo, @artemklevtsov, @laramy2020, @fcayre, @zroug, @LambArchie, @Mannshoch, @Attacktive, @bt90, @weitw, @DaanSelen, @hobbes

We'd love to add this but it's a lot of work. So we are looking for a developer to contribute or a financial sponsor. Any ideas?

You can reach out in private to me and/or @si458 to discuss.

Thanks!

Saik0Shinigami commented 2 months ago

@marclaporte @si458 what kind of financial sponsorship are we talking here? My hands are quite full on my own projects (and I was never a C++ dev). However, I could throw some (small company) money into it. I love Mesh... I hate that I can't use it on half my systems now for GUI access. This issue has been outstanding long enough that I'd like to see it squashed.

marclaporte commented 2 months ago

@Saik0Shinigami We don't know the precise amount because we can't ask someone to evaluate until/unless we have a realistic way to fund it. But for sure, it is a lot of money for a small company, so ideally we have a bunch of people and organizations that co-sponsor.

Also, we can apply for a grant from organizations like NLnet: https://nlnet.nl/news/2024/20240601-call.html

We need a volunteer to craft the grant request and coordinate the project.

hobbes commented 2 months ago

@Saik0Shinigami We don't know the precise amount because we can't ask someone to evaluate until/unless we have a realistic way to fund it.

I think it's the other way round: there are many ways to fund that kind of development (you cited two, there are probably more), but there's no way to chose, devise a strategy, or draft a grant request if we don't at least have a rough idea of how much it represents.

Now if I understand the problem correctly, there is no way with wayland to just capture the screen and/or control the inputs like the agent does with X. So adding wayland support would mean significant modifications to the architecture of the agent, like adding new behaviours (for example, asking explicit consent from the user, interacting with portals,...) in addition to the pure wayland support.

That's what needs investigating first, if possible by someone familiar with the wayland ecosystem: how would a remote support solution present itself to the users of both sides of the solution (support staff on one side, and machine users on the other side) with the wayland stack. What is possible (is unattended remote control even possible?), how, and with what tools.

Then, with that information, someone familiar with the MC stack can evaluate what needs to be done agentside to implement it.

Both of these can be financed via sponsoship, but we need an estimate...

marclaporte commented 2 months ago

there's no way to chose, devise a strategy, or draft a grant request if we don't at least have a rough idea of how much it represents.

You make a good point. Perhaps someone could even write up a grant request for the evaluation project itself. Like a technical project appraisal: https://en.wikipedia.org/wiki/Project_appraisal

So we need a volunteer to take the lead here.

hobbes commented 2 months ago

sorry for the delay, I fell ill in the meantime :-)

ok I don't think that it's possible do draft a grand request or anything since we don't know who could do it, how long it would take, or anything. We first need to beat it up a bit.

The first thing to know is what is possible with wayland.

capturing is possible: firefox does it for desktop sharing in remote meeting solutions like jitsi, gnome does it for screen recording, obs studio does it,... but for all these, the user needs to allow the app to do it.

I think that all these use the xdg-desktop-portal infrastructure. After reading a bit in the doc, probably what would be used by meshcentral is https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.RemoteDesktop.html

Now I think that these require the user to give permission, so that wouldn't be possible for the current agent behaviour, but ok for something like the meshcentral assistant.

For agent behaviour, now is the time to hunt for wayland people :-)

If anyone here knows someone who might be familiar with the wayland ecosystem, can you ask them to come here, or ask theme those questions:

I don't know anyone familiar with wayland, but I'll ask on the fediverse. Don't hesitate to ring your social networks :-)

nekohayo commented 2 months ago
  • is it possible with wayland to capture the whole screen as soon as the display manager (gdm, lightdm,...) is there
  • if not, are there existing remote support/management solutions working with wayland that we could analyse ?

It will be / is becoming possible with GNOME 46.x-47.x. and newer.

From an architectural standpoint, GNOME is finally doing remote desktop "properly" (i.e. fairly safely and efficiently) now, thanks to Wayland and the huge amount of work that the GNOME Remote Desktop (and coincidentally GNOME Shell, Mutter, GDM, GStreamer, etc.) developers have been doing. It's all based on RDP for performance (you can't say "VNC" and "fast" in the same sentence and look at me with a straight face :)

You can get see the big picture by looking at this collection of interlocking implementation parts, with their related tickets and merge requests:

See also the Red Hat Desktop Team lead's blog posts for additional historical context (Ctrl+F for "remote" in those blog posts):

hobbes commented 2 months ago
  • is it possible with wayland to capture the whole screen as soon as the display manager (gdm, lightdm,...) is there
  • if not, are there existing remote support/management solutions working with wayland that we could analyse ?

It will be / is becoming possible with GNOME 46.x-47.x. and newer.

wow, thanks a lot for that detailed answer :-)

...

You can get see the big picture by looking at this collection of interlocking implementation parts, with their related tickets and merge requests:

* Basic RDP-based remote desktop for "already running and unlocked" sessions (i.e. the "tech support" scenario): already implemented a long time ago, somewhere in 2022 I think. Don't remember which ticket it was.

Ok, I see that now in my control center, I can activate remote desktop for my running unlocked session

* [Graphical remote login through GDM](https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/issues/92) (gnome-remote-desktop meta issue 92)

* [Support headless sessions](https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/issues/90) (gnome-remote-desktop meta issue 90)

* [Support hybrid headless/headfull sessions](https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/issues/91) (gnome-remote-desktop meta issue 91)

and these too, I can now enable remote graphical login. However, if I understand correctly, this only enables the creation of a remote session which would be invisible to a user on the physical machine. A bit like it works on windows for rdp.

That's already a big part of what is needed, maybe it's enough to start ?

Actually, if that's rdp based, it might already work with current agents... but my mc server is not in the same network as my machines, so rdp does not work for me, so I can't test.

@marclaporte , @si458 : would it be conceivable to implement something like rdp (or just tcp port) forwarding between the agent and the mc server when the agent is not directly reachable by the server ? Because if yes, problem largely solved for gnome and any desktop that implements remote desktop :-)

And bonus: that would give rdp possibility also on other platforms when the managed machines are not directly reachable by the mc server (like behind nat).

Fuseteam commented 2 months ago

there is now also a screen capture wayland protocol fwiw https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/124

as for wayland people, these people might be who might be able to help you devise a cross desktop solution: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/project_members

marclaporte commented 2 weeks ago

Also discussed here: https://www.reddit.com/r/MeshCentral/comments/1bgjyna/wayland_blues_what_are_people_doing_now/