Skip to content

Commit

Permalink
Merge pull request #8 from vmx-kbabenko/master
Browse files Browse the repository at this point in the history
Fix broken url and minor improvements
  • Loading branch information
act28 committed Nov 25, 2020
2 parents ad06b51 + a2f74d2 commit 0b8827c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM alpine:3.12

RUN apk --no-cache add ca-certificates=~20191127-r4
RUN apk --no-cache add privoxy=~3.0.28-r0
RUN apk --no-cache add openvpn=~2.4.9-r0
RUN apk --no-cache add runit=~2.1.2-r3
RUN apk --no-cache add wget=~1.20.3-r1
RUN apk --no-cache add unzip=~6.0-r8
RUN apk --no-cache add ca-certificates=~20191127-r4 \
&& apk --no-cache add privoxy=~3.0.28-r0 \
&& apk --no-cache add openvpn=~2.4.9-r0 \
&& apk --no-cache add runit=~2.1.2-r3 \
&& apk --no-cache add wget=~1.20.3-r1 \
&& apk --no-cache add unzip=~6.0-r8

COPY app /app
COPY etc /etc
Expand Down
16 changes: 12 additions & 4 deletions app/ovpn/run
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/bin/sh
set -e -u -o pipefail

# PIA might change config download URL, if that happens correct it here
PIA_OVPN_CONFIG_URL='https://www.privateinternetaccess.com/openvpn/openvpn-strong-tcp.zip'

[ ! -d /app/ovpn/config ] && mkdir -p /app/ovpn/config
# download and install the latest default recommended ovpn configs
wget -q https://www.privateinternetaccess.com/openvpn/openvpn-strong-tcp-nextgen.zip
unzip -uoq openvpn-strong-tcp-nextgen.zip -d /app/ovpn/config
rm -f openvpn-strong-tcp-nextgen.zip
wget -q $PIA_OVPN_CONFIG_URL -O pia_ovpn_configs.zip || (echo "ERROR: Failed to download PIA configuration files, exitting" && exit 1)
unzip -uoq pia_ovpn_configs.zip -d /app/ovpn/config
rm -f pia_ovpn_configs.zip

# copy configs to user mount
mkdir -p /config/pia
Expand All @@ -16,9 +19,14 @@ if [ -n "$UID" -a -n "$GID" ]; then
fi

if [ -n "$REGION" ]; then
REGION=$(echo $REGION | sed 's/ /_/g' | tr '[:upper:]' '[:lower:]')
if [[ ! -f "/config/pia/${REGION}.ovpn" ]]; then
echo "ERROR: OpenVPN configuration profile not found, check your REGION environment variable, see https://www.privateinternetaccess.com/pages/network/dkrpia for possible choices"
exit 1
fi
set -- "$@" '--config' "/config/pia/${REGION}.ovpn"
else
echo "No OpenVPN config found in /config/pia/${REGION}.ovpn. Exiting."
echo "REGION environment variable is not set. Exiting."
exit 1
fi

Expand Down

0 comments on commit 0b8827c

Please sign in to comment.