Docker tor hiddenservice nginx

Docker tor hiddenservice nginx

Easily run a hidden service inside the Tor network with this container

Generate the skeleton configuration for you hidden service, replace for your hidden service pattern name. Example, if you want to your hidden service contain the word 'boss', just use this word as argument. You can use regular expressions, like ^boss, will generate an address wich will start with 'boss'. Be aware that bigger the pattern, more time it will take to generate it.

docker run -it --rm -v $(pwd)/web:/web \
       strm/tor-hiddenservice-nginx generate <pattern>

Create an container named 'hiddensite' to serve your generated hidden service

docker run -d --restart=always --name hiddensite -v $(pwd)/web:/web \

Let's create a hidden service with the name beginning with strm.

docker pull strm/tor-hiddenservice-nginx

Wait to the container image be downloaded. And them we can generate our site skeleton:

$docker run -it --rm -v $(pwd)/web:/web strm/tor-hiddenservice-nginx generate ^strm
[+] Generating the address with mask: ^strm
[+] Found matching domain after 137072 tries: strmfyygjp5st54g.onion
[+] Generating nginx configuration for site  strmfyygjp5st54g.onion
[+] Creating www folder
[+] Generating index.html template

Now we have our skeleton generated, we can run the container with:

docker run -d --restart=always --name hiddensite \
       -v $(pwd)/web:/web strm/tor-hiddenservice-nginx

And you have the service running ! :)

  • 403 error on nginx, check your directory permissions and folder permissions. Nginx run as "hidden" user, his UID is 666, just check if you give this user access to the /web/www folder (in the case the folder mapped to it).

While is not a good thing to run everything in one container, this is a easy way to get started if you don't have that much experience with docker and hidden services. If you want to use something more elaborated, check this repository.

Here is an example of how a deploy using this other image looks like.

version: '3'

    image: strm/tor
    restart: always
      - backend
        LISTEN_PORT: "80"
        REDIRECT: "backend:80"
        PRIVATE_KEY: |
          -----BEGIN RSA PRIVATE KEY-----
          -----END RSA PRIVATE KEY-----

To make it work you should also add a webserver with the name backend, and add your content there. There are more moving pieces using a deploy like this, so this is the justification for this repository, for people who never put anything on the deep web being able to enjoy it without busting their asses debugging some infrastructure.

docker build -t strm/tor-hiddenservice-nginx .

docker run -d --restart=always --name hiddensite \
       -v $(pwd)/web:/web strm/tor-hiddenservice-nginx

docker run -it --rm -v $(pwd)/web:/web \
       --entrypoint /bin/bash strm/tor-hiddenservice-nginx

Last updated