adapt entrypoint script to fix "sed: write error" for large values of EXIT_NODES and EXCLUDE_EXIT_NODES

This commit is contained in:
Fabian Peter Hammerle
2022-02-27 16:27:14 +01:00
parent 9e41750ca9
commit eb23db5412
3 changed files with 9 additions and 12 deletions
+2
View File
@@ -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]
### Fixed
- "sed: write error" for large values of `EXIT_NODES` and `EXCLUDE_EXIT_NODES`
## [4.5.0] - 2021-09-06
### Added
+7 -8
View File
@@ -20,15 +20,14 @@ 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
# > list of identity fingerprints, country codes, and address patterns
if [ ! -z "$EXIT_NODES" ]; then
echo -n 'ExitNodes ' >> /tmp/torrc
printenv EXIT_NODES >> /tmp/torrc
fi
if [ -z "$EXCLUDE_EXIT_NODES" ]; then
sed --in-place -e '/{exclude_exit_nodes}/d' /tmp/torrc
else
sed --in-place -e "s#{exclude_exit_nodes}#$EXCLUDE_EXIT_NODES#" /tmp/torrc
if [ ! -z "$EXCLUDE_EXIT_NODES" ]; then
echo -n 'ExcludeExitNodes ' >> /tmp/torrc
printenv EXCLUDE_EXIT_NODES >> /tmp/torrc
fi
exec "$@"
-4
View File
@@ -26,9 +26,5 @@ 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
HardwareAccel 1