Xpra: Ticket #963: multiple bind options for local sockets

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.



Sat, 26 Dec 2015 17:39:03 GMT - Antoine Martin: owner changed

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:


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.


Tue, 29 Dec 2015 10:07:28 GMT - Antoine Martin:

See also #1066.


Fri, 22 Jan 2016 20:54:58 GMT - Antoine Martin:

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.


Fri, 22 Jan 2016 21:18:53 GMT - Antoine Martin: attachment set

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


Fri, 19 Feb 2016 17:59:16 GMT - jonathan.underwood:

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?


Fri, 19 Feb 2016 19:28:43 GMT - jonathan.underwood:

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.


Sat, 20 Feb 2016 05:25:14 GMT - Antoine Martin:

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.


Sun, 13 Mar 2016 02:52:54 GMT - Antoine Martin: priority changed

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


Wed, 16 Mar 2016 05:43:01 GMT - Antoine Martin: owner changed

@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.


Wed, 13 Apr 2016 21:34:07 GMT - alas: status changed; resolution set

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.


Sat, 23 Jan 2021 05:11:01 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/963