ArcticaProject / nx-libs

nx-libs
Other
119 stars 39 forks source link

nxagent: Filter ACPI events #1059

Open Yetoo1 opened 1 year ago

Yetoo1 commented 1 year ago

I previously reported this issue downstream at x2goserver here https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=1600 but I am reporting it here because I believe it ultimately has to do with upstream nxagent. I would have tried building nx-libs and reporting if reproducing with an nxagent/nxproxy combo, but I can't seem to find examples to run nxagent/nxproxy and use the existing x server session to shadow so I am hopeful someone can provide a command line to help me reproduce the issue with latest upstream. The original bug report:

Package: x2goserver Version: 4.1.0.3-5 Severity: Critical

I have x2goclient installed on local Fedora 37 machine and x2goserver/x2godesktopsharing installed on remote Debian 11 and (different) Fedora 37 machines. On the Fedora 37 local machine I connected to the Fedora 37 remote machine in X2go/X11 Desktop Sharing mode with fullscreen and press the power button on the local machine. This causes the Fedora 37 remote machine to respond to the shutdown command as configured and, in this instance, shutdown. I tested with a Debian 11 remote machine with x2goserver/x2godesktopsharing installed on it and it too responded to the shutdown acpi command. Both remote machines have xfce4 desktop installed.

I expect the server to at least discard ACPI events and not depend on a client to not send ACPI events. For thin client users expecting the machine to be separate from the software in the remote connection this increases chance of unintentional user error messing up data or even malicious abuse.

Client packages: x2goclient 4.1.2.2-7.f37 Package nx-libs 3.5.99.26-5.fc37 Package nxproxy 3.5.99.26-5.fc37

Debian 11 remote/Server packages: x2goserver 4.1.0.3-5

Fedora 37 remote/Server packages: x2goserver-4.1.0.3-19.fc37

uli42 commented 3 months ago

All these events are handled outside nxagent, in the desktpp environment you are using. nxagent does not even know what ACPI is.

And as you are shadowing a session running on the server how should the session know it should not perform the shutdown if the user requests it? Fromt he server's perspective it is just a local desktop session.

Nevertheless there's nothing nxagent can do about it.

Yetoo1 commented 2 months ago

While events are handled by the desktop environment I was under the impression that in a shadow session raw input was passed to the server and not desktop events and then the server passes the raw input to the desktop environment. If this was the case then from this angle the acpi input could be filtered.

On Mon, Apr 8, 2024, 6:04 AM Ulrich Sibiller @.***> wrote:

All these events are handled outside nxagent, in the desktpp environment you are using. nxagent does not even know what ACPI is.

And as you are shadowing a session running on the server how should the session know it should not perform the shutdown if the user requests it? Fromt he server's perspective it is just a local desktop session.

Nevertheless there's nothing nxagent can do about it.

— Reply to this email directly, view it on GitHub https://github.com/ArcticaProject/nx-libs/issues/1059#issuecomment-2042708836, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6UF4EF6HZ3FF3IRH3G5NLY4KIXHAVCNFSM6AAAAAAYVKWWTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBSG4YDQOBTGY . You are receiving this because you authored the thread.Message ID: @.***>

uli42 commented 2 months ago

No,

x2goagent/nxagent in shadow mode attaches to the running X server and grabs damage events and generates input events based on the events it receives from the x2go client. That's basically all. The communication between client (nxproxy) and server (nxagent) is based to Xlib messages.

No ACPI involved.

Uli

On Fri, Apr 19, 2024 at 8:05 PM Yetoo1 @.***> wrote:

While events are handled by the desktop environment I was under the impression that in a shadow session raw input was passed to the server and not desktop events and then the server passes the raw input to the desktop environment. If this was the case then from this angle the acpi input could be filtered.

On Mon, Apr 8, 2024, 6:04 AM Ulrich Sibiller @.***> wrote:

All these events are handled outside nxagent, in the desktpp environment you are using. nxagent does not even know what ACPI is.

And as you are shadowing a session running on the server how should the session know it should not perform the shutdown if the user requests it? Fromt he server's perspective it is just a local desktop session.

Nevertheless there's nothing nxagent can do about it.

— Reply to this email directly, view it on GitHub < https://github.com/ArcticaProject/nx-libs/issues/1059#issuecomment-2042708836>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AC6UF4EF6HZ3FF3IRH3G5NLY4KIXHAVCNFSM6AAAAAAYVKWWTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBSG4YDQOBTGY>

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ArcticaProject/nx-libs/issues/1059#issuecomment-2067056634, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQHBZC3PEDG2BAVVHGUQ2LY6FMFXAVCNFSM6AAAAAAYVKWWTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRXGA2TMNRTGQ . You are receiving this because you commented.Message ID: @.***>

Yetoo1 commented 2 months ago

@uli42 So when I have x2goclient focused on the client machine and I press power button what message is being passed to the server for the server to think that the power button is pressed? I don't have a test environment to run xtrace at the moment.

uli42 commented 2 months ago

I don't know what power button you mean. The physical one on your client machine? In that case your client OS will do whatever it will do. Suspending, shutting down, killing applications? If x2go client shuts down it signals the x2go server to suspend the session. Or the server suspends by itself when not hearing from the client for some time.

If you select some kind of power button within the session and it is a shadowed session showing the actual desktop on the server it might happen that the server shuts down, just as it would if you clicked ut while sitting in front of the machine.

Once again: nx does not know anything about ACPI.

Uli

Yetoo1 @.***> schrieb am Mo., 22. Apr. 2024, 03:10:

@uli42 https://github.com/uli42 So when I have x2goclient focused on the client machine and I press power button what message is being passed to the server for the server to think that the power button is pressed? I don't have a test environment to see at the moment.

— Reply to this email directly, view it on GitHub https://github.com/ArcticaProject/nx-libs/issues/1059#issuecomment-2068310366, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQHBZAZ6KRU4K7ZK4CNGA3Y6RPR7AVCNFSM6AAAAAAYVKWWTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRYGMYTAMZWGY . You are receiving this because you were mentioned.Message ID: @.***>

Yetoo1 commented 2 months ago

Yes, the physical button on the client machine. As I have said in the bug report, "suspending, shutting down, killing applications" is not what the client os is doing when the physical button is pressed. It is instead the server os that is doing those actions when I hit the physical power button on the client when x2goclient is the focused window.

Yes, nx does not know about acpi, but if x server is detecting the power button as a keypress of some kind so can't it be filtered at least as an option?

On Mon, Apr 22, 2024, 3:34 AM Ulrich Sibiller @.***> wrote:

I don't know what power button you mean. The physical one on your client machine? In that case your client OS will do whatever it will do. Suspending, shutting down, killing applications? If x2go client shuts down it signals the x2go server to suspend the session. Or the server suspends by itself when not hearing from the client for some time.

If you select some kind of power button within the session and it is a shadowed session showing the actual desktop on the server it might happen that the server shuts down, just as it would if you clicked ut while sitting in front of the machine.

Once again: nx does not know anything about ACPI.

Uli

Yetoo1 @.***> schrieb am Mo., 22. Apr. 2024, 03:10:

@uli42 https://github.com/uli42 So when I have x2goclient focused on the client machine and I press power button what message is being passed to the server for the server to think that the power button is pressed? I don't have a test environment to see at the moment.

— Reply to this email directly, view it on GitHub < https://github.com/ArcticaProject/nx-libs/issues/1059#issuecomment-2068310366>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABQHBZAZ6KRU4K7ZK4CNGA3Y6RPR7AVCNFSM6AAAAAAYVKWWTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRYGMYTAMZWGY>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ArcticaProject/nx-libs/issues/1059#issuecomment-2069052005, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6UF4AUIIUTM375SZ5XWZLY6TRVFAVCNFSM6AAAAAAYVKWWTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZGA2TEMBQGU . You are receiving this because you authored the thread.Message ID: @.***>

uli42 commented 2 months ago

Hmm,

can you try and run xev in the session and check if there is a matching keypress event when pressing the power button?

Uli

Yetoo1 @.***> schrieb am Di., 23. Apr. 2024, 15:59:

Yes, the physical button on the client machine. As I have said in the bug report, "suspending, shutting down, killing applications" is not what the client os is doing when the physical button is pressed. It is instead the server os that is doing those actions when I hit the physical power button on the client when x2goclient is the focused window.

Yes, nx does not know about acpi, but if x server is detecting the power button as a keypress of some kind so can't it be filtered at least as an option?

On Mon, Apr 22, 2024, 3:34 AM Ulrich Sibiller @.***> wrote:

I don't know what power button you mean. The physical one on your client machine? In that case your client OS will do whatever it will do. Suspending, shutting down, killing applications? If x2go client shuts down it signals the x2go server to suspend the session. Or the server suspends by itself when not hearing from the client for some time.

If you select some kind of power button within the session and it is a shadowed session showing the actual desktop on the server it might happen that the server shuts down, just as it would if you clicked ut while sitting in front of the machine.

Once again: nx does not know anything about ACPI.

Uli

Yetoo1 @.***> schrieb am Mo., 22. Apr. 2024, 03:10:

@uli42 https://github.com/uli42 So when I have x2goclient focused on the client machine and I press power button what message is being passed to the server for the server to think that the power button is pressed? I don't have a test environment to see at the moment.

— Reply to this email directly, view it on GitHub <

https://github.com/ArcticaProject/nx-libs/issues/1059#issuecomment-2068310366>,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ABQHBZAZ6KRU4K7ZK4CNGA3Y6RPR7AVCNFSM6AAAAAAYVKWWTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRYGMYTAMZWGY>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub < https://github.com/ArcticaProject/nx-libs/issues/1059#issuecomment-2069052005>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AC6UF4AUIIUTM375SZ5XWZLY6TRVFAVCNFSM6AAAAAAYVKWWTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZGA2TEMBQGU>

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ArcticaProject/nx-libs/issues/1059#issuecomment-2072394138, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQHBZGTNE7AQXCQOOC53ELY6ZSLDAVCNFSM6AAAAAAYVKWWTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZSGM4TIMJTHA . You are receiving this because you were mentioned.Message ID: @.***>