Compare commits

..

26 Commits

Author SHA1 Message Date
Fabian Peter Hammerle 9d8903fbee release v3.0.0 2020-10-03 17:29:06 +02:00
Fabian Peter Hammerle 8cc0734979 create mount point at data dir /var/lib/tor to be able to make container's root filesystem read-only
https://github.com/fphammerle/docker-tor-obfs4-bridge/commit/8d6514c2bda98488876f67116aa4c306a9dc28c2
https://github.com/fphammerle/docker-onion-service/commit/345840bda88620983bbf3d0f9a2975b561101ffc
2020-10-03 17:24:55 +02:00
Fabian Peter Hammerle 2778ba83d0 readme: split in sections 2020-10-03 17:12:58 +02:00
Fabian Peter Hammerle d12b5387bd readme / show circuit command: wrap, add quit command
https://github.com/fphammerle/docker-onion-service/commit/5cb7c809f30b2ac098bdf8530c9587dc659387ef
2020-10-03 11:03:34 +02:00
Fabian Peter Hammerle 97aca0c2c6 move tor's data directory to /var/lib/tor; run as user tor (uid=100)
https://github.com/fphammerle/docker-tor-obfs4-bridge/commit/8d6514c2bda98488876f67116aa4c306a9dc28c2
https://github.com/fphammerle/docker-onion-service/commit/345840bda88620983bbf3d0f9a2975b561101ffc
2020-10-03 10:52:34 +02:00
Fabian Peter Hammerle a28bf73885 ansible-playbook: drop capabilities 2020-10-03 10:36:54 +02:00
Fabian Peter Hammerle 1440258718 readme: added link to relay search 2020-09-27 09:04:02 +02:00
Fabian Peter Hammerle 7fb3c50db6 upgrade curl default package version 2020-09-27 08:53:39 +02:00
Fabian Peter Hammerle c44166f264 release v2.1.0 2020-09-27 08:47:11 +02:00
Fabian Peter Hammerle b0d0e8da22 docker-compose: drop capabilities 2020-09-27 08:45:20 +02:00
Fabian Peter Hammerle ef97bc410f healthcheck: remove circuit-established check via control port to avoid spamming container log
> [notice] New control connection opened from 127.0.0.1.
2020-09-26 22:56:19 +02:00
Fabian Peter Hammerle a4f7946ced enable control listener 2020-09-26 22:52:13 +02:00
Fabian Peter Hammerle dcb78b66c5 upgrade default tor version: 0.4.1.9 -> 0.4.3.5 2020-09-26 21:56:41 +02:00
Fabian Peter Hammerle 7bce89fedf fix DNS port in readme & sample playbook 2020-03-24 20:18:30 +01:00
Fabian Peter Hammerle 22dcf7e9f4 release v2.0.0 2020-03-24 20:14:53 +01:00
Fabian Peter Hammerle 95b977d216 run tor as unprivileged user; DNS port 53 -> 9053 (breaking)
> [warn] You are running Tor as root. You don't need to, and you probably shouldn't.
2020-03-24 20:08:49 +01:00
Fabian Peter Hammerle db4522974f fix invalid torrc path
introduced in 60bad462e4 (v1.1.0)

> [notice] Configuration file "/etc/tor/torrc" not present, using reasonable defaults.
2020-03-21 21:15:08 +01:00
Fabian Peter Hammerle cf5401be4e release v1.1.0 2020-03-21 21:04:32 +01:00
Fabian Peter Hammerle d2d2f4aaf7 reduce verbosity of entrypoint 2020-03-21 21:03:09 +01:00
Fabian Peter Hammerle 60bad462e4 change SocksTimeout by setting $SOCKS_TIMEOUT_SECONDS 2020-03-21 21:00:07 +01:00
Fabian Peter Hammerle 140ebf8e2e upgrade tor v0.4.1.7->0.4.1.9 (fixes CVE-2020-10592 & CVE-2020-10593) 2020-03-21 20:19:47 +01:00
Fabian Peter Hammerle e49b89c9d7 changelog: fix Unreleased diff link 2020-02-22 11:16:15 +01:00
Fabian Peter Hammerle d6f5c7c769 upgrade alpine 3.10->3.11 to upgrade tor 0.4.1.6->0.4.1.7 2020-02-22 11:07:00 +01:00
Fabian Peter Hammerle fbe6e32e39 readme: fix tags url 2020-02-22 10:49:49 +01:00
Fabian Peter Hammerle d76b221102 readme: fix sample curl command to no longer leak dns request 2020-02-21 10:43:35 +01:00
Fabian Peter Hammerle d75d6c74a5 readme: added iptables isolate cmd 2019-10-12 12:34:36 +02:00
8 changed files with 163 additions and 39 deletions
+41 -2
View File
@@ -4,9 +4,48 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [3.0.0] - 2020-10-03
### Added
- create mount point at `/var/lib/tor`
to be able to make container's root filesystem read-only
### Changed
- moved tor's data directory from `/home/onion/.tor` to `/var/lib/tor`
- run `tor` as user `tor` (uid=100) instead of `onion` (uid=101)
- docker-compose & ansible-playbook: read-only root filesystem
### Fixed
- ansible-playbook: drop capabilities
## [2.1.0] - 2020-09-27
### Added
- enable [tor control](https://gitweb.torproject.org/torspec.git/tree/control-spec.txt)
listener on port `9051`
(listening on loopback device only)
## [2.0.0] - 2020-03-24
### Changed
- changed DNS port from 53 to 9053
- run as unprivileged user
## [1.1.1] - 2020-03-21
### Fixed
- fix invalid torrc path
## [1.1.0] - 2020-03-21
### Added
- change `SocksTimeout` option by setting `$SOCKS_TIMEOUT_SECONDS`
## [1.0.0] - 2019-10-12
### Added
- Tor Socks5 & DNS proxy
- tor socks5 & DNS proxy
[Unreleased]: https://github.com/fphammerle/docker-tor-proxy/compare/1.0.0...HEAD
[Unreleased]: https://github.com/fphammerle/docker-tor-proxy/compare/v3.0.0...HEAD
[3.0.0]: https://github.com/fphammerle/docker-tor-proxy/compare/v2.1.0...v3.0.0
[2.1.0]: https://github.com/fphammerle/docker-tor-proxy/compare/v2.0.0...v2.1.0
[2.0.0]: https://github.com/fphammerle/docker-tor-proxy/compare/v1.1.1...v2.0.0
[1.1.1]: https://github.com/fphammerle/docker-tor-proxy/compare/v1.1.0...v1.1.1
[1.1.0]: https://github.com/fphammerle/docker-tor-proxy/compare/1.0.0...v1.1.0
[1.0.0]: https://github.com/fphammerle/docker-tor-proxy/releases/tag/1.0.0
+19 -16
View File
@@ -1,28 +1,31 @@
FROM alpine:3.10
FROM alpine:3.12
ARG CURL_PACKAGE_VERSION=7.66.0-r0
ARG BIND_TOOLS_PACKAGE_VERSION=9.14.3-r0
ARG TOR_PACKAGE_VERSION=0.4.1.6-r0
ARG TOR_PACKAGE_REPOSITORY=http://dl-cdn.alpinelinux.org/alpine/edge/community
RUN adduser -S onion \
&& apk add --no-cache \
ARG CURL_PACKAGE_VERSION=7.69.1-r1
ARG BIND_TOOLS_PACKAGE_VERSION=9.16.6-r0
ARG TOR_PACKAGE_VERSION=0.4.3.5-r0
RUN apk add --no-cache \
curl=$CURL_PACKAGE_VERSION \
bind-tools=$BIND_TOOLS_PACKAGE_VERSION `# dig` \
&& apk add --no-cache --repository $TOR_PACKAGE_REPOSITORY \
tor=$TOR_PACKAGE_VERSION
VOLUME /var/lib/tor
# RUN apk add --no-cache man less \
# && apk add --no-cache tor-doc=$TOR_PACKAGE_VERSION \
# --repository $TOR_PACKAGE_REPOSITORY
# ENV PAGER=less
#RUN apk add --no-cache \
# less \
# man-db \
# tor-doc=$TOR_PACKAGE_VERSION
#ENV PAGER=less
EXPOSE 9050/tcp
EXPOSE 53/udp
COPY torrc /etc/tor/torrc
EXPOSE 9053/udp
COPY torrc.template entrypoint.sh /
RUN chmod -c a+rX /torrc.template /entrypoint.sh
ENV SOCKS_TIMEOUT_SECONDS=
ENTRYPOINT ["/entrypoint.sh"]
CMD ["tor"]
USER tor
CMD ["tor", "-f", "/tmp/torrc"]
HEALTHCHECK CMD \
curl --silent --socks5 localhost:9050 https://google.com > /dev/null \
&& [ ! -z "$(dig +notcp +short one.one.one.one @localhost)" ] \
&& [ ! -z "$(dig -p 9053 +notcp +short one.one.one.one @localhost)" ] \
|| exit 1
+35 -6
View File
@@ -2,23 +2,24 @@
docker hub: https://hub.docker.com/r/fphammerle/tor-proxy
signed tags: https://github.com/fphammerle/tor-proxy/tags
signed tags: https://github.com/fphammerle/docker-tor-proxy/tags
```sh
$ docker run --rm --name tor-proxy \
$ sudo docker run --rm --name tor_proxy \
-p 127.0.0.1:9050:9050/tcp \
-p 127.0.0.1:53:53/udp \
-p 127.0.0.1:53:9053/udp \
fphammerle/tor-proxy
```
or after cloning the repository 🐙
```sh
$ docker-compose up
$ sudo docker-compose up
```
test proxies:
### test proxies
```sh
$ curl --socks5 localhost:9050 ipinfo.io
$ curl --proxy socks5h://localhost:9050 ipinfo.io
$ torsocks wget -O - ipinfo.io
$ torsocks lynx -dump https://check.torproject.org/
$ dig @localhost fabian.hammerle.me
@@ -26,3 +27,31 @@ $ ssh -o 'ProxyCommand nc -x localhost:9050 -v %h %p' abcdefghi.onion
# no anonymity!
$ chromium-browser --proxy-server=socks5://localhost:9050 ipinfo.io
```
### read-only root filesystem
optionally add
```sh
$ sudo docker run --read-only -v tor_proxy_data:/var/lib/tor --tmpfs /tmp:rw,size=4k`
```
to make the container's root filesystem read-only
### isolate
```sh
sudo iptables -A OUTPUT ! -o lo -j REJECT --reject-with icmp-admin-prohibited
```
### change `SocksTimeout` option
```sh
$ sudo docker run -e SOCKS_TIMEOUT_SECONDS=60
```
### show circuits
```sh
$ sudo docker exec tor_proxy \
sh -c 'printf "AUTHENTICATE\nGETINFO circuit-status\nQUIT\n" | nc localhost 9051'
```
relay search: https://metrics.torproject.org/rs.html
+17 -4
View File
@@ -7,16 +7,29 @@
com.docker.network.bridge.name: tor
- docker_container:
name: tor_proxy
# 1.0.0-tor0.4.1.6-amd64
image: fphammerle/tor-proxy@sha256:ad55d07b1b21c35fa044dc3e1ea6c7d8494f39eb89491ddad35c245340f7cd4b
# TODO use fingerprint
image: fphammerle/tor-proxy:3.0.0-tor0.4.3.5-amd64
mounts:
- type: volume
source: tor_proxy_data
target: /var/lib/tor
read_only: no
- type: tmpfs
target: /tmp # torrc
# nosuid,nodev,noexec added by default
tmpfs_mode: '1777'
tmpfs_size: 4k
read_only: yes
networks:
- name: tor_proxy_network
purge_networks: yes
ports:
- '127.0.0.1:9050:9050/tcp'
- '127.0.0.1:53:53/udp'
restart_policy: unless-stopped
- '127.0.0.1:53:9053/udp'
cap_drop: [ALL]
security_opts: [no-new-privileges]
memory: 128M
restart_policy: unless-stopped
- iptables:
action: append
table: filter
+23 -4
View File
@@ -1,15 +1,34 @@
version: '2.2'
version: '2.3'
volumes:
data:
services:
tor_proxy:
build: .
image: fphammerle/tor-proxy
environment:
SOCKS_TIMEOUT_SECONDS: 30
volumes:
- type: volume
source: data
target: /var/lib/tor
read_only: no
- type: tmpfs
target: /tmp # torrc
tmpfs:
# nosuid,nodev,noexec added by default
mode: '1777'
size: 4k
read_only: yes
ports:
- '127.0.0.1:9050:9050/tcp'
- '127.0.0.1:53:53/udp'
security_opt: ['no-new-privileges']
restart: unless-stopped
- '127.0.0.1:53:9053/udp'
cap_drop: [ALL]
#cap_add: [SYS_PTRACE]
security_opt: [no-new-privileges]
cpus: 0.5
mem_limit: 128m
restart: unless-stopped
# https://docs.docker.com/compose/compose-file/compose-file-v2/
Executable
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
set -e
# default: 120 sec
# https://github.com/torproject/tor/blob/tor-0.4.1.7/src/core/or/connection_edge.c#L1099
if [ -z "$SOCKS_TIMEOUT_SECONDS" ]; then
sed -e '/{socks_timeout_seconds}/d' /torrc.template > /tmp/torrc
else
sed -e "s/{socks_timeout_seconds}/$SOCKS_TIMEOUT_SECONDS/" /torrc.template > /tmp/torrc
fi
exec "$@"
-7
View File
@@ -1,7 +0,0 @@
Log notice stdout
SocksPort 0.0.0.0:9050
DNSPort 0.0.0.0:53
# try to
HardwareAccel 1
+15
View File
@@ -0,0 +1,15 @@
Log notice stdout
# default: ~/.tor
DataDirectory /var/lib/tor
# https://gitweb.torproject.org/torspec.git/tree/control-spec.txt
ControlPort localhost:9051
DNSPort 0.0.0.0:9053
SocksPort 0.0.0.0:9050
SocksTimeout {socks_timeout_seconds}
# try to
HardwareAccel 1