Purpose
Create a hidden Tor service with unix socket.
Unix domain sockets can provide an additional layer of isolation protection.
To do your own service you need Tor and a webserver (Nginx for this example).
You can use my prevent post to generate ubuntu docker and access it with simple SSH \o/
Install
First install to on your server:
1 | sudo apt update |
Configure Nginx
Create a configuration in /etc/nginx/sites-available/
1 | cd /etc/nginx/sites-available/ |
Put your tor webserver configuration in this file:
1 | server { |
enable tor site in Nginx :
1 | sudo ln -s /etc/nginx/sites-available/tor /etc/nginx/sites-enabled/ |
Start php-fpm service :
1 | sudo service php7.4-fpm start |
Create a simple web page:
1 | cd /var/www/html |
Add :
1 | <?php |
To get some content ;)
Set right on portal files/folders
1 | sudo chown -R www-data:www-data tor |
Start nginx server:
1 | sudo service nginx start |
Configure Tor
configure /etc/tor/torrc file
1 | sudo nano /etc/tor/torrc |
Your service files will be in “/var/lib/tor/myService”.
Start Tor
1 | screen -S tor |
- [CTRL+A and CTRL+D] to exit screen without kill it and run command in background
- screen -ls to show your screen session
- screen -r tor to attach your session
Find your Tor URL
1 | sudo cat /var/lib/tor/myService/hostname |
Edit nginx configuration to match hostname :
1 | sudo nano /etc/nginx/sites-ava |
Now you can access your service with tor-browser, Brave, socks5 …
In case you want to test if your unix socket work you can run :
1 | curl --unix-socket /var/run/nginx-tor.sock http:/index.php |