wongsyrone / transocks-wong

A redsocks-like transparent IPv4/IPv6 TCP-to-SOCKS5 redirector (for Linux only)
GNU General Public License v2.0
63 stars 15 forks source link

Feature request: Support for connecting on Unix Sockets #3

Open phantomcraft opened 5 years ago

phantomcraft commented 5 years ago

Unix Sockets are just link IP Sockets, but contained in a file descriptor.

Some softwares like Tor provides SOCKS5 proxy as a Unix File socket, could you implement this feature?

Very useful for network namespaces.

wongsyrone commented 5 years ago

Does Tor provide a SOCKS5 server via socket(AF_UNIX, SOCK_STREAM, ...) ? I will consider it if so.

phantomcraft commented 5 years ago

Yes, it provides, $ man tor

       SocksPort [address:]port|unix:path|auto [flags] [isolation flags]
          Open this port to listen for connections from SOCKS-speaking applications. Set this to 0 if you don’t want to allow application connections via SOCKS. Set it to "auto" to have Tor pick a port for you. This
           directive can be specified multiple times to bind to multiple addresses/ports. If a unix domain socket is used, you may quote the path using standard C escape sequences. (Default: 9050)

           NOTE: Although this option allows you to specify an IP address other than localhost, you should do so only with extreme caution. The SOCKS protocol is unencrypted and (as we use it) unauthenticated, so
           exposing it in this way could leak your information to anybody watching your network, and allow anybody to use your computer as an open proxy.

           If multiple entries of this option are present in your configuration file, Tor will perform stream isolation between listeners by default. The isolation flags arguments give Tor rules for which streams
           received on this SocksPort are allowed to share circuits with one another. Recognized isolation flags are:

Here I use this option on my torrc:

SocksPort unix:/var/run/tor/socks IPv6Traffic PreferIPv6 WorldWritable