xpra icon
Bug tracker and wiki

Opened 3 years ago

Closed 3 years ago

#963 closed enhancement (fixed)

multiple bind options for local sockets

Reported by: Antoine Martin Owned by: alas
Priority: critical Milestone: 0.17
Component: android Version: 0.15.x
Keywords: Cc:

Description

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.

Attachments (1)

cleanup-real-socket-path.patch (3.0 KB) - added by Antoine Martin 3 years ago.
attempt at figuring out the real socket path from the socket file descriptor - does not work..

Download all attachments as: .zip

Change History (10)

comment:1 Changed 3 years ago by Antoine Martin

Owner: changed from Antoine Martin to jonathan.underwood

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.

Last edited 3 years ago by Antoine Martin (previous) (diff)

comment:2 Changed 3 years ago by Antoine Martin

See also #1066.

comment:3 Changed 3 years ago by 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.

Changed 3 years ago by Antoine Martin

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

comment:4 Changed 3 years ago by 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?

comment:5 Changed 3 years ago by 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.

comment:6 Changed 3 years ago by 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.

comment:7 Changed 3 years ago by Antoine Martin

Priority: majorcritical

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

comment:8 Changed 3 years ago by Antoine Martin

Owner: changed from jonathan.underwood to alas

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

comment:9 Changed 3 years ago by alas

Resolution: fixed
Status: newclosed

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.

Note: See TracTickets for help on using tickets.