From a8126b37d4ef973092c1adf4d8238509de21542b Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Tue, 26 May 2015 15:18:54 +0200 Subject: Initial commit. --- onion/start.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 onion/start.sh (limited to 'onion/start.sh') diff --git a/onion/start.sh b/onion/start.sh new file mode 100644 index 0000000..dce48af --- /dev/null +++ b/onion/start.sh @@ -0,0 +1,20 @@ +#! /bin/sh + +# BACKEND_PORT is set by `docker run --link BACKEND:foo' on the form +# tcp://:. See https://docs.docker.com/userguide/dockerlinks/. + +if [ -n "${HSPORT}" ]; then + HSPORT=80 # Default localhost:80 -> .onion:80 + if [ -n "${BACKEND_PORT}" ]; then + HSPORT="80 "$(echo ${BACKEND_PORT} | sed 's|^.*://||1') + fi +fi + +if ! [ -e /etc/tor/torrc ]; then + echo "SocksPort 0" >> /etc/tor/torrc + echo "DataDirectory /var/lib/tor" >> /etc/tor/torrc + echo "HiddenServiceDir /var/lib/tor/hs" >> /etc/tor/torrc + echo "HiddenServicePort ${HSPORT}" >> /etc/tor/torrc +fi + +/usr/bin/tor -f /etc/tor/torrc --user debian-tor -- cgit v1.1