Skip to content

EJTheSnail/heroku-buildpack-tor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This fork is retired and no longer receiving updates.

heroku-buildpack-tor

This buildpack sets up a Tor v3 onion service for your application on Heroku. v2 has been disabled as of 2021.

I will be regularly and manually updating the Tor version and my doing so may require you to clear your build cache upon your next git push for your application. Easy instructions can be found here. This is in order to stay current with Tor's bugfixes and patches.

Disclaimer

This buildpack is meant for hobbyists and is not intended for use involving any serious requirement of anonymity. If you are deploying for any such purpose, please look into other sources and methods.

Simplest, easiest way to get running

  1. Install the buildpack like you would with any other buildpack

  2. Modify your Procfile as follows:

    web: ./tor/bin/run_tor & <your-usual-dyno-cmd>
    
  3. Deploy your application

  4. Run heroku logs --tail to see the .onion address you generated; with this setup the address will change with each redeploy, but the next section will explain how to set up a persistent address

To set your own permanent v3 .onion address

  1. Obtain the following files for a .onion address by using mkp224o
    • hostname
    • hs_ed25519_public_key
    • hs_ed25519_secret_key
  2. Create a new environment variable for your application in Heroku
    • Key: ONION_LOCATION
    • Value: the .onion address inside the hostname file
  3. Create a config directory in your application's root folder
  4. Copy and paste your hs_ed25519_public_key and hs_ed25519_secret_key files into this new config directory
  5. Create a torrc.erb file in the config directory and ensure HiddenServiceDir has the value /app/onion-service/ (example)
  6. Modify your Procfile as outlined in the previous section if you haven't yet done so
  7. Deploy your application

To use free .herokuapp.com domain

The free .herokuapp.com domain automatically redirects to HTTPS, which will normally break your visit to your onionsite, but you can use a custom port to circumvent this.

Add the following to your torrc.erb (referred to above):

HiddenServicePort <pick-a-port> 127.0.0.1:<your-port>

Your onionsite should then be available at yourv3onionaddress.onion:your-port

Miscellaneous

If you get stuck, jtschoonhoven's fork and associated Medium story provide related and much more in-depth tutorials. Most of the instructions there apply except for those specific to v2 .onion addresses, regarding private_key. I've updated those for v3 .onion addresses here.

About

Run a Tor v3 onion service on Heroku

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 94.0%
  • HTML 6.0%