X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=README;h=4776f6fb7e706aac144901a671449b725cec7d7b;hb=e1023d6d3b30a460dc3c74a1d0f62e95964918c3;hp=ba408bd3a9b8220fde53126493821437b5a54343;hpb=77107ab307336b504747041a5cf4c79112e419b7;p=socket2unix%2Fsocket2unix.git diff --git a/README b/README index ba408bd..4776f6f 100644 --- a/README +++ b/README @@ -8,7 +8,7 @@ sockets are usable by everyone on the system. It works for both servers (`listen(3)`) and clients (`connect(3)`). -These UNIX sockets can also be forwared over SSH with `socat`. +These UNIX sockets can also be forwared over SSH with `socat` (see below). DEPENDENCIES @@ -71,6 +71,45 @@ The following additional environment variables are available: - 'SOCKET2UNIX_DEBUG': Control debug level. 1 = errors only, 2 = warnings only, 3 = debug messages. Default: 2 +- 'SOCKET2UNIX_OPTIONS': + Comma separated list of options for socket2unix. Valid options are (without + quotes): + - 'client_only': Don't intercept calls to `listen()` and `accept()`. + - 'server_only': Don't intercept calls to `connect()`. + These options are useful if a program has both client and server + functionality but only one part should be redirected. + + +EXAMPLES +-------- + +`socat` can be used to forward UNIX sockets over SSH. Thanks to [1] for the +necessary commands. + +[1]: http://www.debian-administration.org/users/dkg/weblog/68 + +`socat` is required on both local and remote system. + +To forward the server socket `path/to/socket/remote` from `remote-host` to +`path/to/socket/local` on the local host run this command on the local system: + + $ socat UNIX-LISTEN:path/to/socket/local,reuseaddr,fork \ + EXEC:'ssh remote-host socat STDIO UNIX-CONNECT\:path/to/socket/remote' + +Any program on the local host can then connect to `path/to/socket/local` and +the connection gets forwarded to `remote-host`. + +To use the forwarding with socket2unix the sockets must be named appropriately +(see above). For example to use socket2unix on the client-side: + + $ socat UNIX-LISTEN:socket-v4-4711,reuseaddr,fork ... + +Connect to the forwarded socket: + + $ LD_PRELOAD=/path/to/libsocket2unix.so \ + SOCKET2UNIX_PATH=`pwd`/socket nc -4 localhost 3000 + +The same works for the remote socket. BUGS