diff --git a/Dockerfile b/Dockerfile index 1f951072..02333c9c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,10 +30,15 @@ ENV USER= \ BLOCK_NSA=off \ UNBLOCK= \ FIREWALL=on \ - EXTRA_SUBNETS= + EXTRA_SUBNETS= \ + PROXY=on \ + PROXY_LOG_LEVEL=Critical \ + PROXY_USER= \ + PROXY_PASSWORD= ENTRYPOINT /entrypoint.sh +EXPOSE 8888 HEALTHCHECK --interval=3m --timeout=3s --start-period=20s --retries=1 CMD /healthcheck.sh -RUN apk add -q --progress --no-cache --update openvpn wget ca-certificates iptables unbound unzip && \ +RUN apk add -q --progress --no-cache --update openvpn wget ca-certificates iptables unbound unzip tinyproxy && \ wget -q https://www.privateinternetaccess.com/openvpn/openvpn.zip \ https://www.privateinternetaccess.com/openvpn/openvpn-strong.zip \ https://www.privateinternetaccess.com/openvpn/openvpn-tcp.zip \ @@ -44,7 +49,7 @@ RUN apk add -q --progress --no-cache --update openvpn wget ca-certificates iptab unzip -q openvpn-tcp.zip -d /openvpn/tcp-normal && \ unzip -q openvpn-strong-tcp.zip -d /openvpn/tcp-strong && \ apk del -q --progress --purge unzip && \ - rm -rf /*.zip /var/cache/apk/* /etc/unbound/* /usr/sbin/unbound-anchor /usr/sbin/unbound-checkconf /usr/sbin/unbound-control /usr/sbin/unbound-control-setup /usr/sbin/unbound-host && \ + rm -rf /*.zip /var/cache/apk/* /etc/unbound/* /usr/sbin/unbound-anchor /usr/sbin/unbound-checkconf /usr/sbin/unbound-control /usr/sbin/unbound-control-setup /usr/sbin/unbound-host /etc/tinyproxy/tinyproxy.conf && \ adduser nonrootuser -D -H --uid 1000 && \ wget -q https://raw.githubusercontent.com/qdm12/updated/master/files/named.root.updated -O /etc/unbound/root.hints && \ wget -q https://raw.githubusercontent.com/qdm12/updated/master/files/root.key.updated -O /etc/unbound/root.key && \ @@ -59,9 +64,10 @@ RUN apk add -q --progress --no-cache --update openvpn wget ca-certificates iptab tar -cjf /etc/unbound/blocks-nsa.bz2 blocks-nsa.conf && \ rm -f /tmp/* COPY unbound.conf /etc/unbound/unbound.conf +COPY tinyproxy.conf /etc/tinyproxy/tinyproxy.conf COPY entrypoint.sh healthcheck.sh portforward.sh / -RUN chown nonrootuser -R /etc/unbound && \ - chmod 700 /etc/unbound && \ - chmod 600 /etc/unbound/unbound.conf && \ +RUN chown nonrootuser -R /etc/unbound /etc/tinyproxy && \ + chmod 700 /etc/unbound /etc/tinyproxy && \ + chmod 600 /etc/unbound/unbound.conf /etc/tinyproxy/tinyproxy.conf && \ chmod 500 /entrypoint.sh /healthcheck.sh /portforward.sh && \ chmod 400 /etc/unbound/root.hints /etc/unbound/root.key /etc/unbound/*.bz2 diff --git a/README.md b/README.md index b16fd560..a4561903 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ - [IPtables 1.8.3](https://pkgs.alpinelinux.org/package/v3.10/main/x86_64/iptables) enforces the container to communicate only through the VPN or with other containers in its virtual network (acts as a killswitch) - [Unbound 1.9.1](https://pkgs.alpinelinux.org/package/v3.10/main/x86_64/unbound) configured with Cloudflare's [1.1.1.1](https://1.1.1.1) DNS over TLS - [Files and blocking lists built periodically](https://github.com/qdm12/updated/tree/master/files) used with Unbound (see `BLOCK_MALICIOUS` and `BLOCK_NSA` environment variables) +- [TinyProxy 1.10.0](https://pkgs.alpinelinux.org/package/v3.10/main/x86_64/tinyproxy)
@@ -45,7 +46,7 @@ - DNS over TLS - Malicious DNS blocking - Internal firewall - - Run openvpn without root (but will give reconnect problems) + - Web HTTP proxy - Run openvpn without root @@ -57,6 +58,7 @@ - OpenVPN can run *without root* but this disallows OpenVPN reconnecting, it can be set with `NONROOT=yes` - **ARM** compatible - Port forwarding +- HTTP proxy for LAN devices ## Setup @@ -124,6 +126,8 @@ Note that you can change all the [environment variables](#environment-variables). + If you want to use the **HTTP proxy**, add `-p 8888:8888/tcp` so that it is accessible from LAN devices. + ## Testing Check the PIA IP address matches your expectations @@ -148,6 +152,10 @@ docker run --rm --network=container:pia alpine:3.10 wget -qO- https://ipinfo.io | `UNBLOCK` | | comma separated string (i.e. `web.com,web2.ca`) to unblock hostnames | | `FIREWALL` | `on` | `on` or `off`, to switch the internal killswitch firewall (should be left `on`) | | `EXTRA_SUBNETS` | | comma separated subnets allowed in the container firewall (i.e. `192.168.1.0/24,192.168.10.121,10.0.0.5/28`) | +| `PROXY` | `on` | `on` or `off`, to switch the internal HTTP proxy | +| `PROXY_LOG_LEVEL` | `Critical` | `Info`, `Warning`, `Error` or `Critical` | +| `PROXY_USER` | | Username to use to connect to the HTTP proxy | +| `PROXY_PASSWORD` | | Passsword to use to connect to the HTTP proxy | ## Connect to it @@ -331,9 +339,20 @@ There are various ways to achieve this, depending on your use case. ``` --
+-
- *This is in progress, using Tiny Proxy, thanks for waiting !*
+ 1. Setup a HTTP proxy client, such as [SwitchyOmega for Chrome](https://chrome.google.com/webstore/detail/proxy-switchyomega/padekgcemlokbadohgkifijomclgjgif?hl=en)
+ 1. Make sure the PIA container:
+ - Has port 8888 published `-p 8888:8888/tcp`
+ - **Has your LAN** in `EXTRA_SUBNETS`
+ 1. With your HTTP proxy client, connect to the Docker host (i.e. `192.168.1.10`) on port `8888`. You might need to enter your credentials if you set them with the environment variables `PROXY_USER` and `PROXY_PASSWORD`.
+ 1. If you set `PROXY_LOG_LEVEL` to `Info`, you can check the log output of tinyproxy with:
+
+ ```sh
+ docker exec -it pia cat /var/log/tinyproxy/tinyproxy.log
+ ```
+
+ `PROXY_LOG_LEVEL` defaults to `Critical` to avoid logging everything, for privacy purposes as well as to save storage.
Connect to the PIA through an HTTP proxy (i.e. with Chrome, Kodi, etc.)