I've been trying to setup a transparent Linux-based tor proxy on CHIP, following these instructions.
I've created a /etc/tor/torrc file like this:
Log notice file /var/log/tor/notices.log
VirtualAddrNetwork 10.192.0.0/10
AutomapHostsSuffixes .onion,.exit
AutomapHostsOnResolve 1
TransPort 10.0.1.28:9040
DNSPort 10.0.1.28:53
And then, before playing with any iptables, decided to test it using wget by trying the proxy from within the machine:
wget -e use_proxy=yes -e http_proxy=10.0.1.28:9040 http://google.com
What I get then is:
--2016-07-09 14:43:45-- http://google.com/
Connecting to 10.0.1.28:9040... connected.
Proxy request sent, awaiting response... No data received.
Retrying.
--2016-07-09 14:43:46-- (try: 2) http://google.com/
Connecting to 10.0.1.28:9040... connected.
Proxy request sent, awaiting response... No data received.
Retrying.
--2016-07-09 14:43:48-- (try: 3) http://google.com/
Connecting to 10.0.1.28:9040... connected.
Proxy request sent, awaiting response... Read error (Connection reset by peer) in headers.
And on Tor's log file, this:
Jul 09 14:43:48.000 [warn] getsockopt() failed: Protocol not available
Jul 09 14:43:48.000 [warn] Fetching original destination failed. Closing.
What am I doing wrong?
MORE INFO:
I've run Tor using strace, and this is what I've got when I'm trying to use it as a proxy:
accept4(8, {sa_family=AF_INET, sin_port=htons(46950), sin_addr=inet_addr("10.0.1.28")}, [16], SOCK_CLOEXEC|SOCK_NONBLOCK) = 13
setsockopt(13, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
getsockopt(13, SOL_IP, 0x50 /* IP_??? */, 0xbee6a8c8, 0xbee6a8b0) = -1 ENOPROTOOPT (Protocol not available)
The culprit is somewhere in this area: SOL_IP, 0x50 /* IP_??? */, as I understand the ENOPROTOOPT means that the option name is unavailable for the protocol chosen.