moving torguard config update to separate script

This commit is contained in:
Kristian Haugene
2016-09-02 22:26:31 +02:00
parent 8738a7277b
commit 3643e24434
2 changed files with 22 additions and 10 deletions

View File

@@ -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** \

View File

@@ -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