Most torify
documentation is about accessing non-hidden services.
Yet .onion address look like real tcp addresses, does torify
make those available.
Tor Stack Exchange is a question and answer site for researchers, developers, and users of Tor. It only takes a minute to sign up.
Sign up to join this communityThe torsocks program (the actual name of the torify alias) can connect to hidden services fine. For example:
torsocks curl https://3g2upl4pq6kufc4m.onion
localnet
option).
curl
to work in 3 modes: torsocks, proxychains, and privproxy with curl --proxy option. Yet, for some reason my executable does not connect to the onion address in any of those modes.
Dec 31, 2020 at 16:01
MapAddress
torrc option to map the onion name to an IP address. For example something like MapAddress 192.0.2.10 qwerty.onion
, and then torsocks curl 192.0.2.10
.
If the hidden service is HTTP AND your client for some reason does not support torsocks, then you may benefit from a nginx revers proxy listening on local ports
WARNINGS:
/etc/nginx/sites-enabled/default
server {
listen 127.0.0.1:1234 default_server;
location / {
proxy_pass https://3g2upl4pq6kufc4m.onion;
# Timeout
proxy_connect_timeout 5m;
proxy_send_timeout 5m;
proxy_read_timeout 5m;
send_timeout 5m;
# Settings for cache
proxy_set_header Host $host;
proxy_buffering on;
proxy_cache STATIC;
proxy_cache_valid 200 5m;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;
}
}
/etc/nginx/nginx.conf
http {
## 2021-01-01
proxy_cache_path /opt/nginx/cache levels=1:2
keys_zone=STATIC:10m inactive=24h max_size=1g;
sudo mkdir -p /opt/nginx/
sudo torsocks nginx
curl 127.0.0.1:1234
To stop, use regular kill because systemctl will not work:
ps axf | grep -v grep | grep nginx # lookup PID
kill PID_GOES_HERE
Now instead of starting and stopping ngingx manually, edit systemd script so it does it automatically every time the process crashes or the system reboots.
Edit /lib/systemd/system/nginx.service
/usr/bin/torsocks
in front of every Exec commandExecStart=/usr/bin/torsocks /usr/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/bin/torsocks /usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=/usr/bin/torsocks /sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid
sudo systemctl daemon-reload
sudo systemctl restart nginx
/usr/bin/socat TCP-LISTEN:1234,fork SOCKS4A:127.0.0.1:3g2upl4pq6kufc4m.onion:80,socksport=9050