Skip to content

Commit

Permalink
update readme and fix dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxor committed Mar 23, 2024
1 parent 324ec7a commit 50edc5c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 37 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# tor-simple
tor + pluggable transports

## Tags

* `ubuntu_rolling_*_tor_*_obfs4proxy_*_webtunnel_*_snowflake_*` (The `ubuntu:rolling` tag points to the latest release (regardless of LTS status).)
* `ubuntu_lts_*_tor_*_obfs4proxy_*` (The `ubuntu:latest` tag points to the "latest LTS", since that's the version recommended for general use.)

## See also

* https://hub.docker.com/_/ubuntu
* https://git.torproject.org
* https://gitlab.com/yawning/obfs4
* https://github.com/osminogin/docker-tor-simple
10 changes: 5 additions & 5 deletions ubuntu_lts_repo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ ARG VERSION

RUN apt-get update && \
apt-get install -y curl tor tor-geoipdb obfs4proxy && \
# cleanup
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
# check versions
tor_version=$(apt-cache madison tor | awk '{print $3; exit}') && \
obfs4proxy_version=$(apt-cache madison obfs4proxy | awk '{print $3; exit}') && \
ubuntu_version=$(cat /etc/os-release | grep VERSION_ID | awk -F '"' '{print $2}') && \
actualVersion="ubuntu_lts_${ubuntu_version}_tor_${tor_version}_obfs4proxy_${obfs4proxy_version}" && \
if [ "$actualVersion" != "$VERSION" ]; then echo "Version mismatch: expected $VERSION, got $actualVersion" && exit 1; fi
if [ "$actualVersion" != "$VERSION" ]; then echo "Version mismatch: argument $VERSION, actual $actualVersion" && exit 1; fi && \
# cleanup
apt-get clean && \
rm -rf /var/lib/apt/lists/*

EXPOSE 9050

HEALTHCHECK --interval=60s --timeout=15s --start-period=20s \
CMD curl -s --socks5 127.0.0.1:9050 'https://check.torproject.org/' | grep -qm1 Congratulations
CMD curl -x socks5h://127.0.0.1:9050 'https://check.torproject.org/api/ip' | grep -qm1 -E '"IsTor"\s*:\s*true'

VOLUME ["/var/lib/tor"]
CMD ["tor"]
34 changes: 16 additions & 18 deletions ubuntu_rolling_sources/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ ARG VERSION

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y golang git build-essential automake libevent-dev libssl-dev zlib1g-dev && \
apt-get install -y golang git build-essential automake libevent-dev libssl-dev zlib1g-dev libzstd-dev liblzma-dev curl libc6 libcap2 liblzma5 libseccomp2 libssl3 libsystemd0 libzstd1 zlib1g adduser lsb-base && \
echo go version && \
mkdir -p ~/git && \
# build tor
cd ~/git && \
git clone https://gitlab.torproject.org/tpo/core/tor.git && \
git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/webtunnel.git && \
git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git && \
git clone https://gitlab.com/yawning/obfs4.git && \
# build tor
cd ~/git/tor && \
git fetch --tags && \
torLatestTag=$(git describe --tags "$(git rev-list --tags --max-count=1)") && \
Expand All @@ -24,26 +27,20 @@ RUN apt-get update && \
make && \
make install && \
# build webtunnel
cd ~/git && \
git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/webtunnel.git && \
cd ~/git/webtunnel/main/client && \
webtunnelCommitHash=$(git rev-parse --short HEAD) && \
go get && \
go build && \
cp client /usr/bin/webtunnel && \
chmod +x /usr/bin/webtunnel && \
# build snowflake
cd ~/git && \
git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git && \
cd ~/git/snowflake/client && \
snowflakeCommitHash=$(git rev-parse --short HEAD) && \
go get && \
go build && \
cp client /usr/bin/snowflake && \
chmod +x /usr/bin/snowflake && \
# build obfs4proxy
cd ~/git && \
git clone https://gitlab.com/yawning/obfs4.git && \
cd ~/git/obfs4 && \
git fetch --tags && \
obfs4LatestTag=$(git describe --tags "$(git rev-list --tags --max-count=1)") && \
Expand All @@ -53,27 +50,28 @@ RUN apt-get update && \
go build && \
cp obfs4proxy /usr/bin/obfs4proxy && \
chmod +x /usr/bin/obfs4proxy && \
# add torrc file
sed "1s/^/SocksPort 0.0.0.0:9050\n/" /usr/local/etc/tor/torrc.sample > /usr/local/etc/tor/torrc && \
# check versions
ubuntu_version=$(cat /etc/os-release | grep VERSION_ID | awk -F '"' '{print $2}') && \
torLatestTag=$(echo $torLatestTag | sed 's/.*-//') && \
obfs4LatestTag=$(echo $obfs4LatestTag | sed 's/.*-//') && \
actualVersion="ubuntu_rolling_${ubuntu_version}_tor_${torLatestTag}_obfs4proxy_${obfs4LatestTag}_webtunnel_${webtunnelCommitHash}_snowflake_${snowflakeCommitHash}" && \
if [ "$actualVersion" != "$VERSION" ]; then echo "Version mismatch: argument $VERSION, actual $actualVersion" && exit 1; fi && \
# cleanup
go clean -modcache -cache -testcache -fuzzcache && \
rm -rf ~/go && \
rm -rf ~/.cache && \
apt-get remove -y golang git build-essential automake libevent-dev libssl-dev zlib1g-dev && \
apt-get remove -y golang git build-essential automake libssl-dev zlib1g-dev libzstd-dev liblzma-dev && \
apt-get autoremove -y && \
apt-get install -y libc6 libcap2 libevent-dev liblzma5 libseccomp2 libssl3 libsystemd0 libzstd1 zlib1g adduser lsb-base && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf ~/git && \
# check versions
ubuntu_version=$(cat /etc/os-release | grep VERSION_ID | awk -F '"' '{print $2}') && \
torLatestTag=$(echo $torLatestTag | sed 's/.*-//') && \
obfs4LatestTag=$(echo $obfs4LatestTag | sed 's/.*-//') && \
actualVersion="ubuntu_rolling_${ubuntu_version}_tor_${torLatestTag}_obfs4proxy_${obfs4LatestTag}_webtunnel_${webtunnelCommitHash}_snowflake_${snowflakeCommitHash}" && \
if [ "$actualVersion" != "$VERSION" ]; then echo "Version mismatch: expected $VERSION, got $actualVersion" && exit 1; fi
rm -rf ~/git

EXPOSE 9050

HEALTHCHECK --interval=60s --timeout=15s --start-period=20s \
CMD curl -s --socks5 127.0.0.1:9050 'https://check.torproject.org/' | grep -qm1 Congratulations
CMD curl -x socks5h://127.0.0.1:9050 'https://check.torproject.org/api/ip' | grep -qm1 -E '"IsTor"\s*:\s*true'

VOLUME ["/var/lib/tor"]
CMD ["tor"]
24 changes: 10 additions & 14 deletions ubuntu_rolling_sources/VersionInfo.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,34 @@ FROM ubuntu:rolling
RUN apt-get update && \
apt-get install -y git && \
mkdir -p ~/git && \
# get tor
cd ~/git && \
git clone https://gitlab.torproject.org/tpo/core/tor.git && \
git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/webtunnel.git && \
git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git && \
git clone https://gitlab.com/yawning/obfs4.git && \
# get tor
cd ~/git/tor && \
git fetch --tags && \
torLatestTag=$(git describe --tags "$(git rev-list --tags --max-count=1)") && \
# get webtunnel
cd ~/git && \
git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/webtunnel.git && \
cd ~/git/webtunnel/main/client && \
webtunnelCommitHash=$(git rev-parse --short HEAD) && \
# get snowflake
cd ~/git && \
git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git && \
cd ~/git/snowflake/ && \
snowflakeCommitHash=$(git rev-parse --short HEAD) && \
# get obfs4proxy
cd ~/git && \
git clone https://gitlab.com/yawning/obfs4.git && \
cd ~/git/obfs4 && \
git fetch --tags && \
obfs4LatestTag=$(git describe --tags "$(git rev-list --tags --max-count=1)") && \
# write version info
ubuntu_version=$(cat /etc/os-release | grep VERSION_ID | awk -F '"' '{print $2}') && \
torLatestTag=$(echo $torLatestTag | sed 's/.*-//') && \
obfs4LatestTag=$(echo $obfs4LatestTag | sed 's/.*-//') && \
echo "ubuntu_rolling_${ubuntu_version}_tor_${torLatestTag}_obfs4proxy_${obfs4LatestTag}_webtunnel_${webtunnelCommitHash}_snowflake_${snowflakeCommitHash}" > /version.txt && \
# cleanup
apt-get remove -y git && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf ~/git && \
# write version info
ubuntu_version=$(cat /etc/os-release | grep VERSION_ID | awk -F '"' '{print $2}') && \
torLatestTag=$(echo $torLatestTag | sed 's/.*-//') && \
obfs4LatestTag=$(echo $obfs4LatestTag | sed 's/.*-//') && \
echo "ubuntu_rolling_${ubuntu_version}_tor_${torLatestTag}_obfs4proxy_${obfs4LatestTag}_webtunnel_${webtunnelCommitHash}_snowflake_${snowflakeCommitHash}" > /version.txt
rm -rf ~/git

CMD cat /version.txt

0 comments on commit 50edc5c

Please sign in to comment.