diff --git a/Dockerfile b/Dockerfile index dc4660de6..2dcfa28a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,16 +26,6 @@ RUN apt-get update \ ADD openvpn/ /etc/openvpn/ ADD transmission/ /etc/transmission/ -# Get updated configuration from TorGuard -RUN curl -L https://torguard.net/downloads/OpenVPN-UDP.zip -o OpenVPN-UDP.zip \ - && unzip OpenVPN-UDP.zip -RUN find OpenVPN\ -UDP/ -name *.ovpn | cut -d . -f 2- | xargs -n 1 -I '{}' cp ./OpenVPN\ -UDP/TorGuard.'{}' /etc/openvpn/torguard/'{}' -RUN cp OpenVPN\ -UDP/ca.crt /etc/openvpn/torguard/ca.crt \ - && rm -rf OpenVPN\ -UDP/ \ - && rm OpenVPN-UDP.zip \ - && sed -i "s/ca ca.crt/ca \/etc\/openvpn\/torguard\/ca.crt/" /etc/openvpn/torguard/*.ovpn \ - && sed -i "s/auth-user-pass/auth-user-pass \/config\/openvpn-credentials.txt/" /etc/openvpn/torguard/*.ovpn - ENV OPENVPN_USERNAME=**None** \ OPENVPN_PASSWORD=**None** \ OPENVPN_PROVIDER=**None** \ diff --git a/openvpn/torguard/updateConfigs.sh b/openvpn/torguard/updateConfigs.sh new file mode 100755 index 000000000..e37cfe376 --- /dev/null +++ b/openvpn/torguard/updateConfigs.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# If the script is called from elsewhere +cd "${0%/*}" + +# Delete everything (not this script though) +find . ! -name '*.sh' -delete + +# Get updated configuration zip from TorGuard +curl -L https://torguard.net/downloads/OpenVPN-UDP.zip -o OpenVPN-UDP.zip \ + && unzip -j OpenVPN-UDP.zip && rm OpenVPN-UDP.zip + +# Remove TorGuard prefix of config files +rename 's/^TorGuard\.//' *.ovpn + +# Update configs with correct paths +sed -i "s/ca ca.crt/ca \/etc\/openvpn\/torguard\/ca.crt/" *.ovpn +sed -i "s/tls-auth ta.key/tls-auth \/etc\/openvpn\/torguard\/ta.key/" *.ovpn +sed -i "s/auth-user-pass/auth-user-pass \/config\/openvpn-credentials.txt/" *.ovpn + +# Create symlink for default.ovpn +ln -s Netherlands.ovpn default.ovpn