diff --git a/Dockerfile b/Dockerfile index 0d19f790..b6e24475 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ LABEL maintainer="quentin.mcgaw@gmail.com" \ ram="11.89MB" \ cpu_usage="Low to medium" \ github="https://github.com/qdm12/private-internet-access-docker" -RUN apk add -q --progress --no-cache --update openvpn unbound ca-certificates wget && \ +RUN apk add -q --progress --no-cache --update openvpn unbound ca-certificates && \ apk add -q --progress --no-cache --update --virtual=build-dependencies unzip && \ mkdir /openvpn-udp-normal /openvpn-udp-strong /openvpn-tcp-normal /openvpn-tcp-strong && \ wget -q https://www.privateinternetaccess.com/openvpn/openvpn.zip \ @@ -20,7 +20,11 @@ RUN apk add -q --progress --no-cache --update openvpn unbound ca-certificates wg apk del -q --progress --purge build-dependencies && \ rm -rf /*.zip /etc/unbound/unbound.conf /var/cache/apk/* COPY unbound.conf /etc/unbound/unbound.conf -HEALTHCHECK --interval=10m --timeout=3s --start-period=5s --retries=1 CMD [ $(wget -qO- -T 2 https://api.ipify.org) != "$INITIALIP" ] || exit 1 +HEALTHCHECK --interval=10m --timeout=3s --start-period=5s --retries=1 \ + CMD VPNCITY=$(wget -qO- -T 2 https://ipinfo.io/city); \ + VPNORGANIZATION=$(wget -qO- -T 2 https://ipinfo.io/org); \ + printf "\nCity: $VPNCITY\nOrganization: $VPNORGANIZATION"; \ + [ "$VPNCITY" != "$CITY" ] || [ "$VPNORGANIZATION" != "$ORGANIZATION" ] || exit 1 ENV ENCRYPTION=strong \ PROTOCOL=tcp \ REGION=Switzerland diff --git a/entrypoint.sh b/entrypoint.sh index 9e86e5df..6f78434d 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,11 +1,12 @@ #!/bin/sh -printf "\nDetecting current public IP address..." -export INITIALIP=$(wget -qO- -T 2 https://api.ipify.org) -printf "$INITIALIP\nChanging DNS to localhost..." +printf "\nDetecting details from public IP address..." +export CITY=$(wget -qO- -T 2 https://ipinfo.io/city) +export ORG=$(wget -qO- -T 2 https://ipinfo.io/org) +printf "DONE\nOrganization: $ORG\nCountry: $COUNTRY\nCity: $CITY\nChanging DNS to localhost..." echo "nameserver 127.0.0.1" > /etc/resolv.conf echo "options ndots:0" >> /etc/resolv.conf -printf "DONE\nStarting Unbound to connect to Cloudflare DNS 1.1.1.1 at its TLS endpoint TCP 853..." +printf "DONE\nStarting Unbound to connect to Cloudflare DNS 1.1.1.1 at its TLS endpoint..." unbound printf "DONE\nStarting OpenVPN using $PROTOCOL with $ENCRYPTION encryption\n" DIR=/openvpn-$PROTOCOL-$ENCRYPTION