2016-06-24 22:26:57 +00:00
|
|
|
#
|
|
|
|
# Dockerfile for the Private Tor Network
|
|
|
|
#
|
|
|
|
# This is a dockerfile to build a Debian host and
|
|
|
|
# compile a version of tor from the Tor apt repos.
|
|
|
|
# NOTE: This is a modification of chriswayg's solid
|
|
|
|
# base.
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
# This works best using a docker compose command so you can run the
|
|
|
|
# necessary other servers for it to talk to. But if you want o run
|
|
|
|
# manually:
|
|
|
|
#
|
|
|
|
# docker run --rm -it -e ROLE=DA antitree/tor-server /bin/bash
|
|
|
|
|
|
|
|
FROM debian:jessie
|
|
|
|
MAINTAINER Antitree antitree@protonmail.com
|
|
|
|
|
2016-07-09 23:38:08 +00:00
|
|
|
# Sets which version of tor to use. See the Tor Projects git page for available tags
|
|
|
|
# Examples:
|
|
|
|
# * tor-0.2.8.4-rc
|
|
|
|
# * tor-0.2.7.6
|
|
|
|
# * tor-0.2.7.5
|
|
|
|
# * release-0.2.1
|
2017-07-09 00:08:06 +00:00
|
|
|
ENV TOR_VER="release-0.2.5"
|
2016-07-14 00:41:55 +00:00
|
|
|
#ENV TOR_VER="master"
|
|
|
|
# NOTE sometimes the master branch doesn't compile so I'm sticking with the release
|
|
|
|
# feel free to change this to master to get the latest and greatest
|
2016-07-09 23:38:08 +00:00
|
|
|
|
2016-06-24 22:26:57 +00:00
|
|
|
# Sets the nickname if you didn't set one, default ports, and the path
|
|
|
|
# where to mount the key material used by the clients.
|
2016-07-09 23:38:08 +00:00
|
|
|
ENV TERM=xterm \
|
2016-06-24 22:26:57 +00:00
|
|
|
TOR_ORPORT=7000 \
|
|
|
|
TOR_DIRPORT=9030 \
|
|
|
|
TOR_DIR=/tor
|
|
|
|
|
2016-07-03 17:36:43 +00:00
|
|
|
# Install build dependencies
|
|
|
|
RUN apt-get update && \
|
2016-07-29 00:35:40 +00:00
|
|
|
build_temps="build-essential automake" && \
|
2016-07-29 01:33:54 +00:00
|
|
|
build_deps="libssl-dev zlib1g-dev libevent-dev ca-certificates\
|
2016-07-03 17:36:43 +00:00
|
|
|
dh-apparmor libseccomp-dev dh-systemd \
|
|
|
|
git" && \
|
2016-07-29 01:33:54 +00:00
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install $build_deps $build_temps \
|
2016-06-24 22:26:57 +00:00
|
|
|
init-system-helpers \
|
2016-07-10 00:55:18 +00:00
|
|
|
pwgen && \
|
|
|
|
mkdir /src && \
|
2016-07-03 17:36:43 +00:00
|
|
|
cd /src && \
|
|
|
|
git clone https://git.torproject.org/tor.git && \
|
|
|
|
cd tor && \
|
2016-07-10 00:55:18 +00:00
|
|
|
git checkout ${TOR_VER} && \
|
2016-07-10 00:34:04 +00:00
|
|
|
./autogen.sh && \
|
2016-07-03 17:36:43 +00:00
|
|
|
./configure --disable-asciidoc && \
|
|
|
|
make && \
|
|
|
|
make install && \
|
2016-07-29 00:35:40 +00:00
|
|
|
apt-get -y purge --auto-remove $build_temps && \
|
2016-07-03 17:36:43 +00:00
|
|
|
apt-get clean && rm -r /var/lib/apt/lists/* && \
|
|
|
|
rm -rf /src/*
|
2016-06-24 22:26:57 +00:00
|
|
|
|
|
|
|
# Copy the base tor configuration file
|
|
|
|
COPY ./config/torrc* /etc/tor/
|
|
|
|
|
|
|
|
# Copy docker-entrypoint and the fingerprint script
|
|
|
|
COPY ./scripts/ /usr/local/bin/
|
|
|
|
|
|
|
|
# Persist data (Usually don't want this)
|
|
|
|
#VOLUME /etc/tor /var/lib/tor
|
|
|
|
|
|
|
|
# Create the shared directory
|
|
|
|
RUN mkdir ${TOR_DIR}
|
|
|
|
|
|
|
|
# ORPort, DirPort, ObfsproxyPort
|
|
|
|
# TODO make these match the env variables
|
|
|
|
# TODO is this necessary anymore?
|
2016-07-02 23:30:48 +00:00
|
|
|
EXPOSE 9001 9030 9051
|
2016-06-24 22:26:57 +00:00
|
|
|
|
|
|
|
ENTRYPOINT ["docker-entrypoint"]
|
|
|
|
|
|
|
|
CMD ["tor", "-f", "/etc/tor/torrc"]
|