Skip to main content

Turn any Gunicorn application into a Tor Onion Service

Project description

Gunicorn Torify

Turn any Gunicorn server into a Tor Onion Service

Installation

It's available on PyPI! Just use pip to install

$ pip install gunicorn-torify

You must have Tor installed to use gunicorn-torify. This might look like

$ pacman -S tor    # Arch
$ apt install tor  # Debian/Ubuntu
$ apk add tor      # Alpine

Usage

Just add these imports to your Gunicorn config file (or create some python file such as ./gunicorn-conf.py with the line):

from gunicorn_torify import on_starting, on_exit

When starting Gunicorn, be sure to include the --config ./gunicorn-conf.py flag.

Persistence

By default, the Onion Service will store its secret keys in ./secrets/tor. To override this you can set the TOR_SERVICE_DIR environment variable before running for the first time. According to the tor docs this directory contains private keys and should be treated carefully.

If deploying in Docker, it's important to persist this directory (otherwise your onion address could change) either with a named volume or a mapped directory. An example deployment could be done with

$ docker volume create my-onion-service
$ docker run -v my-onion-service:/app/secrets/tor afiorillo/gunicorn-torify:flask

Contributing

To setup the development environment, it's convenient to use pyenv and the pyenv virtualenv plugin. For example

$ pyenv virtualenv 3.8.1 gunicorn-torify-3.8
$ pyenv activate gunicorn-torify-3.8
$ pip install -r requirements_dev.txt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gunicorn-torify-19.12.2710.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gunicorn_torify-19.12.2710-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file gunicorn-torify-19.12.2710.tar.gz.

File metadata

  • Download URL: gunicorn-torify-19.12.2710.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for gunicorn-torify-19.12.2710.tar.gz
Algorithm Hash digest
SHA256 f3a7f1ab2f88d725a6cb9ba7f89a0a073e8375248857ee5dc17aa466ab13a565
MD5 752fcebd4659c18d765766a3a15bc27d
BLAKE2b-256 492b30a62e2a4f50a98aff315a3e74fa68f15bb3b69aa775b587204f12f6d74b

See more details on using hashes here.

File details

Details for the file gunicorn_torify-19.12.2710-py3-none-any.whl.

File metadata

  • Download URL: gunicorn_torify-19.12.2710-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for gunicorn_torify-19.12.2710-py3-none-any.whl
Algorithm Hash digest
SHA256 8f98a5917f6e92a559ed6076e039cb1432c332dd30291f26cf21059a7d9348e5
MD5 2a1d19bec9c5b0870a9918b92dd5b3f8
BLAKE2b-256 d0e424c3e6d6db5a8b081018fb15e352762d17856434f1d9c6db2de746eb2674

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page