Skip to content
  • Lennart Poettering's avatar
    transport: add new unixexec transport on Unix · f67f4597
    Lennart Poettering authored
    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: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
    f67f4597