diff --git a/CHANGELOG.md b/CHANGELOG.md index 86f68b0..3d671bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh index 2bcab83..6619e95 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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 "$@" diff --git a/torrc.template b/torrc.template index cff7c59..5c79cef 100644 --- a/torrc.template +++ b/torrc.template @@ -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