Fetching latest commit…
Cannot retrieve the latest commit at this time.
This tool allows you to redirect any TCP connection to SOCKS or HTTPS proxy using your firewall, so redirection is system-wide. Why is that useful? I can suggest following reasons: * you use tor and don't want any TCP connection to leak. * you use DVB ISP and this ISP provides internet connectivity with some special daemon that may be also called "Internet accelerator" and this accelerator acts as proxy. Globax is example of such an accelerator. Linux/iptables, OpenBSD/pf and FreeBSD/ipfw are supported. Linux/iptables is well-tested, other implementations may have bugs, your bugreports are welcome. Transocks is alike project but it has noticable performance penality. Transsocks_ev is alike project too, but it has no HTTPS-proxy support and does not support authentication. Several Andoird apps also use redsocks under-the-hood: ProxyDroid and sshtunnel. And that's over 100'000 downloads! Wow!  http://www.torproject.org  http://www.globax.biz  http://transocks.sourceforge.net/  http://oss.tiggerswelt.net/transocks_ev/  http://code.google.com/p/proxydroid/  https://market.android.com/details?id=org.proxydroid  http://code.google.com/p/sshtunnel/  https://market.android.com/details?id=org.sshtunnel Another related issue is DNS over TCP. Redsocks includes `dnstc' that is fake and really dumb DNS server that returns "truncated answer" to every query via UDP. RFC-compliant resolver should repeat same query via TCP in this case - so the request can be redirected using usual redsocks facilities. Known compliant resolvers are: * bind9 (server) * dig, nslookup (tools based on bind9 code) Known non-compliant resolvers are: * eglibc resolver fails without any attempt to send request via TCP * powerdns-recursor can't properly startup without UDP connectivity as it can't load root hints On the other hand, DNS via TCP using bind9 may be painfully slow. If your bind9 setup is really slow, you have at least two options: pdnsd caching server can run in TCP-only mode, ttdnsd has no cache but can be useful for same purpose.  http://www.phys.uu.nl/~rombouts/pdnsd.html  http://www.mulliner.org/collin/ttdnsd.php  https://gitweb.torproject.org/ioerror/ttdnsd.git Features ======== Redirect any TCP connection to SOCKS4, SOCKS5 or HTTPS (HTTP/CONNECT) proxy server. Login/password authentication is supported for SOCKS5/HTTPS connections. SOCKS4 supports only username, password is ignored. for HTTPS, currently only Basic and Digest scheme is supported. Redirect UDP packets via SOCKS5 proxy server. NB: UDP still goes via UDP, so you can't relay UDP via OpenSSH. Sends "truncated reply" as an answer to UDP DNS queries. Redirect any HTTP connection to proxy that does not support transparent proxying (e.g. old SQUID had broken `acl myport' for such connections). License ======= All source code is licensed under Apache 2.0 license. You can get a copy at http://www.apache.org/licenses/LICENSE-2.0.html Compilation =========== libevent is required. gcc and clang are supported right now, other compilers can be used but may require some code changes. Compilation is as easy as running `make', there is no `./configure' magic. GNU Make works, other implementations of make were not tested.  http://libevent.org/ || http://www.monkey.org/~provos/libevent/ Running ======= Program has following command-line options: -c sets proper path to config file ("./redsocks.conf" is default one) -t tests config file syntax -p set a file to write the getpid() into Following signals are understood: SIGUSR1 dumps list of connected clients to log SIGTERM and SIGINT terminates daemon, all active connections are closed You can see configuration file example in redsocks.conf.example iptables example ================ You have to build iptables with connection tracking and REDIRECT target. # Create new chain iptables -t nat -N REDSOCKS # Ignore LANs and some other reserved addresses. iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j RETURN iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j RETURN iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j RETURN iptables -t nat -A REDSOCKS -d 169.254.0.0/16 -j RETURN iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j RETURN iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN iptables -t nat -A REDSOCKS -d 188.8.131.52/4 -j RETURN iptables -t nat -A REDSOCKS -d 240.0.0.0/4 -j RETURN # Anything else should be redirected to port 12345 iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-ports 12345 # Any tcp connection made by `darkk' should be redirected. iptables -t nat -A OUTPUT -p tcp -m owner --uid-owner darkk -j REDSOCKS Homepage ======== http://darkk.net.ru/redsocks/ Mailing list: firstname.lastname@example.org Mailing list also has archives.  http://librelist.com/browser/redsocks/ TODO ==== Test OpenBSD (pf) and FreeBSD (ipfw) and write setup examples for those firewall types. Author ====== This program was written by Leonid Evdokimov <email@example.com>