Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker build fails due to missing privoxy config #66

Open
adamus1red opened this issue May 29, 2021 · 5 comments
Open

Docker build fails due to missing privoxy config #66

adamus1red opened this issue May 29, 2021 · 5 comments

Comments

@adamus1red
Copy link

When trying to build from the Dockerfile, the build fails due to /etc/privoxy/config not existing.

Sending build context to Docker daemon  36.35kB
Step 1/8 : FROM alpine
latest: Pulling from library/alpine
540db60ca938: Pull complete
Digest: sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f
Status: Downloaded newer image for alpine:latest
 ---> 6dbb9cc54074
Step 2/8 : MAINTAINER David Personette <dperson@gmail.com>
 ---> Running in 807a9bb37144
Removing intermediate container 807a9bb37144
 ---> c040e1374d0f
Step 3/8 : RUN apk --no-cache --no-progress upgrade&&    apk --no-cache --no-progress add bash curl privoxy shadow tini tor tzdata&&    file='/etc/privoxy/config' &&     sed -i 's|^\(accept-intercepted-requests\) .*|\1 1|' $file &&     sed -i '/^listen/s|127\.0\.0\.1||' $file &&     sed -i '/^listen.*::1/s|^|#|' $file &&     sed -i 's|^\(logfile\)|#\1|' $file &&     sed -i 's|^#\(log-messages\)|\1|' $file &&     sed -i 's|^#\(log-highlight-messages\)|\1|' $file &&     sed -i '/forward *localhost\//a forward-socks5t / 127.0.0.1:9050 .' $file&&    sed -i '/^forward-socks5t \//a forward 172.16.*.*/ .' $file &&     sed -i '/^forward 172\.16\.\*\.\*\//a forward 172.17.*.*/ .' $file &&     sed -i '/^forward 172\.17\.\*\.\*\//a forward 172.18.*.*/ .' $file &&     sed -i '/^forward 172\.18\.\*\.\*\//a forward 172.19.*.*/ .' $file &&     sed -i '/^forward 172\.19\.\*\.\*\//a forward 172.20.*.*/ .' $file &&     sed -i '/^forward 172\.20\.\*\.\*\//a forward 172.21.*.*/ .' $file &&     sed -i '/^forward 172\.21\.\*\.\*\//a forward 172.22.*.*/ .' $file &&     sed -i '/^forward 172\.22\.\*\.\*\//a forward 172.23.*.*/ .' $file &&     sed -i '/^forward 172\.23\.\*\.\*\//a forward 172.24.*.*/ .' $file &&     sed -i '/^forward 172\.24\.\*\.\*\//a forward 172.25.*.*/ .' $file &&     sed -i '/^forward 172\.25\.\*\.\*\//a forward 172.26.*.*/ .' $file &&     sed -i '/^forward 172\.26\.\*\.\*\//a forward 172.27.*.*/ .' $file &&     sed -i '/^forward 172\.27\.\*\.\*\//a forward 172.28.*.*/ .' $file &&     sed -i '/^forward 172\.28\.\*\.\*\//a forward 172.29.*.*/ .' $file &&     sed -i '/^forward 172\.29\.\*\.\*\//a forward 172.30.*.*/ .' $file &&     sed -i '/^forward 172\.30\.\*\.\*\//a forward 172.31.*.*/ .' $file &&     sed -i '/^forward 172\.31\.\*\.\*\//a forward 10.*.*.*/ .' $file &&     sed -i '/^forward 10\.\*\.\*\.\*\//a forward 192.168.*.*/ .' $file &&     sed -i '/^forward 192\.168\.\*\.\*\//a forward 127.*.*.*/ .' $file &&     sed -i '/^forward 127\.\*\.\*\.\*\//a forward localhost/ .' $file &&     echo 'AutomapHostsOnResolve 1' >>/etc/tor/torrc &&     echo 'ControlPort 9051' >>/etc/tor/torrc &&     echo 'ControlSocket /etc/tor/run/control' >>/etc/tor/torrc &&     echo 'ControlSocketsGroupWritable 1' >>/etc/tor/torrc &&     echo 'CookieAuthentication 1' >>/etc/tor/torrc &&     echo 'CookieAuthFile /etc/tor/run/control.authcookie' >>/etc/tor/torrc &&     echo 'CookieAuthFileGroupReadable 1' >>/etc/tor/torrc &&     echo 'DNSPort 5353' >>/etc/tor/torrc &&     echo 'DataDirectory /var/lib/tor' >>/etc/tor/torrc &&     echo 'ExitPolicy reject *:*' >>/etc/tor/torrc &&     echo 'Log notice stderr' >>/etc/tor/torrc &&     echo 'RunAsDaemon 0' >>/etc/tor/torrc &&     echo 'SocksPort 0.0.0.0:9050 IsolateDestAddr' >>/etc/tor/torrc &&     echo 'TransPort 0.0.0.0:9040' >>/etc/tor/torrc &&     echo 'User tor' >>/etc/tor/torrc &&     echo 'VirtualAddrNetworkIPv4 10.192.0.0/10' >>/etc/tor/torrc &&     mkdir -p /etc/tor/run &&     chown -Rh tor. /var/lib/tor /etc/tor/run &&     chmod 0750 /etc/tor/run &&     rm -rf /tmp/*
 ---> Running in 80a5ed17ed8a
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
OK: 6 MiB in 14 packages
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
(1/19) Installing ncurses-terminfo-base (6.2_p20210109-r0)
(2/19) Installing ncurses-libs (6.2_p20210109-r0)
(3/19) Installing readline (8.1.0-r0)
(4/19) Installing bash (5.1.0-r0)
Executing bash-5.1.0-r0.post-install
(5/19) Installing ca-certificates (20191127-r5)
(6/19) Installing brotli-libs (1.0.9-r3)
(7/19) Installing nghttp2-libs (1.42.0-r1)
(8/19) Installing libcurl (7.77.0-r0)
(9/19) Installing curl (7.77.0-r0)
(10/19) Installing pcre (8.44-r0)
(11/19) Installing privoxy (3.0.32-r0)
Executing privoxy-3.0.32-r0.pre-install
(12/19) Installing linux-pam (1.5.1-r0)
(13/19) Installing shadow (4.8.1-r0)
(14/19) Installing tini (0.19.0-r0)
(15/19) Installing libevent (2.1.12-r1)
(16/19) Installing xz-libs (5.2.5-r0)
(17/19) Installing zstd-libs (1.4.5-r3)
(18/19) Installing tor (0.4.4.8-r0)
Executing tor-0.4.4.8-r0.pre-install
(19/19) Installing tzdata (2021a-r0)
Executing busybox-1.32.1-r6.trigger
Executing ca-certificates-20191127-r5.trigger
OK: 31 MiB in 33 packages
sed: /etc/privoxy/config: No such file or directory
The command '/bin/sh -c apk --no-cache --no-progress upgrade&&    apk --no-cache --no-progress add bash curl privoxy shadow tini tor tzdata&&    file='/etc/privoxy/config' &&     sed -i 's|^\(accept-intercepted-requests\) .*|\1 1|' $file &&     sed -i '/^listen/s|127\.0\.0\.1||' $file &&     sed -i '/^listen.*::1/s|^|#|' $file &&     sed -i 's|^\(logfile\)|#\1|' $file &&     sed -i 's|^#\(log-messages\)|\1|' $file &&     sed -i 's|^#\(log-highlight-messages\)|\1|' $file &&     sed -i '/forward *localhost\//a forward-socks5t / 127.0.0.1:9050 .' $file&&    sed -i '/^forward-socks5t \//a forward 172.16.*.*/ .' $file &&     sed -i '/^forward 172\.16\.\*\.\*\//a forward 172.17.*.*/ .' $file &&     sed -i '/^forward 172\.17\.\*\.\*\//a forward 172.18.*.*/ .' $file &&     sed -i '/^forward 172\.18\.\*\.\*\//a forward 172.19.*.*/ .' $file &&     sed -i '/^forward 172\.19\.\*\.\*\//a forward 172.20.*.*/ .' $file &&     sed -i '/^forward 172\.20\.\*\.\*\//a forward 172.21.*.*/ .' $file &&     sed -i '/^forward 172\.21\.\*\.\*\//a forward 172.22.*.*/ .' $file &&     sed -i '/^forward 172\.22\.\*\.\*\//a forward 172.23.*.*/ .' $file &&     sed -i '/^forward 172\.23\.\*\.\*\//a forward 172.24.*.*/ .' $file &&     sed -i '/^forward 172\.24\.\*\.\*\//a forward 172.25.*.*/ .' $file &&     sed -i '/^forward 172\.25\.\*\.\*\//a forward 172.26.*.*/ .' $file &&     sed -i '/^forward 172\.26\.\*\.\*\//a forward 172.27.*.*/ .' $file &&     sed -i '/^forward 172\.27\.\*\.\*\//a forward 172.28.*.*/ .' $file &&     sed -i '/^forward 172\.28\.\*\.\*\//a forward 172.29.*.*/ .' $file &&     sed -i '/^forward 172\.29\.\*\.\*\//a forward 172.30.*.*/ .' $file &&     sed -i '/^forward 172\.30\.\*\.\*\//a forward 172.31.*.*/ .' $file &&     sed -i '/^forward 172\.31\.\*\.\*\//a forward 10.*.*.*/ .' $file &&     sed -i '/^forward 10\.\*\.\*\.\*\//a forward 192.168.*.*/ .' $file &&     sed -i '/^forward 192\.168\.\*\.\*\//a forward 127.*.*.*/ .' $file &&     sed -i '/^forward 127\.\*\.\*\.\*\//a forward localhost/ .' $file &&     echo 'AutomapHostsOnResolve 1' >>/etc/tor/torrc &&     echo 'ControlPort 9051' >>/etc/tor/torrc &&     echo 'ControlSocket /etc/tor/run/control' >>/etc/tor/torrc &&     echo 'ControlSocketsGroupWritable 1' >>/etc/tor/torrc &&     echo 'CookieAuthentication 1' >>/etc/tor/torrc &&     echo 'CookieAuthFile /etc/tor/run/control.authcookie' >>/etc/tor/torrc &&     echo 'CookieAuthFileGroupReadable 1' >>/etc/tor/torrc &&     echo 'DNSPort 5353' >>/etc/tor/torrc &&     echo 'DataDirectory /var/lib/tor' >>/etc/tor/torrc &&     echo 'ExitPolicy reject *:*' >>/etc/tor/torrc &&     echo 'Log notice stderr' >>/etc/tor/torrc &&     echo 'RunAsDaemon 0' >>/etc/tor/torrc &&     echo 'SocksPort 0.0.0.0:9050 IsolateDestAddr' >>/etc/tor/torrc &&     echo 'TransPort 0.0.0.0:9040' >>/etc/tor/torrc &&     echo 'User tor' >>/etc/tor/torrc &&     echo 'VirtualAddrNetworkIPv4 10.192.0.0/10' >>/etc/tor/torrc &&     mkdir -p /etc/tor/run &&     chown -Rh tor. /var/lib/tor /etc/tor/run &&     chmod 0750 /etc/tor/run &&     rm -rf /tmp/*' returned a non-zero code: 1```
@adamus1red
Copy link
Author

Copying /etc/privoxy/config.new to /etc/privoxy/config allows the build to complete and does apparently create a valid config but there is a fatal error logged regarding it.

In my testing both socks5 9050 and http 8118 proxies both still work

3269adc1794fe9ae8846af60e872b60fc2c1839d26ff3ec194ca579300e06baa
adamus1red@docker125:~ $ docker logs -f 3269adc1794fe9ae8846af60e872b60fc2c1839d26ff3ec194ca579300e06baa
2021-05-29 22:07:44.919 7f955987cb48 Fatal error: can't open configuration file '/etc/privoxy/config':  Invalid argument
May 29 22:07:45.927 [notice] Tor 0.4.4.8 running on Linux with Libevent 2.1.12-stable, OpenSSL 1.1.1k, Zlib 1.2.11, Liblzma 5.2.5, and Libzstd 1.4.5.
May 29 22:07:45.927 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
May 29 22:07:45.927 [notice] Read configuration file "/etc/tor/torrc".
.....

@erictroebs
Copy link
Contributor

erictroebs commented Oct 13, 2021

Probably #64 could fix your issue.

@adamus1red
Copy link
Author

@erictroebs #64 does fix the issue. I've got it patched in my fork.

@erictroebs
Copy link
Contributor

Sorry. I did not notice you are involved in any pull request regarding this issue and I did not check the date either.

@skobkin
Copy link

skobkin commented Dec 20, 2021

@erictroebs @adamus1red
It fixes the build, but breaks privoxy configuration because after that you'll have an empty /etc/privoxy/config.

Just creating the /etc/privoxy/config is not enough. Because next you're going to replace some text in it using sed:
Dockerfile:8. But there is not text to replace in empty file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants