Create simple Tor hidden service
In this article I want to share how simple it is to create a service in Onion web (Tor network). We will create simple web page that would be accessible via Tor browser. I will show the example for CentOS 7 (RHEL).
Make sure that your have configured your server as a webserver (nginx is assumed).
Next install tor package
1 | $ yum install epel-release |
and configure it cp /usr/share/tor/defaults-torrc /etc/tor/torrc
Now edit config that was copied and make sure lines below are uncommented
1 | RunAsDaemon 1 |
Skip all the lines intented for relays and modify only the one for location-hidden services
Now update nginx configuration to point to your hidden resource vim /etc/nginx/conf.d/my_hidden_site.conf
Paste sample configuration in that file
1 | server { |
Make sure you have created same sample html page at /usr/local/my_hidden_site
directory
1 | <html> |
Now just restart nginx and tor services for changes to take effect
1 | $ nginx -t && nginx -s reload |
Check content of /var/lib/tor/my_hidden_service/hostname
, open Tor browser and point it to the url generated. That’s it.
Notes
This is simplified tutorial assuming that you have SELinux disabled. To check current status and disable it if not yet execute following
1 | $ sestatus |
The other issue that might prevent tor service from start is permissions on directories. So make sure that you have proper access rights on folder /var/lib/tor/my_hidden_service
(or any other folder that you’ve specified)
1 | $ sudo chmod -R toranon:toranon /var/lib/tor/my_hidden_service |