From a52fe2edbd4f4354eb5007c0b5c252000052d91d Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Fri, 2 Sep 2016 22:54:30 +0200 Subject: [PATCH] created script that updated pia configs. also created a parent script that calls all provider specific scripts --- openvpn/pia/updateConfigs.sh | 24 ++++++++++++++++++++++++ openvpn/torguard/updateConfigs.sh | 4 +++- openvpn/updateConfigs.sh | 11 +++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 openvpn/pia/updateConfigs.sh create mode 100755 openvpn/updateConfigs.sh diff --git a/openvpn/pia/updateConfigs.sh b/openvpn/pia/updateConfigs.sh new file mode 100755 index 000000000..6ca92fb66 --- /dev/null +++ b/openvpn/pia/updateConfigs.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +# If the script is called from elsewhere +cd "${0%/*}" + +# Delete everything (not this script though) +find . ! -name '*.sh' -delete + +# Get updated configuration zip +curl -kL https://www.privateinternetaccess.com/openvpn/openvpn.zip -o openvpn.zip \ + && unzip -j openvpn.zip && rm openvpn.zip + +# Ensure linux line endings +dos2unix * + +# Update configs with correct paths +sed -i "s/ca ca\.rsa\.2048\.crt/ca \/etc\/openvpn\/pia\/ca\.rsa\.2048\.crt/" *.ovpn +sed -i "s/crl-verify crl\.rsa\.2048\.pem/crl-verify \/etc\/openvpn\/pia\/crl\.rsa\.2048\.pem/" *.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 diff --git a/openvpn/torguard/updateConfigs.sh b/openvpn/torguard/updateConfigs.sh index c6c324c4c..d6354b794 100755 --- a/openvpn/torguard/updateConfigs.sh +++ b/openvpn/torguard/updateConfigs.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + # If the script is called from elsewhere cd "${0%/*}" @@ -10,7 +12,7 @@ find . ! -name '*.sh' -delete 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 and fix line endings +# Remove TorGuard prefix of config files and ensure linux line endings rename 's/^TorGuard\.//' *.ovpn dos2unix * diff --git a/openvpn/updateConfigs.sh b/openvpn/updateConfigs.sh new file mode 100755 index 000000000..310a1d950 --- /dev/null +++ b/openvpn/updateConfigs.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +# Parent script for updating OpenVPN configs + +# If the script is called from elsewhere +cd "${0%/*}" + +# Finds all provider specific update scripts and calls them +find . -mindepth 2 -maxdepth 2 -name 'updateConfigs.sh' -exec /bin/bash {} \; \ No newline at end of file