Skip to content

Commit 6c1b1f2

Browse files
committed
Tor 0.4.8.10
1 parent 6340c05 commit 6c1b1f2

File tree

4 files changed

+343
-0
lines changed

4 files changed

+343
-0
lines changed

Tor/0.4.8.10/docker-entrypoint.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
set -e
3+
4+
mkdir -p "$(dirname $TOR_CONFIG)"
5+
6+
mkdir -p "$TOR_DATA"
7+
chown -R tor "$TOR_DATA"
8+
chmod 700 "$TOR_DATA"
9+
10+
mkdir -p "/var/lib/tor/hidden_services"
11+
chown -R tor /var/lib/tor/hidden_services
12+
chmod 700 /var/lib/tor/hidden_services
13+
14+
cat <<-EOF > "$TOR_CONFIG"
15+
ControlPort 0.0.0.0:9051
16+
SOCKSPort 0.0.0.0:9050
17+
${TOR_EXTRA_ARGS}
18+
EOF
19+
20+
if ! [ -z "${TOR_ADDITIONAL_CONFIG}" ]; then
21+
echo "%include $TOR_ADDITIONAL_CONFIG" >> "$TOR_CONFIG"
22+
echo "" >> "$TOR_ADDITIONAL_CONFIG"
23+
echo "Added '%include $TOR_ADDITIONAL_CONFIG' to tor config"
24+
fi
25+
26+
chown -R tor "$(dirname $TOR_CONFIG)"
27+
28+
if ! [ -z "${TOR_PASSWORD}" ]; then
29+
TOR_PASSWORD_HASH="$(gosu tor tor --hash-password "$TOR_PASSWORD")"
30+
echo "HashedControlPassword $TOR_PASSWORD_HASH" >> "$TOR_CONFIG"
31+
echo "'HashedControlPassword $TOR_PASSWORD_HASH' added to tor config"
32+
fi
33+
34+
exec gosu tor "$@"

Tor/0.4.8.10/linuxamd64.Dockerfile

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Thanks to https://hub.docker.com/r/chriswayg/tor-alpine/dockerfile (Christian [email protected])
2+
# Dockerfile for Tor Relay Server with obfs4proxy (Multi-Stage build)
3+
4+
FROM debian:bookworm-slim AS tor-build
5+
ENV TOR_VERSION=0.4.8.10
6+
ENV TOR_HASH=e628b4fab70edb4727715b23cf2931375a9f7685ac08f2c59ea498a178463a86
7+
8+
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates perl autoconf automake build-essential git libtool python3 wget gnupg dirmngr git pkg-config
9+
10+
ENV QEMU_LD_PREFIX=/usr/libs
11+
12+
RUN wget -q https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz \
13+
&& TAR_NAME=zlib-1.3.tar.gz \
14+
&& FOLDER_NAME=zlib-1.3 \
15+
&& echo "ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e $TAR_NAME" | sha256sum -c - \
16+
&& tar xvf $TAR_NAME \
17+
&& cd $FOLDER_NAME \
18+
&& ./configure \
19+
&& make \
20+
&& make install && cd .. && rm $TAR_NAME && rm -rf $FOLDER_NAME
21+
22+
RUN wget -q https://github.com/openssl/openssl/releases/download/openssl-3.0.12/openssl-3.0.12.tar.gz \
23+
&& mkdir /usr/openssl \
24+
&& TAR_NAME=openssl-3.0.12.tar.gz \
25+
&& FOLDER_NAME=openssl-3.0.12 \
26+
&& echo "f93c9e8edde5e9166119de31755fc87b4aa34863662f67ddfcba14d0b6b69b61 $TAR_NAME" | sha256sum -c - \
27+
&& tar xvf $TAR_NAME \
28+
&& cd $FOLDER_NAME \
29+
&& ./Configure no-dso no-zlib no-asm \
30+
&& make \
31+
&& make install && cd .. && rm $TAR_NAME && rm -rf $FOLDER_NAME
32+
33+
RUN wget -q https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz \
34+
&& TAR_NAME=libevent-2.1.12-stable.tar.gz \
35+
&& FOLDER_NAME=libevent-2.1.12-stable \
36+
&& echo "92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb $TAR_NAME" | sha256sum -c - \
37+
&& tar xvf $TAR_NAME \
38+
&& cd $FOLDER_NAME \
39+
&& ./autogen.sh \
40+
&& ./configure --disable-shared --with-pic --disable-samples --disable-libevent-regress \
41+
&& make \
42+
&& make install && cd .. && rm $TAR_NAME && rm -rf $FOLDER_NAME
43+
44+
# Install Tor from source, incl. GeoIP files (get latest release version number from Tor ReleaseNotes)
45+
RUN TOR_TARBALL_NAME="tor-${TOR_VERSION}.tar.gz" \
46+
&& TOR_TARBALL_LINK="https://dist.torproject.org/${TOR_TARBALL_NAME}" \
47+
&& wget -q $TOR_TARBALL_LINK \
48+
&& echo "${TOR_HASH} ${TOR_TARBALL_NAME}" | sha256sum -c - \
49+
&& tar xf $TOR_TARBALL_NAME \
50+
&& cd tor-$TOR_VERSION \
51+
&& ./configure \
52+
--disable-zstd --disable-lzma \
53+
--disable-systemd --disable-seccomp --disable-unittests --disable-tool-name-check \
54+
&& make install \
55+
&& ls -R /usr/local/ \
56+
&& strip /usr/local/bin/tor-* && strip /usr/local/bin/tor
57+
# Main files created (plus docs):
58+
# /usr/local/bin/tor
59+
# /usr/local/bin/tor-gencert
60+
# /usr/local/bin/tor-resolve
61+
# /usr/local/bin/torify
62+
# /usr/local/share/tor/geoip
63+
# /usr/local/share/tor/geoip6
64+
# /usr/local/etc/tor/torrc.sample
65+
66+
WORKDIR /tmp/bin
67+
RUN wget -qO gosu "https://github.com/tianon/gosu/releases/download/1.13/gosu-amd64" \
68+
&& echo "6f333f520d31e212634c0777213a5d4f8f26bba1ab4b0edbbdf3c8bff8896ecf gosu" | sha256sum -c -
69+
70+
FROM debian:bookworm-slim
71+
72+
ENV TOR_VERSION=0.4.8.10
73+
74+
# Copy Tor
75+
COPY --from=tor-build "/tmp/bin" /usr/local/bin
76+
COPY --from=tor-build /usr/local/ /usr/local/
77+
78+
ENV TOR_DATA /home/tor/.tor
79+
80+
RUN chmod +x /usr/local/bin/gosu && groupadd -r tor && useradd -r -m -g tor tor && mkdir -p ${TOR_DATA} && chown -R tor:tor "$TOR_DATA" \
81+
&& cp -r /usr/local/lib64/* /usr/local/lib/ && ldconfig
82+
83+
VOLUME /home/tor/.tor
84+
COPY docker-entrypoint.sh /entrypoint.sh
85+
86+
# SOCKS5, TOR control
87+
EXPOSE 9050 9051
88+
ENV TOR_CONFIG=/usr/local/etc/tor/torrc
89+
90+
ENTRYPOINT ["./entrypoint.sh"]
91+
CMD ["tor"]
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
FROM debian:bookworm-slim as download
2+
3+
RUN set -ex \
4+
&& apt-get update \
5+
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr wget \
6+
qemu-user-static binfmt-support
7+
8+
WORKDIR /tmp/bin
9+
RUN wget -qO gosu "https://github.com/tianon/gosu/releases/download/1.13/gosu-armhf" \
10+
&& echo "33e421b84b3f746e7353ac2e7c9f199c5beef5a3b2b7a013b591a9af25d84919 gosu" | sha256sum -c -
11+
12+
FROM debian:bookworm-slim as tor-build
13+
14+
ENV TOR_VERSION=0.4.8.10
15+
ENV TOR_HASH=e628b4fab70edb4727715b23cf2931375a9f7685ac08f2c59ea498a178463a86
16+
17+
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates perl autoconf automake build-essential git libtool python3 wget gnupg dirmngr git pkg-config \
18+
libc6-armhf-cross gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
19+
20+
ENV target_host=arm-linux-gnueabihf
21+
22+
ENV AR=${target_host}-ar \
23+
AS=${target_host}-as \
24+
CC=${target_host}-gcc \
25+
CXX=${target_host}-g++ \
26+
LD=${target_host}-ld \
27+
STRIP=${target_host}-strip \
28+
QEMU_LD_PREFIX=/usr/${target_host} \
29+
HOST=${target_host}
30+
31+
# See dependency versions on https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/blob/main/projects
32+
33+
RUN wget -q https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz \
34+
&& TAR_NAME=zlib-1.3.tar.gz \
35+
&& FOLDER_NAME=zlib-1.3 \
36+
&& echo "ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e $TAR_NAME" | sha256sum -c - \
37+
&& tar xvf $TAR_NAME \
38+
&& cd $FOLDER_NAME \
39+
&& ./configure --prefix=$QEMU_LD_PREFIX \
40+
&& make \
41+
&& make install && cd .. && rm $TAR_NAME && rm -rf $FOLDER_NAME
42+
43+
RUN wget -q https://github.com/openssl/openssl/releases/download/openssl-3.0.12/openssl-3.0.12.tar.gz \
44+
&& TAR_NAME=openssl-3.0.12.tar.gz \
45+
&& FOLDER_NAME=openssl-3.0.12 \
46+
&& echo "f93c9e8edde5e9166119de31755fc87b4aa34863662f67ddfcba14d0b6b69b61 $TAR_NAME" | sha256sum -c - \
47+
&& tar xvf $TAR_NAME \
48+
&& cd $FOLDER_NAME \
49+
&& ./Configure --prefix=$QEMU_LD_PREFIX linux-armv4 -march=armv7+fp no-dso no-zlib no-asm \
50+
&& make \
51+
&& make install && cd .. && rm $TAR_NAME && rm -rf $FOLDER_NAME
52+
53+
RUN wget -q https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz \
54+
&& TAR_NAME=libevent-2.1.12-stable.tar.gz \
55+
&& FOLDER_NAME=libevent-2.1.12-stable \
56+
&& echo "92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb $TAR_NAME" | sha256sum -c - \
57+
&& tar xvf $TAR_NAME \
58+
&& cd $FOLDER_NAME \
59+
&& ./autogen.sh \
60+
&& ./configure --prefix=$QEMU_LD_PREFIX --host=${target_host} --with-pic --disable-samples --disable-libevent-regress \
61+
&& make \
62+
&& make install && cd .. && rm $TAR_NAME && rm -rf $FOLDER_NAME
63+
64+
# https://trac.torproject.org/projects/tor/ticket/27802
65+
RUN wget -q https://dist.torproject.org/tor-${TOR_VERSION}.tar.gz \
66+
&& TAR_NAME=tor-${TOR_VERSION}.tar.gz \
67+
&& FOLDER_NAME=tor-${TOR_VERSION} \
68+
&& echo "${TOR_HASH} $TAR_NAME" | sha256sum -c - \
69+
&& tar xvf $TAR_NAME \
70+
&& cd $FOLDER_NAME \
71+
&& ./configure --prefix=$QEMU_LD_PREFIX --host=${target_host} --disable-gcc-hardening --disable-asciidoc \
72+
--disable-zstd --disable-lzma \
73+
--with-libevent-dir="$QEMU_LD_PREFIX" \
74+
--with-openssl-dir="$QEMU_LD_PREFIX" \
75+
--with-zlib-dir="$QEMU_LD_PREFIX" \
76+
--disable-systemd --disable-seccomp --disable-unittests --disable-tool-name-check \
77+
--sysconfdir=/usr/local/etc \
78+
&& make \
79+
&& make install && cd .. && rm $TAR_NAME && rm -rf $FOLDER_NAME \
80+
&& ${STRIP} /usr/arm-linux-gnueabihf/bin/tor-* && ${STRIP} /usr/arm-linux-gnueabihf/bin/tor
81+
82+
FROM arm32v7/debian:bookworm-slim
83+
ENV target_host=arm-linux-gnueabihf
84+
ENV QEMU_LD_PREFIX=/usr/${target_host}
85+
86+
COPY --from=download /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
87+
COPY --from=download "/tmp/bin" /usr/local/bin
88+
COPY --from=tor-build ${QEMU_LD_PREFIX}/bin/tor* /usr/bin/
89+
COPY --from=tor-build ${QEMU_LD_PREFIX} /usr/local/
90+
COPY --from=tor-build ${QEMU_LD_PREFIX}/share/tor/ ${QEMU_LD_PREFIX}/share/tor/
91+
92+
ENV TOR_DATA /home/tor/.tor
93+
RUN chmod +x /usr/local/bin/gosu && groupadd -r tor && useradd -r -m -g tor tor && \
94+
mkdir -p ${TOR_DATA} && chown -R tor:tor "$TOR_DATA" && \
95+
rm -rf /lib/arm-linux-gnueabihf/libz* && ldconfig
96+
97+
VOLUME /home/tor/.tor
98+
99+
COPY docker-entrypoint.sh /entrypoint.sh
100+
101+
# SOCKS5, TOR control
102+
EXPOSE 9050 9051
103+
ENV TOR_CONFIG=/usr/local/etc/tor/torrc
104+
105+
RUN rm -rf /usr/arm-linux-gnueabihf/etc/tor \
106+
&& mkdir -p /usr/arm-linux-gnueabihf/etc \
107+
&& mkdir -p /usr/local/etc/tor \
108+
&& ln -sfn /usr/local/etc/tor /usr/arm-linux-gnueabihf/etc/tor
109+
110+
ENTRYPOINT ["./entrypoint.sh"]
111+
CMD ["tor"]
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
FROM debian:bookworm-slim as download
2+
3+
RUN set -ex \
4+
&& apt-get update \
5+
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr wget \
6+
qemu-user-static binfmt-support
7+
8+
WORKDIR /tmp/bin
9+
RUN wget -qO gosu "https://github.com/tianon/gosu/releases/download/1.13/gosu-arm64" \
10+
&& echo "578b2c70936cae372f6826585f82e76de5858342dd179605a8cb58d58828a079 gosu" | sha256sum -c -
11+
12+
FROM debian:bookworm-slim as tor-build
13+
14+
ENV TOR_VERSION=0.4.8.10
15+
ENV TOR_HASH=e628b4fab70edb4727715b23cf2931375a9f7685ac08f2c59ea498a178463a86
16+
17+
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates perl autoconf automake build-essential git libtool python3 wget gnupg dirmngr git pkg-config \
18+
libc6-arm64-cross gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
19+
20+
ENV target_host=aarch64-linux-gnu
21+
22+
ENV AR=${target_host}-ar \
23+
AS=${target_host}-as \
24+
CC=${target_host}-gcc \
25+
CXX=${target_host}-g++ \
26+
LD=${target_host}-ld \
27+
STRIP=${target_host}-strip \
28+
QEMU_LD_PREFIX=/usr/${target_host} \
29+
HOST=${target_host}
30+
31+
# See dependency versions on https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/blob/main/projects
32+
RUN wget -q https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz \
33+
&& TAR_NAME=zlib-1.3.tar.gz \
34+
&& FOLDER_NAME=zlib-1.3 \
35+
&& echo "ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e $TAR_NAME" | sha256sum -c - \
36+
&& tar xvf $TAR_NAME \
37+
&& cd $FOLDER_NAME \
38+
&& ./configure --prefix=$QEMU_LD_PREFIX \
39+
&& make \
40+
&& make install && cd .. && rm $TAR_NAME && rm -rf $FOLDER_NAME
41+
42+
RUN wget -q https://github.com/openssl/openssl/releases/download/openssl-3.0.12/openssl-3.0.12.tar.gz \
43+
&& TAR_NAME=openssl-3.0.12.tar.gz \
44+
&& FOLDER_NAME=openssl-3.0.12 \
45+
&& echo "f93c9e8edde5e9166119de31755fc87b4aa34863662f67ddfcba14d0b6b69b61 $TAR_NAME" | sha256sum -c - \
46+
&& tar xvf $TAR_NAME \
47+
&& cd $FOLDER_NAME \
48+
&& ./Configure --prefix=$QEMU_LD_PREFIX linux-aarch64 no-shared no-dso no-zlib no-asm \
49+
&& make \
50+
&& make install && cd .. && rm $TAR_NAME && rm -rf $FOLDER_NAME
51+
52+
RUN wget -q https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz \
53+
&& TAR_NAME=libevent-2.1.12-stable.tar.gz \
54+
&& FOLDER_NAME=libevent-2.1.12-stable \
55+
&& echo "92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb $TAR_NAME" | sha256sum -c - \
56+
&& tar xvf $TAR_NAME \
57+
&& cd $FOLDER_NAME \
58+
&& ./autogen.sh \
59+
&& ./configure --prefix=$QEMU_LD_PREFIX --host=${target_host} --disable-shared --enable-static --with-pic --disable-samples --disable-libevent-regress \
60+
&& make \
61+
&& make install && cd .. && rm $TAR_NAME && rm -rf $FOLDER_NAME
62+
63+
# https://trac.torproject.org/projects/tor/ticket/27802
64+
RUN wget -q https://dist.torproject.org/tor-${TOR_VERSION}.tar.gz \
65+
&& TAR_NAME=tor-${TOR_VERSION}.tar.gz \
66+
&& FOLDER_NAME=tor-${TOR_VERSION} \
67+
&& echo "${TOR_HASH} $TAR_NAME" | sha256sum -c - \
68+
&& tar xvf $TAR_NAME \
69+
&& cd $FOLDER_NAME \
70+
&& LIBS="-lssl -lcrypto -lpthread -ldl" ./configure --prefix=$QEMU_LD_PREFIX --host=${target_host} --disable-gcc-hardening --disable-asciidoc \
71+
--enable-static-tor \
72+
--enable-static-libevent --with-libevent-dir=$QEMU_LD_PREFIX \
73+
--enable-static-openssl --with-openssl-dir=$QEMU_LD_PREFIX \
74+
--enable-static-zlib --with-zlib-dir=$QEMU_LD_PREFIX \
75+
--disable-zstd --disable-lzma \
76+
--disable-systemd --disable-seccomp --disable-unittests --disable-tool-name-check \
77+
--sysconfdir=/usr/local/etc \
78+
&& make \
79+
&& make install && cd .. && rm $TAR_NAME && rm -rf $FOLDER_NAME \
80+
&& ${STRIP} /usr/aarch64-linux-gnu/bin/tor-* && ${STRIP} /usr/aarch64-linux-gnu/bin/tor
81+
82+
FROM arm64v8/debian:bookworm-slim
83+
ENV target_host=aarch64-linux-gnu
84+
ENV QEMU_LD_PREFIX=/usr/${target_host}
85+
COPY --from=download /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
86+
COPY --from=download "/tmp/bin" /usr/local/bin
87+
COPY --from=tor-build /usr/aarch64-linux-gnu/bin/tor* /usr/bin/
88+
COPY --from=tor-build ${QEMU_LD_PREFIX}/share/tor/ ${QEMU_LD_PREFIX}/share/tor/
89+
90+
ENV TOR_DATA /home/tor/.tor
91+
RUN chmod +x /usr/local/bin/gosu && groupadd -r tor && useradd -r -m -g tor tor && mkdir -p ${TOR_DATA} && chown -R tor:tor "$TOR_DATA"
92+
93+
VOLUME /home/tor/.tor
94+
95+
COPY docker-entrypoint.sh /entrypoint.sh
96+
97+
# SOCKS5, TOR control
98+
EXPOSE 9050 9051
99+
ENV TOR_CONFIG=/usr/local/etc/tor/torrc
100+
101+
RUN rm -rf /usr/aarch64-linux-gnu/etc/tor \
102+
&& mkdir -p /usr/aarch64-linux-gnu/etc \
103+
&& mkdir -p /usr/local/etc/tor \
104+
&& ln -sfn /usr/local/etc/tor /usr/aarch64-linux-gnu/etc/tor
105+
106+
ENTRYPOINT ["./entrypoint.sh"]
107+
CMD ["tor"]

0 commit comments

Comments
 (0)