mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-15 14:16:02 -06:00
[GH-ISSUE #239] Detect if being run on an SSH X-forwarded display and refuse to start if so #195
Labels
No labels
HiDPI
bounty
bsd/freebsd
bsd/openbsd
bug
bug
build-infra
cantfix
critical
doc
duplicate
enhancement
fix-available
from git
from release
good first issue
help wanted
installer/package
invalid
linux
macOS
meta
needs testing
pull-request
query
question
regression
regression
v2.4.0
windows
wontfix
work-in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/barrier#195
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @brianjmurrell on GitHub (Jan 24, 2019).
Original GitHub issue: https://github.com/debauchee/barrier/issues/239
barrier[cs]should detect if it's being run on an X11 forwarded display and not start, or at least give the user a big warning, if it's found.How could this be determined? Heuristically is one way. Is DISPLAY # >= 10? Is resolution of server and client the same? Are other SSH environment variables set?
Or one could look for a more unique property of an X display and see if they are == on both client and server. One could set an X property on the server and see if it's set on the client.
There are probably other ways.
@jwestfall69 commented on GitHub (Jan 25, 2019):
I think just checking if the DISPLAY variable contains a non-empty hostname should be enough to tell you if its remote. Talking to the local X would have an empty hostname which causes clients to use to /tmp/.X11-unix/X0 unix domain socket.
@brianjmurrell commented on GitHub (Jan 25, 2019):
I don't think that is foolproof.
localhost:0.0is a perfectly validDISPLAYvalue for a local X server.But maybe the percentage of cases where that's used times the percentage of cases where somebody runs Barrier on such a remote display is so infinitesimally small that it's not worth worrying about.
@p12tic commented on GitHub (Jan 25, 2019):
I think it's important to correctly handle all cases. Having said that, the impact of a missed case won't be large if we give only a warning and not refuse to start outright.
@jwestfall69 commented on GitHub (Jan 25, 2019):
Curious if you actually tried this? Putting the hostname will cause the client to attempt to connect to the X server via tcp instead of the unix domain socket. Most (all?) distros don't have their X listening on tcp.
I also think the most that should be done is to log a warning.
@brianjmurrell commented on GitHub (Jan 25, 2019):
Yes, understood that most distros don't have X11 listening on TCP but that doesn't mean a user could not change that if they had a need. Before SSH and X11-forwarding (yes, I am that old), listening on TCP was the only way to get remote X11 clients on to your display.
There may be current-day use cases still that we are just not aware of.
But I agree that the odds are getting pretty low -- maybe too low to be worth supporting.
But it's still a good idea to recognise all of the use-cases and variables from the outset and then decide which valid and which are not.
@ts-toh commented on GitHub (Jan 31, 2019):
I hope that there will be a way to override this feature if a user truly wants to. There are valid but intuitive use cases. For example, for awhile, I made a second monitor out of an old tablet running a vnc client over tcp/ip over usb to a new x11 instance on my desktop, and used synergy to control it. What if instead of using vnc, I wanted to tunnel an x11 session? It is frankly easier to do x11 over an ssh tunnel than a bare x11 session these days.
@p12tic commented on GitHub (Jan 31, 2019):
@brianjmurrell What was your original pain that resulted in opening this issue?
@brianjmurrell commented on GitHub (Jan 31, 2019):
@p12tic
sshing from the Barrier server machine to the client machine and then just runningbarriercwithout first fixingDISPLAYto point at the remote machine's Xserver instead of the Barrier server's Xserver forwarded over the SSH connection.@p12tic commented on GitHub (Jan 31, 2019):
Indeed a warning would be really useful in such case.