== Transparently Routing Traffic Through Tor With Transocks ==
## Transparently Routing Traffic Through Tor With Transocks
'''This page is obsolete.''' Follow the instructions at [[TheOnionRouter/TransparentProxy|TransparentProxy]] instead.
**This page is obsolete.** Follow the instructions at [[TheOnionRouter/TransparentProxy|TransparentProxy]] instead.
This is a quick and dirty method for setting up [[http://transocks.sourceforge.net/|Transocks]] in Debian. The advantage in using Transocks is that all network applications using TCP will have their traffic routed through Tor without any configuration. For programs with native SOCKS support it may be a better idea to have them connect to Tor directly rather than letting Transocks handle the connection transparently. Transocks won't interfere with programs trying to connect to Tor directly, so running it as well can't hurt.
This configuration is designed to completely prevent all non-Tor traffic from leaving a computer. If you want to allow some programs to bypass Tor, you'll need to change the {{{transocks-rules.sh}}} script. Also, modifying {{{transocks-rules.sh}}} will allow Transocks to run on a router, transparently routing an entire network's traffic through Tor.
This configuration is designed to completely prevent all non-Tor traffic from leaving a computer. If you want to allow some programs to bypass Tor, you'll need to change the `transocks-rules.sh` script. Also, modifying `transocks-rules.sh` will allow Transocks to run on a router, transparently routing an entire network's traffic through Tor.
'''Table of Contents'''
**Table of Contents**
<<TableOfContents>>
== tor-dns-proxy.py ==
## tor-dns-proxy.py
In order to plug [[TheOnionRouter/TorFAQ#SOCKSAndDNS|DNS leaks]], you'll need to install {{{tor-dns-proxy.py}}} from [[http://www.monkey.org/~dugsong/dsocks/|dsocks]]. You can either apply the included patch or just change {{{tor-dns-proxy.py}}} as indicated.
In order to plug [[TheOnionRouter/TorFAQ#SOCKSAndDNS|DNS leaks]], you'll need to install `tor-dns-proxy.py` from [[http://www.monkey.org/~dugsong/dsocks/|dsocks]]. You can either apply the included patch or just change `tor-dns-proxy.py` as indicated.
The following patch allows Transocks to build with the current Dante, moves the pid file to a writable location, and adds an option to bind to localhost rather than all interfaces. Copy it to {{{/usr/src/transocks.patch}}}
The following patch allows Transocks to build with the current Dante, moves the pid file to a writable location, and adds an option to bind to localhost rather than all interfaces. Copy it to `/usr/src/transocks.patch`
$ cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/transocks co -P transocks
...
...
@@ -121,27 +121,26 @@ $ cd transocks
$ make
# cp transocks /usr/local/sbin
# mkdir -m 0777 /var/run/transocks
}}}
```
Edit {{{/etc/socks.conf}}} to forward traffic to Tor at 127.0.0.1:9050.
Edit `/etc/socks.conf` to forward traffic to Tor at 127.0.0.1:9050.
'''/etc/socks.conf'''
{{{
**/etc/socks.conf**
```
route {
from: 0.0.0.0/0 to: 0.0.0.0/0 via: 127.0.0.1 port = 9050
proxyprotocol: socks_v4
method: none
protocol: tcp
}
}}}
```
== iptables Configuration ==
## iptables Configuration
{{{transocks-rules.sh}}} configures {{{iptables}}} to forward all DNS queries to {{{tor-dns-proxy.py}}} and all outgoing TCP connections to Transocks. Only connections initiated by Tor are allowed to leave the machine. {{{LOCAL_NET}}} may need to be customized or eliminated. This script doesn't handle forwarded connections; it must be modified to use on a router.
`transocks-rules.sh` configures `iptables` to forward all DNS queries to `tor-dns-proxy.py` and all outgoing TCP connections to Transocks. Only connections initiated by Tor are allowed to leave the machine. `LOCAL_NET` may need to be customized or eliminated. This script doesn't handle forwarded connections; it must be modified to use on a router.