i have installed TOR
and nginx
on my cent os server.
when i proxy_pass requests to the TOR
running on my localhost and supply host headers
of .onion
website. i am getting
tor is not an http proxy
what i am trying to do is make .onion
website available on non TOR
network.
How can i do this ?
update: 1
as Alexey Vesnin answer, i have downloaded & installed polipo.
Started tor
as Daemon
Started polipo
as
polipo -c /etc/polipo/config
Started nginx
here is nginx.conf
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
gzip on;
server {
listen 80;
server_name server_ip;
location / {
proxy_pass http://127.0.0.1:8123/;
proxy_set_header Host "example.onion";
proxy_set_header Accept-Encoding "";
proxy_set_header Via "$host";
subs_filter 'example.onion' $host;
}
}
}
polipo config
socksParentProxy = "localhost:9050"
socksProxyType = socks5
diskCacheRoot = ""
disableLocalInterface=true
here is what i am getting after accessing ip_address in browser.
Currently flow is :
nginx (port 80) -> 127.0.0.1:8123 (polipo) -> tor (socks proxy on port 9050)
if i stop polipo
and use socat
as suggested by other answer, i can access example.onion
by going to my ip_address
.
update 2 :
here are tcpdump output
curl -x http://127.0.0.1:8123 -I example.onion
[root@centos-512mb-blr1-01 sbin]# tcpdump -i any src port 8123 or dst port 8123
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
18:06:19.100755 IP centos-512mb-blr1-01.34156 > centos-512mb-blr1-01.8123: Flags [S], seq 2706160723, win 43690, options [mss 65495,sackOK,TS val 180383683 ecr 0,nop,wscale 6], length 0
22:06:59.512088 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34156: Flags [S.], seq 15619937, ack 2706160724, win 43690, options [mss 65495,sackOK,TS val 180383683 ecr 180383683,nop,wscale 6], length 0
18:06:19.100791 IP centos-512mb-blr1-01.34156 > centos-512mb-blr1-01.8123: Flags [.], ack 1, win 683, options [nop,nop,TS val 180383683 ecr 180383683], length 0
18:06:19.100892 IP centos-512mb-blr1-01.34156 > centos-512mb-blr1-01.8123: Flags [P.], seq 1:147, ack 1, win 683, options [nop,nop,TS val 180383683 ecr 180383683], length 146
18:06:19.100900 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34156: Flags [.], ack 147, win 700, options [nop,nop,TS val 180383683 ecr 180383683], length 0
18:06:20.164200 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34156: Flags [P.], seq 1:496, ack 147, win 700, options [nop,nop,TS val 180384746 ecr 180383683], length 495
18:06:20.164207 IP centos-512mb-blr1-01.34156 > centos-512mb-blr1-01.8123: Flags [.], ack 496, win 700, options [nop,nop,TS val 180384746 ecr 180384746], length 0
18:06:20.164667 IP centos-512mb-blr1-01.34156 > centos-512mb-blr1-01.8123: Flags [F.], seq 147, ack 496, win 700, options [nop,nop,TS val 180384747 ecr 180384746], length 0
18:06:20.165750 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34156: Flags [F.], seq 496, ack 148, win 700, options [nop,nop,TS val 180384748 ecr 180384747], length 0
18:06:20.165763 IP centos-512mb-blr1-01.34156 > centos-512mb-blr1-01.8123: Flags [.], ack 497, win 700, options [nop,nop,TS val 180384748 ecr 180384748], length 0
curl -x http://127.0.0.1:8123 example.onion
[root@centos-512mb-blr1-01 sbin]# tcpdump -i any src port 8123 or dst port 8123
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
18:08:41.663821 IP centos-512mb-blr1-01.34162 > centos-512mb-blr1-01.8123: Flags [S], seq 418350783, win 43690, options [mss 65495,sackOK,TS val 180526246 ecr 0,nop,wscale 6], length 0
00:12:03.077270 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34162: Flags [S.], seq 1228213188, ack 418350784, win 43690, options [mss 65495,sackOK,TS val 180526246 ecr 180526246,nop,wscale 6], length 0
18:08:41.663881 IP centos-512mb-blr1-01.34162 > centos-512mb-blr1-01.8123: Flags [.], ack 1, win 683, options [nop,nop,TS val 180526246 ecr 180526246], length 0
18:08:41.664001 IP centos-512mb-blr1-01.34162 > centos-512mb-blr1-01.8123: Flags [P.], seq 1:146, ack 1, win 683, options [nop,nop,TS val 180526246 ecr 180526246], length 145
18:08:41.664007 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34162: Flags [.], ack 146, win 700, options [nop,nop,TS val 180526246 ecr 180526246], length 0
18:08:42.569780 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34162: Flags [P.], seq 1:7954, ack 146, win 700, options [nop,nop,TS val 180527152 ecr 180526246], length 7953
18:08:42.569791 IP centos-512mb-blr1-01.34162 > centos-512mb-blr1-01.8123: Flags [.], ack 7954, win 2729, options [nop,nop,TS val 180527152 ecr 180527152], length 0
18:08:42.570223 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34162: Flags [P.], seq 7954:11447, ack 146, win 700, options [nop,nop,TS val 180527152 ecr 180527152], length 3493
18:08:42.570229 IP centos-512mb-blr1-01.34162 > centos-512mb-blr1-01.8123: Flags [.], ack 11447, win 4776, options [nop,nop,TS val 180527152 ecr 180527152], length 0
18:08:42.761444 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34162: Flags [P.], seq 11447:13454, ack 146, win 700, options [nop,nop,TS val 180527344 ecr 180527152], length 2007
18:08:42.761450 IP centos-512mb-blr1-01.34162 > centos-512mb-blr1-01.8123: Flags [.], ack 13454, win 6822, options [nop,nop,TS val 180527344 ecr 180527344], length 0
18:08:42.761708 IP centos-512mb-blr1-01.34162 > centos-512mb-blr1-01.8123: Flags [F.], seq 146, ack 13454, win 6822, options [nop,nop,TS val 180527344 ecr 180527344], length 0
18:08:42.762874 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34162: Flags [F.], seq 13454, ack 147, win 700, options [nop,nop,TS val 180527345 ecr 180527344], length 0
18:08:42.762887 IP centos-512mb-blr1-01.34162 > centos-512mb-blr1-01.8123: Flags [.], ack 13455, win 6822, options [nop,nop,TS val 180527345 ecr 180527345], length 0
from web browser trying to access ip_address
[root@centos-512mb-blr1-01 sbin]# tcpdump -i any src port 8123 or dst port 8123
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
18:06:55.843802 IP centos-512mb-blr1-01.34160 > centos-512mb-blr1-01.8123: Flags [S], seq 910534644, win 43690, options [mss 65495,sackOK,TS val 180420426 ecr 0,nop,wscale 6], length 0
17:57:09.532188 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34160: Flags [S.], seq 1766895439, ack 910534645, win 43690, options [mss 65495,sackOK,TS val 180420426 ecr 180420426,nop,wscale 6], length 0
18:06:55.843842 IP centos-512mb-blr1-01.34160 > centos-512mb-blr1-01.8123: Flags [.], ack 1, win 683, options [nop,nop,TS val 180420426 ecr 180420426], length 0
18:06:55.843918 IP centos-512mb-blr1-01.34160 > centos-512mb-blr1-01.8123: Flags [P.], seq 1:447, ack 1, win 683, options [nop,nop,TS val 180420426 ecr 180420426], length 446
18:06:55.843925 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34160: Flags [.], ack 447, win 700, options [nop,nop,TS val 180420426 ecr 180420426], length 0
18:06:55.844164 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34160: Flags [P.], seq 1:607, ack 447, win 700, options [nop,nop,TS val 180420426 ecr 180420426], length 606
18:06:55.844171 IP centos-512mb-blr1-01.34160 > centos-512mb-blr1-01.8123: Flags [.], ack 607, win 702, options [nop,nop,TS val 180420426 ecr 180420426], length 0
18:06:55.844199 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34160: Flags [F.], seq 607, ack 447, win 700, options [nop,nop,TS val 180420426 ecr 180420426], length 0
18:06:55.844949 IP centos-512mb-blr1-01.34160 > centos-512mb-blr1-01.8123: Flags [F.], seq 447, ack 608, win 702, options [nop,nop,TS val 180420427 ecr 180420426], length 0
18:06:55.844961 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34160: Flags [.], ack 448, win 700, options [nop,nop,TS val 180420427 ecr 180420427], length 0
from web browser trying to access ip_address with proxy_redirect off;
[root@centos-512mb-blr1-01 sbin]# tcpdump -i any src port 8123 or dst port 8123
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
18:11:29.776426 IP centos-512mb-blr1-01.34166 > centos-512mb-blr1-01.8123: Flags [S], seq 1166517450, win 43690, options [mss 65495,sackOK,TS val 180694358 ecr 0,nop,wscale 6], length 0
08:46:03.082415 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34166: Flags [S.], seq 2412138764, ack 1166517451, win 43690, options [mss 65495,sackOK,TS val 180694359 ecr 180694358,nop,wscale 6], length 0
18:11:29.776471 IP centos-512mb-blr1-01.34166 > centos-512mb-blr1-01.8123: Flags [.], ack 1, win 683, options [nop,nop,TS val 180694359 ecr 180694359], length 0
18:11:29.776554 IP centos-512mb-blr1-01.34166 > centos-512mb-blr1-01.8123: Flags [P.], seq 1:447, ack 1, win 683, options [nop,nop,TS val 180694359 ecr 180694359], length 446
18:11:29.776560 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34166: Flags [.], ack 447, win 700, options [nop,nop,TS val 180694359 ecr 180694359], length 0
18:11:29.777002 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34166: Flags [P.], seq 1:607, ack 447, win 700, options [nop,nop,TS val 180694359 ecr 180694359], length 606
18:11:29.777012 IP centos-512mb-blr1-01.34166 > centos-512mb-blr1-01.8123: Flags [.], ack 607, win 702, options [nop,nop,TS val 180694359 ecr 180694359], length 0
18:11:29.777030 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34166: Flags [F.], seq 607, ack 447, win 700, options [nop,nop,TS val 180694359 ecr 180694359], length 0
18:11:29.777159 IP centos-512mb-blr1-01.34166 > centos-512mb-blr1-01.8123: Flags [F.], seq 447, ack 608, win 702, options [nop,nop,TS val 180694359 ecr 180694359], length 0
18:11:29.777178 IP centos-512mb-blr1-01.8123 > centos-512mb-blr1-01.34166: Flags [.], ack 448, win 700, options [nop,nop,TS val 180694359 ecr 180694359], length 0