I have an application running on Apache on CentOS. It has internet facing IP address. I want it to accept only anonymous connections from Tor browser. How to do this?
1 Answer
Depending on your purpose, there are two possibilities.
You either have to create a hidden service:
- Install Tor.
- Install Apache (as you already have) and bind it to
localhost
byListen 127.0.0.1:80
Configure hidden service in your
torrc
:HiddenServiceDir /var/lib/tor/hidden_service/ HiddenServicePort 80 127.0.0.1:80
and restart Tor. Tor then generates a new public/private keypair and a
.onion
hostname
based on that public key. All these files can be found in the HiddenServiceDir specified.Backup your private key if you would like to keep the
.onion
address unchanged in the future.
Or you could do the exact opposite of blocking access from Tor exit nodes.
Inside the desired configuration section (
<VirtualHost>
,<Directory>
etc.), addOrder deny,allow Deny from all Include /etc/apache2/tor-ip.conf
Create
tor-ip.conf
from dan.me.uk list of TOR exit nodes, but useallow
instead ofdeny
:wget -q https://www.dan.me.uk/torlist/ -O - \ | sed 's/^/allow from /g' > /etc/apache2/tor-ip.conf; \ service apache2 reload
Only creating a hidden service makes your server anonymous, too. The other option only requires your users to use an anonymous Tor connection.