Aug 31, 2016 04:49 PM
(This post was last modified: Oct 7, 2016 02:16 PM by Lrrr.)
IMPORTANT NOTE:
This is a minimal hidden service setup. This guide is not intended to be used to host illegal or otherwise dissalowed activities and is not designed to keep you anonymous. If you use this setup to host anything that could be considered "blackhat" you will most likely be de-anoynmized and busted! This is for educational purposes only.
Note: This setup is for LINUX, if you would like to set up a TOR Hidden Service. Click here for WINDOWS TOR Hidden Service.
![[Image: XVcz7Fx.png]](https://i.imgur.com/XVcz7Fx.png)
How to host a TOR hidden service
This is a minimal hidden service setup. This guide is not intended to be used to host illegal or otherwise dissalowed activities and is not designed to keep you anonymous. If you use this setup to host anything that could be considered "blackhat" you will most likely be de-anoynmized and busted! This is for educational purposes only.
Note: This setup is for LINUX, if you would like to set up a TOR Hidden Service. Click here for WINDOWS TOR Hidden Service.
![[Image: XVcz7Fx.png]](https://i.imgur.com/XVcz7Fx.png)
How to host a TOR hidden service
Purpose: The purpose of this tutorial is to show users how to:
- Install and Configure TOR
- Setup a simple Hello World website
- Configure a hidden service
- Generate an .onion host (and how to customize it!)
Chapter 0: Prerequisites
Requirements:
- Fresh Linux Server (For this tutorial, I will be using: Ubuntu Server 14.04)
- Basic Knowledge of Linux
- 1 Hour of Time
Chapter 1: Initial Setup
Server:
I have opted to use Amazon Web Services (AWS) for this tutorial. I am using ami-2d39803a, here are my instance details:
Spoiler (Click to View)
Don't worry about the security groups warning just yet, we will fix that later on.
Click Launch and you will get to a PEM key download page. Use an existing PEM or create a new one. I created a new one, named it Lrrr, and downloaded it...
Spoiler (Click to View)
Now that our instance is setup, we should have a public IP address assigned to us from AWS, time for the fun stuff.
Connect to your instance with the PEM you downloaded earlier
Code
ssh -i my_pem.pem -l ubuntu <instance IP address>NOTE: As a member pointed out, if you are on windows and using putty;
(Sep 1, 2016 11:10 PM)SIM-2848947 Wrote: One thing for anyone trying to connect to the instance with Putty. You need to download Putty Gen and change your .pem file into a putty private key (a .ppk). Then underneath Auth in putty you should be able to select the key.Thank you RYDIOO!
Let's add some sources, and update the box:
Code
sudo nano /etc/apt/sources.listAt the end of the sources.list file, paste this:
Code
#Tor
deb http://deb.torproject.org/torproject.org trusty main
deb-src http://deb.torproject.org/torproject.org trusty mainCTRL+X and Y to save the file.
Now we need to add our keys, update the repo's, and install tor,nginx,make, and gcc:
Code
sudo gpg --keyserver keys.gnupg.net --recv 886DDD89
sudo gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install tor deb.torproject.org-keyring -y
sudo apt-get install gcc unzip make libcurl4-openssl-dev nginx -y
sudo apt-get dist-upgradeIf all of this goes as planned, you should be able to run the following command and the output should say TOR is running:
Code
$ service tor status
* tor is runningIf you have anything other than * Tor is running, check the output for any failures and post them here.
Chapter 2: Firewall & Routing
Remember when I said we would worry about the security group policies at a later time? Now is that time! Head back over to your AWS instance panel, highlight your instance, and choose "launch-wizard-n" where n is whatever the auto-increment has made it to, ie: launch-wizard-30.
Once you are at the Security Groups screen, you will see four (4) tabs in the bottom pane, click the INBOUND pane and select EDIT. If you have been following this guide, a single SSH rule exists for source "Anywhere". Change that source to "My IP". Save.
Because TOR works off a socks proxy, there is no need to open any ports other than port 22 (ssh) to access the server.
Chapter 3: Generating an .onion Host
Now that we have tor running, we need to make some modifications to our torrc file.
Code
sudo nano /etc/tor/torrcfind and remove the # symbol from the following:
- #RunAsDaemon 1
- #DataDirectory /var/lib/tor
- #HiddenServiceDir /var/lib/tor/hidden_service/
- #HiddenServicePort 80 127.0.0.1:80
- The first option will run tor as a daemon
- The second will set the main data directory to /var/lib/tor
- The third will set a hidden service to be found in /var/lib/tor/
- The fourth is stating port 80, meaning we want the hidden service to be some type of website.
Now when you restart tor, it will create the hidden_service directory and generate a new onion hostname:
Code
service nginx start; sudo service tor restart;
* Stopping tor daemon... [ OK ]
* Starting tor daemon... [ OK ]
sudo cat /var/lib/tor/hidden_service/hostname
3pet3xqf7phhqufd.onionThis should work *out of the box*. To test, go ahead and open your tor browser and head to the onion host you got from the last command and you should see:
Code
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.Spoiler (Click to View)
Chapter 4: Onion Host Customization
So a random .onion host isn't cutting it for you, and you want a fancy host with some custom letters in the host...something like HFGodxqf7phhqufd.onion (not a real onion as of 31/08/2016)
For this, we will need to use a tool to bassicly "brute" (for lack of a better term). There are a few tools to help you do this:
- Onionhash - Linux
- Shallot - Linux
- Eschalot - Linux
- Scallion - Linux
- Garlic - Windows
For this tutorial, I will be setting up and using Shallot, because I think it's the easiest to setup. Login to your server and run the following:
Code
sudo su
cd ~
wget https://github.com/katmagic/Shallot/archive/master.zip
unzip master.zip
cd Shallot-master/
./configure && make
cp ./shallot /usr/bin/shallot; chmod +x /usr/bin/shallot;Now that we have shallot installed as a global script, we can test this by generating a test host:
Code
shallot ^HackThis will start a search/brute of any onion host starting with "Hack"....according to Shallot's github page the following breakdown for how long this should take is as follows:
Characters | Time to generate
1 | Less than 1 second
2 | Less than 1 second
3 | Less than 1 second
4 | 2 seconds
5 | 1 minute
6 | 30 minutes
7 | 1 day
As you can see, the more precise you try to get, the longer it takes to generate the required keys.
For this test, I used the term "lol" to make a match quickly.
Code
shallot ^lol
---------------------------------------------------------------
Found matching domain after 17215 tries: lolaklefegf7caci.onion
---------------------------------------------------------------
-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCmFppQ4OfaY1RljHXBRA0KjwT/NkqlxwGFYV3ExxBzYidIhi8b
qoTvyu0B/WCFcV9i8ZjcEDXB+BNDGMcDeBeL5LK4hHW+EMwlOTZOyVcoDHWJjlQq
x4T4V7lPP8eTdbuqCqRuzwOxuwb7iUCLn5wy/wdtmRoNQOwIoOFex9QauwIDAUw7
AoGAJ6PaljNDkMTVa9sr7wv5Nz4R1zd1VAm5eC6XsMKTs/WudoBEE8cR0BGsWbL4
HL4J6QSAtHUdkZMljy9FOifYG5Oa1gEcys4u46Xqh3f+BuQUIMuHX8n6Lod1n7cQ
WC5KJRjWf3hAC+aVumhGxv632WAKpVBbkQEnhwgr0MWyNMMCQQDTlLbUMub5r4hg
uq0VgAYHljdMU95wC9m/56dCyCmiqB/QjNTpMqL88Dfo5mE0/aQr6pEjqRfCxIHI
6POal8ppAkEAyPTqaSZxkPwZkJ4tgKlvfIi3XrybbY5E1q1u3kI6L8KY2/YlagaA
o60thbgUEQNlRjfgelTB/Rg9HuAua8RvgwJAX0a2GNtHfjlBIEeKPUNm7oe/4nRO
/XJfRRKV15mitkThfjVSbf0pAR6dP1tfnpTx9uXygh1RUDK/3MKVlAw0WwJAFhK1
W0S5Ge1eDIaVAB1mAvzJHLQTa4MzQDMWf7h/bXvd3I6vcUPZ8vg5ZDpLjooGP3H2
mJArAOTWMiqIiB/XJwJBAJro6e0qo2htUParsFteTxze4/1aGcdVrBwntPlc1uvD
Ri9aVGOnBdrTrVsOxzXSa6NcfNxqo90po6FGvHtknBE=
-----END RSA PRIVATE KEY-----Now, with this info we can set your new host:
Code
cd /var/lib/tor/hidden_service/
echo "lolaklefegf7caci.onion" > hostname
echo "" > private_key; nano private_key;now paste the key Shallot gave you into the private_key file and restart tor.
Code
service tor restart
* Stopping tor daemon... [ OK ]
* Starting tor daemon... [ OK ]Open TOR browser and direct it to your new host: lolaklefegf7caci.onion
You should see your "Welcome to nginx!" message again.
Conclusion
Hopefully this tutorial helped you, if you have any questions on how or why this setup works, please don't hesitate to post below.
-Lrrr



![[Image: cfc35703b91c3cb46ebeea5feec926ab.png]](https://i.gyazo.com/cfc35703b91c3cb46ebeea5feec926ab.png)
![[Image: fb52375845339da580933fdb5bb13635.png]](https://i.gyazo.com/fb52375845339da580933fdb5bb13635.png)
![[Image: 952695eb668af013c23628cb3b5c9f35.png]](https://i.gyazo.com/952695eb668af013c23628cb3b5c9f35.png)


