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

multiple bind options for local sockets #963

Closed
totaam opened this issue Aug 24, 2015 · 15 comments
Closed

multiple bind options for local sockets #963

totaam opened this issue Aug 24, 2015 · 15 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Aug 24, 2015

Issue migrated from trac ticket # 963

component: android | priority: critical | resolution: fixed

2015-08-24 13:00:21: antoine created the issue


Follow up from #888.

Add a --bind= option, similar to the --bind-tcp option but for unix domain sockets, and eventually named pipes for win32(#389). This would ease the transition to /run: we can just create sockets in both locations by default.

It may also help with containers if we support both a directory form (--bind=dir:$HOME/.xpra) and an absolute path (--bind=socket:/path/to/thesocket.

And maybe this could help with selinux (#815) because we can then pick the socket in its more "proper" location.

@totaam
Copy link
Collaborator Author

totaam commented Dec 26, 2015

2015-12-26 17:39:04: antoine changed owner from antoine to jonathan.underwood

@totaam
Copy link
Collaborator Author

totaam commented Dec 26, 2015

2015-12-26 17:39:04: antoine commented


r11485 implements this for unix domain sockets. r11486 adds $UID and $GID path extension (as used for socket-dirs already).

Example:

xpra start \
    --bind=/tmp/
    --bind=/run/user/$UID/xpra/
    --bind=/home/antoine/tmp/tmp/mysocket

Will create:

  • the usual socket (the filename of the socket will be generated from the hostname) in the 2 directories specified: /tmp and /run/user/$UID/xpra/
  • a socket named /home/antoine/tmp/tmp/mysocket

I could have used a more explicit differentiator between socket directories (identified by a trailing slash or if the directory exists already) and explicit filenames ("mysocket"), but I couldn't come up with anything that wasn't ugly.

Note: the sockets created will only be found by clients if they are in one of the directories specified with the socket-dirs option. For backwards compatibility with older clients / servers, you should keep ~/.xpra/ in that list.
Sockets specified using the full filename will not be found, even if they are in a socket-dir that is searched by clients, unless the actual socket filename matches the hostname. (like the automatically generated ones)

@jonathan.underwood: if all your other clients and servers are 0.17 or later, you can now safely change the default socket location to be /var/run/user/$UID/xpra and things should just work.

@totaam
Copy link
Collaborator Author

totaam commented Dec 29, 2015

2015-12-29 10:07:29: antoine commented


See also #1066.

@totaam
Copy link
Collaborator Author

totaam commented Jan 22, 2016

2016-01-22 20:54:58: antoine commented


Fix for "upgrade" server exit in r11722, ideally we should keep track of which server owns which sockets to make we cleanup all the ones that we should cleanup.

@totaam
Copy link
Collaborator Author

totaam commented Jan 22, 2016

2016-01-22 21:18:54: antoine uploaded file cleanup-real-socket-path.patch (3.0 KiB)

attempt at figuring out the real socket path from the socket file descriptor - does not work..

@totaam
Copy link
Collaborator Author

totaam commented Feb 19, 2016

2016-02-19 17:59:16: jonathan.underwood commented


Can confirm that on 0.16.2, starting server like this:

xpra start --start-child=xterm --socket-dir=/run/user/1000/xpra :100

and then simply doing a

xpra --mmap=no  attach ssh:withnail.phys.ucl.ac.uk:100

worked fine. Does that cover what you wanted?

@totaam
Copy link
Collaborator Author

totaam commented Feb 19, 2016

2016-02-19 19:28:44: jonathan.underwood commented


Also, I'm not quite clear quite what the --bind is intended to do - in your example (with three paths), is it creating three sockets at the three paths? You talk about 2 sockets, so I am a bit confused.

Aside: I looked for it in the man page (on 0.16.2), and didn't see any mention there.

@totaam
Copy link
Collaborator Author

totaam commented Feb 20, 2016

2016-02-20 05:25:14: antoine commented


jonathan.underwood: no, socket-dir and bind are related, but different things. bind is a 0.17 feature (sorry about the confusion) which allows you to create as many unix domain sockets as you like.
I have edited comment:1 to try to clarify.

@totaam
Copy link
Collaborator Author

totaam commented Mar 13, 2016

2016-03-13 02:52:54: antoine changed priority from major to critical

@totaam
Copy link
Collaborator Author

totaam commented Mar 13, 2016

2016-03-13 02:52:54: antoine commented


@jonathan.underwood: we have a problem, please see #1129#comment:9

@totaam
Copy link
Collaborator Author

totaam commented Mar 16, 2016

2016-03-16 05:43:01: antoine changed owner from jonathan.underwood to afarr

@totaam
Copy link
Collaborator Author

totaam commented Mar 16, 2016

2016-03-16 05:43:01: antoine commented


@afarr: I think we can close this ticket for 0.17 as this works fine (unless you can break it, see comment:1), though things may still change when it comes to the defaults we ship, as per #1129.

@totaam
Copy link
Collaborator Author

totaam commented Apr 13, 2016

2016-04-13 22:34:08: afarr changed status from new to closed

@totaam
Copy link
Collaborator Author

totaam commented Apr 13, 2016

2016-04-13 22:34:08: afarr set resolution to fixed

@totaam
Copy link
Collaborator Author

totaam commented Apr 13, 2016

2016-04-13 22:34:08: afarr commented


Uhh... not familiar enough with manually manipulating my sockets to know where to start trying to break it.

I'll go ahead and close and maybe open a new one if I can learn enough to be socket-dangerous at some point in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant