transport: add new unixexec transport on Unix
authorLennart Poettering <lennart@poettering.net>
Fri, 11 Mar 2011 21:35:16 +0000 (22:35 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 12 Mar 2012 16:38:56 +0000 (16:38 +0000)
commitf67f45979b48ce63fb82179a7ec261e5e3ec3395
tree6beaf8fa5920f50d05c3246de45b550c7b931964
parent1a4d710d67391c1d7be2d7db6313e6c118acc773
transport: add new unixexec transport on Unix

The "unixexec:" transport will create a local AF_UNIX socket with
socketpair(), then fork and execute a binary on one side with STDIN and
STDOUT connected to it and then use the other side.

This is useful to implement D-Bus tunneling schemes, for example to get
a D-Bus connection to the system bus on a different host, similar how
udisks is already doing it. (udisks uses SSH TCP tunneling for this,
which is a bit ugly and less secure than this solution).

Suggested use is with connection strings like the following:

  unixexec:path=ssh,argv1=foobar,argv2=system-bus-bridge

or:

  unixexec:path=pkexec,argv1=system-bus-bridge

or even:

  unixexec:path=sudo,argv1=system-bus-bridge

The first line would execute the binary 'system-bus-bridge' on host
'foobar' and then pass D-Bus traffic to it. This (hypothetical) bridge
binary would then forward the information to the local system bus.

The second and third line use this scheme locally to acquire a
privileged connection through pkexec resp. sudo: instead of connecting
directly to the bus, they use the same bridge binary which will forward
all information to the system bus.

The arguments of the protocol are 'path' for the first execlp()
argument, and argv0, argv1, and so on for the following arguments. argv0
can be left out in which case path will be used.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35230
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
dbus/dbus-connection-internal.h
dbus/dbus-connection.c
dbus/dbus-sysdeps-unix.c
dbus/dbus-sysdeps-unix.h
dbus/dbus-test.c
dbus/dbus-test.h
dbus/dbus-transport-unix.c