Compare commits

...

43 Commits

Author SHA1 Message Date
Fabian Peter Hammerle 1eba286ed7 release v4.3.0 2021-05-07 13:22:04 +02:00
Fabian Peter Hammerle a75b7aebae add nft rule forwarding udp dns requests to tor 2021-05-07 00:08:52 +02:00
Fabian Peter Hammerle 6b811fe5c6 release v4.2.0 2021-04-30 12:50:31 +02:00
Fabian Peter Hammerle db9609494e add nft rule redirecting tcp traffic to transparent proxy 2021-04-30 12:35:15 +02:00
dependabot[bot] f05b6c3765 build(deps): bump alpine from 3.13.4 to 3.13.5
Bumps alpine from 3.13.4 to 3.13.5.

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-16 05:45:24 +00:00
dependabot[bot] f301bd9968 build(deps): bump alpine from 3.13.3 to 3.13.4
Bumps alpine from 3.13.3 to 3.13.4.

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-02 06:28:41 +00:00
Fabian Peter Hammerle 76f7fcaf09 upgrade alpine base image v3.12.2->v3.13.3 including upgrade of tor v0.4.4.7-r1->v0.4.4.8-r0 (see below)
> One of these vulnerabilities (TROVE-2021-001) would allow an attacker
> who can send directory data to a Tor instance to force that Tor
> instance to consume huge amounts of CPU.
https://gitweb.torproject.org/tor.git/plain/ChangeLog

https://cve.circl.lu/cve/CVE-2021-28089

https://git.alpinelinux.org/aports/commit/community/tor?id=dc7ce7e4b63c64d11026e307ada830c33d8309a4

https://github.com/fphammerle/docker-onion-service/commit/48c53ae15c2780b3ac97ac55a91748e947a55ead
2021-03-27 15:30:34 +01:00
dependabot[bot] 4e2545483d build(deps): bump alpine from 3.13.2 to 3.13.3
Bumps alpine from 3.13.2 to 3.13.3.

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-26 06:19:03 +00:00
Fabian Peter Hammerle f9f3095cba readme: simplify control port commands (no longer invoke shell) 2021-03-03 18:57:41 +01:00
Fabian Peter Hammerle eac37ae895 readme: added instructions to disable safe logging; capitalize headlines 2021-03-03 18:54:14 +01:00
Fabian Peter Hammerle 579ec95c54 readme: added apt-get install cmd for onioncircuits 2021-03-03 17:12:48 +01:00
Fabian Peter Hammerle 63cc740dae readme: added command to launch onioncircuits 2021-03-03 17:07:44 +01:00
Fabian Peter Hammerle 71cd9e4843 release v4.1.0 2021-03-03 14:25:32 +01:00
Fabian Peter Hammerle 677e9db8e2 added image labels org.opencontainers.image.title, .source & .revision
https://github.com/fphammerle/docker-onion-service/commit/46ca6d70fb2d4570bfddac6b3f5e485183e72405
https://github.com/fphammerle/docker-onion-service/commit/aa124bde955047b2de6316ff72d6b1f76d14e3ba
2021-03-03 14:08:29 +01:00
Fabian Peter Hammerle 8ae9e9e5b7 makefile: added "podman-build" target
https://github.com/fphammerle/docker-onion-service/commit/77a062c4afcd96abe1ba7663a2914a94e01b9c24
https://github.com/fphammerle/docker-onion-service/commit/4c673eef480af3bb9498c0364a55dc3d8f8a5afc
https://github.com/fphammerle/docker-onion-service/commit/a3e89529767a7eb52c4bce52277715d388f6935a
https://github.com/fphammerle/docker-onion-service/commit/e8dfe51bb831c54d9a87be7c70f3f79e2f45d9ce
2021-03-03 13:48:47 +01:00
Fabian Peter Hammerle 1951c1f3a9 enable transparent proxy 2021-03-03 12:25:12 +01:00
Fabian Peter Hammerle edac4ed3da upgrade alpine base image v3.13.1->3.13.2 including upgrade of tor package v0.4.4.6-r1->0.4.4.7-r1 (diff links below)
https://git.alpinelinux.org/aports/commit/community/tor?id=3ff23770ebde5d5ce691e662d25ba01bd5020f3d
https://git.alpinelinux.org/aports/commit/community/tor?id=a9d54349aa5fec39e2d79c46838ce05904ca9bda
https://git.alpinelinux.org/aports/commit/community/tor?id=9ed5ece0dd0317f1976a1bb4729e911786d33af9

cherry-pick of https://github.com/fphammerle/docker-onion-service/commit/0599554fd6ae2ee3404dc63cec90730b14fa1fc2
2021-02-19 13:13:56 +01:00
dependabot[bot] 5cc893c3c3 build(deps): bump alpine from 3.13.1 to 3.13.2
Bumps alpine from 3.13.1 to 3.13.2.

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-19 06:10:22 +00:00
dependabot[bot] 4e2e1bbf4f build(deps): bump alpine from 3.13.0 to 3.13.1
Bumps alpine from 3.13.0 to 3.13.1.

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-29 05:49:05 +00:00
Fabian Peter Hammerle 40b88ec7d5 upgrade alpine base image v3.12.3->v3.13.0 including upgrade of tor v0.4.3.7-r0->v0.4.4.6-r1 (diff links below)
https://gitweb.torproject.org/tor.git/plain/ChangeLog

https://git.alpinelinux.org/aports/commit/community/tor?id=d181b0289ff7c32d371dcd976276672bbe2e7b72
https://git.alpinelinux.org/aports/commit/community/tor?id=9a0a0a5045901ab97ef455b54ffe19c91ca6993e
https://git.alpinelinux.org/aports/commit/community/tor?id=5edd132382384956e1787d4dcd5f1ffa9c520571
https://git.alpinelinux.org/aports/commit/community/tor?id=4ecb636d72d13db0f95f6e840e755bb260c91165
2021-01-15 12:46:01 +01:00
dependabot[bot] 67c5c44495 build(deps): bump alpine from 3.12.3 to 3.13.0
Bumps alpine from 3.12.3 to 3.13.0.

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-15 06:05:59 +00:00
Fabian Peter Hammerle ba4cafac27 make: add tor package version to image tag 2021-01-01 17:40:10 +01:00
Fabian Peter Hammerle fea43b11d8 make: abort docker-build if changes uncommitted; suggest git tag command
https://github.com/fphammerle/wireless-sensor-mqtt/blob/222d2e124d231b207da647c1f7a9c5ec9a37b4ac/Makefile#L34
2021-01-01 17:29:38 +01:00
Fabian Peter Hammerle 4f6950af1d make: added docker-build & docker-push target
https://github.com/fphammerle/systemctl-mqtt/commit/54a3c74eae0e85307ac5f9258c345bc133d3133a#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52
https://github.com/fphammerle/systemctl-mqtt/commit/7887079ebeed7e26cfc36bbdcbdfd6ceeb65bdee#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52
2021-01-01 17:25:40 +01:00
Fabian Peter Hammerle 7cbef67a3f release v4.0.0 2021-01-01 17:20:14 +01:00
Fabian Peter Hammerle dfe104eb09 healthcheck: replace dig with pre-installed nslookup 2021-01-01 16:38:41 +01:00
Fabian Peter Hammerle 6a9e7a1f42 healthcheck: restore dns request as network-liveness is too optimistic
partial revert of commit 8d1a635ddc.
2021-01-01 16:36:24 +01:00
Fabian Peter Hammerle 8d1a635ddc healthcheck: improve privacy by probing network-liveness instead of periodic http and dns requests 2021-01-01 13:59:50 +01:00
Fabian Peter Hammerle d573073454 upgrade tor v0.4.3.5 -> v0.4.3.7 (diff links below)
https://gitweb.torproject.org/tor.git/plain/ChangeLog

https://git.alpinelinux.org/aports/commit/community/tor?id=3a247b9dbce3988d52b1a17a3d0bb5f1dc9b4863

removes support for zstd-compressed directory traffic from armhf builds:
https://git.alpinelinux.org/aports/commit/?id=2849fa38b9a76d1ef0a9df10aa70bafa00a5ab27

adds patches to curl for irrelevant CVE-2020-8286, CVE-2020-82850 & CVE-2020-8231
https://git.alpinelinux.org/aports/commit/?id=90e58b3d833e1a1e51c524cdaa5091dbcd80c0f0
https://git.alpinelinux.org/aports/commit/main/curl?id=52697341e47e456d2ee900a53c8ef65ce8a75c23
2021-01-01 12:50:11 +01:00
Fabian Peter Hammerle ccb9eb52a1 configure github's dependabot to keep base image up-to-date
https://github.com/fphammerle/docker-postfix/commit/b273cbb38193eaa52562688522475c7e6e7df6b7
2021-01-01 12:42:38 +01:00
Fabian Peter Hammerle b85bfc4d53 ansible-playbook: select image via fingerprint 2020-10-03 17:32:38 +02:00
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
10 changed files with 246 additions and 44 deletions
+10
View File
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: docker
directory: /
schedule:
interval: weekly
day: friday
# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates
+62 -7
View File
@@ -6,26 +6,81 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [2.0.0] - 2020-03-24
## [4.3.0] - 2021-05-07
### Added
- when running entrypoint as `uid=0`:
add `nftables` rule forwarding udp dns requests (port 53) to tor
(alternative for less flexible `docker run --publish 53:9053 …`)
## [4.2.0] - 2021-04-30
### Added
- when running entrypoint as `uid=0`:
add `nftables` rule redirecting `tcp` traffic to transparent proxy
## [4.1.0] - 2021-03-03
### Added
- enabled transparent proxy, listening on port `9040` (requires netfilter rules)
- image labels:
- `org.opencontainers.image.revision` (git commit hash via build arg)
- `org.opencontainers.image.source` (repo url)
- `org.opencontainers.image.title`
## [4.0.0] - 2021-01-01
### Changed
- Changed DNS port from 53 to 9053
- healthcheck: replace periodic http requests with probing
[network-liveness](https://gitweb.torproject.org/torspec.git/tree/control-spec.txt)
to improve privacy (keeping dns requests for faster updates)
- changed log level of `control` domain to `warn`
(to avoid log spam by healthcheck connecting to control listener)
- added message domains to log messages
### Removed
- `curl`
- `bind-tools` package including `dig`
## [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
- Run as unprivileged user
- 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
- fix invalid torrc path
## [1.1.0] - 2020-03-21
### Added
- Change `SocksTimeout` option by setting `$SOCKS_TIMEOUT_SECONDS`
- 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/v2.0.0...HEAD
[Unreleased]: https://github.com/fphammerle/docker-tor-proxy/compare/v4.3.0...HEAD
[4.3.0]: https://github.com/fphammerle/docker-tor-proxy/compare/v4.2.0...v4.3.0
[4.2.0]: https://github.com/fphammerle/docker-tor-proxy/compare/v4.1.0...v4.2.0
[4.1.0]: https://github.com/fphammerle/docker-tor-proxy/compare/v4.0.0...v4.1.0
[4.0.0]: https://github.com/fphammerle/docker-tor-proxy/compare/v3.0.0...v4.0.0
[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
+26 -17
View File
@@ -1,31 +1,40 @@
FROM alpine:3.12
FROM docker.io/alpine:3.13.5
ARG CURL_PACKAGE_VERSION=7.69.1-r0
ARG BIND_TOOLS_PACKAGE_VERSION=9.16.6-r0
ARG TOR_PACKAGE_VERSION=0.4.3.5-r0
RUN adduser -S onion \
&& apk add --no-cache \
curl=$CURL_PACKAGE_VERSION \
bind-tools=$BIND_TOOLS_PACKAGE_VERSION `# dig` \
# nftables + dependencies add 2.3MB to image
ARG TOR_PACKAGE_VERSION=0.4.4.8-r0
ARG NFTABLES_PACKAGE_VERSION=0.9.7-r0
RUN apk add --no-cache \
nftables=$NFTABLES_PACKAGE_VERSION \
tor=$TOR_PACKAGE_VERSION
VOLUME /var/lib/tor
# RUN apk add --no-cache \
# less \
# man \
# tor-doc=$TOR_PACKAGE_VERSION
# ENV PAGER=less
#RUN apk add --no-cache \
# less \
# man-db \
# tor-doc=$TOR_PACKAGE_VERSION
#ENV PAGER=less
EXPOSE 9050/tcp
EXPOSE 9053/udp
COPY torrc.template entrypoint.sh /
RUN chmod -c a+rX /torrc.template /entrypoint.sh
ENV SOCKS_TIMEOUT_SECONDS=
ENTRYPOINT ["/entrypoint.sh"]
RUN chmod -c a+rX /torrc.template /entrypoint.sh
USER onion
# entrypoint.sh drops privileges after configuring nftables for transparent proxy
#USER tor
CMD ["tor", "-f", "/tmp/torrc"]
# keeping dns requests as network-liveness is too optimistic
# https://gitweb.torproject.org/torspec.git/tree/control-spec.txt
HEALTHCHECK CMD \
curl --silent --socks5 localhost:9050 https://google.com > /dev/null \
&& [ ! -z "$(dig -p 9053 +notcp +short one.one.one.one @localhost)" ] \
printf "AUTHENTICATE\nGETINFO network-liveness\nQUIT\n" | nc localhost 9051 \
| grep -q network-liveness=up \
&& nslookup -port=9053 google.com localhost | grep -v NXDOMAIN | grep -q google \
|| exit 1
# https://github.com/opencontainers/image-spec/blob/v1.0.1/annotations.md
ARG REVISION=
LABEL org.opencontainers.image.title="tor socks, dns & transparent proxy" \
org.opencontainers.image.source="https://github.com/fphammerle/docker-tor-proxy" \
org.opencontainers.image.revision="$REVISION"
+32
View File
@@ -0,0 +1,32 @@
IMAGE_NAME := docker.io/fphammerle/tor-proxy
PROJECT_VERSION = $(shell git describe --match=v* --abbrev=0 --dirty | sed -e 's/^v//')
TOR_PACKAGE_VERSION = $(shell grep -Po 'TOR_PACKAGE_VERSION=\K.+' Dockerfile | tr -d -)
ARCH = $(shell arch)
# architecture[arm_variant]
# https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md#image-index-property-descriptions
IMAGE_TAG_ARCH_aarch64 = arm64
IMAGE_TAG_ARCH_armv6l = armv6
IMAGE_TAG_ARCH_armv7l = armv7
IMAGE_TAG_ARCH_x86_64 = amd64
IMAGE_TAG_ARCH = ${IMAGE_TAG_ARCH_${ARCH}}
IMAGE_TAG = ${PROJECT_VERSION}-tor${TOR_PACKAGE_VERSION}-${IMAGE_TAG_ARCH}
BUILD_PARAMS = --tag="${IMAGE_NAME}:${IMAGE_TAG}" \
--build-arg=REVISION="$(shell git rev-parse HEAD)"
.PHONY: worktree-clean docker-build podman-build docker-push
worktree-clean:
git diff --exit-code
git diff --staged --exit-code
docker-build: worktree-clean
sudo docker build ${BUILD_PARAMS} .
podman-build: worktree-clean
# --format=oci (default) not fully supported by hub.docker.com
# https://github.com/docker/hub-feedback/issues/1871#issuecomment-748924149
podman build --format=docker ${BUILD_PARAMS} .
docker-push: docker-build
sudo docker push "${IMAGE_NAME}:${IMAGE_TAG}"
@echo git tag --sign --message '$(shell sudo docker image inspect --format '{{join .RepoDigests "\n"}}' "${IMAGE_NAME}:${IMAGE_TAG}")' docker/${IMAGE_TAG} $(shell git rev-parse HEAD)
+43 -9
View File
@@ -1,11 +1,11 @@
# docker: tor socks & dns proxy 🌐 🐳
docker hub: https://hub.docker.com/r/fphammerle/tor-proxy
Docker Hub: https://hub.docker.com/r/fphammerle/tor-proxy
signed tags: https://github.com/fphammerle/docker-tor-proxy/tags
Signed image 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:9053/udp \
fphammerle/tor-proxy
@@ -13,10 +13,11 @@ $ docker run --rm --name tor-proxy \
or after cloning the repository 🐙
```sh
$ docker-compose up
$ sudo docker-compose up
```
test proxies:
### Test Proxies
```sh
$ curl --proxy socks5h://localhost:9050 ipinfo.io
$ torsocks wget -O - ipinfo.io
@@ -27,12 +28,45 @@ $ ssh -o 'ProxyCommand nc -x localhost:9050 -v %h %p' abcdefghi.onion
$ chromium-browser --proxy-server=socks5://localhost:9050 ipinfo.io
```
isolate:
### Read-only Root Filesystem
Optionally add
```sh
iptables -A OUTPUT ! -o lo -j REJECT --reject-with icmp-admin-prohibited
$ 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 Host
```sh
sudo iptables -A OUTPUT ! -o lo -j REJECT --reject-with icmp-admin-prohibited
```
change `SocksTimeout` option:
### Change `SocksTimeout` Option
```sh
$ docker run -e SOCKS_TIMEOUT_SECONDS=60
$ sudo docker run -e SOCKS_TIMEOUT_SECONDS=60
```
### Show Circuits
```sh
$ printf 'AUTHENTICATE\nGETINFO circuit-status\nQUIT\n' \
| sudo docker exec -i tor_proxy nc localhost 9051
```
relay search: https://metrics.torproject.org/rs.html
or using [onioncircuits](https://gitlab.tails.boum.org/tails/onioncircuits) ([debian repo](https://salsa.debian.org/pkg-privacy-team/onioncircuits)):
```sh
$ sudo apt-get install --no-install-recommends onioncircuits
$ sudo nsenter --target "$(sudo docker inspect --format='{{.State.Pid}}' tor_proxy)" --net \
sudo -u $USER onioncircuits
```
### Troubleshooting
Disable `SafeLogging` (temporarily) to log IP addresses instead of `[scrubbed]`:
```
$ printf 'AUTHENTICATE\nSETCONF SafeLogging=0\nGETCONF SafeLogging\nQUIT\n' \
| sudo docker exec -i tor_proxy nc localhost 9051
```
+17 -3
View File
@@ -7,16 +7,30 @@
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
# object 9d8903fbee049c379537c5e291cfa88f57b049f2
# tag docker/3.0.0-tor0.4.3.5-amd64
image: docker.io/fphammerle/tor-proxy@sha256:501c5b5432156f25ecfce9e48ebfe0827f7702a1d32206af79f256cc94487a0f
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:9053/udp'
restart_policy: unless-stopped
cap_drop: [ALL]
security_opts: [no-new-privileges]
memory: 128M
restart_policy: unless-stopped
- iptables:
action: append
table: filter
+23 -6
View File
@@ -1,18 +1,35 @@
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:9053/udp'
environment:
SOCKS_TIMEOUT_SECONDS: 240
security_opt: ['no-new-privileges']
restart: unless-stopped
cap_drop: [ALL]
# entrypoint.sh drops privileges after configuring nftables for transparent proxy
cap_add: [NET_ADMIN, SETUID, SETGID]
security_opt: [no-new-privileges]
cpus: 0.5
mem_limit: 128m
#cap_add: [SYS_PTRACE]
restart: unless-stopped
# https://docs.docker.com/compose/compose-file/compose-file-v2/
+9
View File
@@ -2,6 +2,15 @@
set -e
if [ "$(id -u)" -eq 0 ]; then
nft add rule ip nat PREROUTING ip protocol tcp fib daddr type != local counter redirect to :9040 \
|| echo 'warning: failed to configure nftables for transparent proxy (missing CAP_NET_ADMIN?)'
nft add rule ip nat PREROUTING fib daddr type local udp dport 53 counter redirect to :9053 \
|| echo 'warning: failed to configure nftables for DNS proxy' \
'(alternative for less flexible `docker run --publish 53:9053 ...`)'
exec su -s /bin/sh tor -- "$0" "$@"
fi
# 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
+1
View File
@@ -0,0 +1 @@
https://gitweb.torproject.org/tor.git/plain/ChangeLog
+23 -2
View File
@@ -1,9 +1,30 @@
Log notice stdout
# https://www.torproject.org/docs/tor-manual.html.en
# hide healthchecks:
# > [notice] {CONTROL} New control connection opened from 127.0.0.1.
Log [~control]notice warn stdout
LogMessageDomains 1
# default: ~/.tor
DataDirectory /var/lib/tor
# https://gitweb.torproject.org/torspec.git/tree/control-spec.txt
ControlPort localhost:9051
SocksPort 0.0.0.0:9050
DNSPort 0.0.0.0:9053
SocksPort 0.0.0.0:9050
SocksTimeout {socks_timeout_seconds}
# requires netfilter rules
# socks5 with auth-based circuit isolation (tor browser, torsocks --isolate) should be preferred
# cave: IsolateDestAddr & IsolateDestPort are not enabled
# https://gitlab.torproject.org/legacy/trac/-/wikis/doc/TransparentProxy
# https://github.com/epidemics-scepticism/writing/blob/b6733379d653b30771d578ace04c262600345122/misconception.md#transparent-proxying-lacks-context
# https://lists.torproject.org/pipermail/tor-talk/2014-March/032507.html
# https://gitweb.torproject.org/tor.git/tree/src/or/connection_edge.c?id=6285d9bdcf7f210c56abd25f75133e30d05a7473#n1423
# https://github.com/mitmproxy/mitmproxy/blob/v6.0.2/mitmproxy/platform/linux.py#L27
TransPort 0.0.0.0:9040 IsolateClientAddr IsolateClientProtocol
# try to
HardwareAccel 1