mirror of
https://github.com/fphammerle/docker-tor-proxy.git
synced 2025-10-27 02:43:35 +01:00
added ability to select exit nodes explicitly via EXIT_NODES env var
This commit is contained in:
@@ -5,6 +5,8 @@ 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]
|
||||
### Added
|
||||
- added ability to select exit nodes explicitly via `EXIT_NODES` environment variable
|
||||
|
||||
## [4.4.0] - 2021-07-07
|
||||
### Added
|
||||
|
||||
+3
-1
@@ -19,7 +19,9 @@ EXPOSE 9050/tcp
|
||||
EXPOSE 9053/udp
|
||||
COPY torrc.template entrypoint.sh /
|
||||
RUN chmod -c a+rX /torrc.template /entrypoint.sh
|
||||
ENV SOCKS_TIMEOUT_SECONDS=
|
||||
ENV SOCKS_TIMEOUT_SECONDS= \
|
||||
EXIT_NODES= \
|
||||
EXCLUDE_EXIT_NODES=
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
# entrypoint.sh drops privileges after configuring nftables for transparent proxy
|
||||
|
||||
@@ -48,6 +48,12 @@ sudo iptables -A OUTPUT ! -o lo -j REJECT --reject-with icmp-admin-prohibited
|
||||
$ sudo docker run -e SOCKS_TIMEOUT_SECONDS=60 …
|
||||
```
|
||||
|
||||
### Select Exit Nodes
|
||||
|
||||
```sh
|
||||
$ sudo docker run -e EXIT_NODES=1.2.3.4,1.2.3.5,{at} …
|
||||
```
|
||||
|
||||
### Exclude Exit Nodes
|
||||
|
||||
```sh
|
||||
|
||||
@@ -9,6 +9,7 @@ services:
|
||||
image: fphammerle/tor-proxy
|
||||
environment:
|
||||
SOCKS_TIMEOUT_SECONDS: 30
|
||||
#EXIT_NODES: '1.2.3.4,1.2.3.5,{at}'
|
||||
#EXCLUDE_EXIT_NODES: '{xx},{yy},1.2.3.4,128.0.0.0/1'
|
||||
volumes:
|
||||
- type: volume
|
||||
|
||||
@@ -20,6 +20,11 @@ else
|
||||
sed -e "s/{socks_timeout_seconds}/$SOCKS_TIMEOUT_SECONDS/" /torrc.template > /tmp/torrc
|
||||
fi
|
||||
|
||||
if [ -z "$EXIT_NODES" ]; then
|
||||
sed --in-place -e '/{exit_nodes}/d' /tmp/torrc
|
||||
else
|
||||
sed --in-place -e "s#{exit_nodes}#$EXIT_NODES#" /tmp/torrc
|
||||
fi
|
||||
if [ -z "$EXCLUDE_EXIT_NODES" ]; then
|
||||
sed --in-place -e '/{exclude_exit_nodes}/d' /tmp/torrc
|
||||
else
|
||||
|
||||
@@ -26,6 +26,8 @@ SocksTimeout {socks_timeout_seconds}
|
||||
# https://github.com/mitmproxy/mitmproxy/blob/v6.0.2/mitmproxy/platform/linux.py#L27
|
||||
TransPort 0.0.0.0:9040 IsolateClientAddr IsolateClientProtocol
|
||||
|
||||
# > list of identity fingerprints, country codes, and address patterns
|
||||
ExitNodes {exit_nodes}
|
||||
ExcludeExitNodes {exclude_exit_nodes}
|
||||
|
||||
# try to
|
||||
|
||||
Reference in New Issue
Block a user