blob: dce48af64efd5145e03da2f4bbadcfdf1059ef26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#! /bin/sh
# BACKEND_PORT is set by `docker run --link BACKEND:foo' on the form
# tcp://<ip>:<port>. 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
|