created script that updated pia configs. also created a parent script that calls all provider specific scripts
This commit is contained in:
24
openvpn/pia/updateConfigs.sh
Executable file
24
openvpn/pia/updateConfigs.sh
Executable file
@@ -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
|
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
# If the script is called from elsewhere
|
# If the script is called from elsewhere
|
||||||
cd "${0%/*}"
|
cd "${0%/*}"
|
||||||
|
|
||||||
@@ -10,7 +12,7 @@ find . ! -name '*.sh' -delete
|
|||||||
curl -L https://torguard.net/downloads/OpenVPN-UDP.zip -o OpenVPN-UDP.zip \
|
curl -L https://torguard.net/downloads/OpenVPN-UDP.zip -o OpenVPN-UDP.zip \
|
||||||
&& unzip -j OpenVPN-UDP.zip && rm 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
|
rename 's/^TorGuard\.//' *.ovpn
|
||||||
dos2unix *
|
dos2unix *
|
||||||
|
|
||||||
|
11
openvpn/updateConfigs.sh
Executable file
11
openvpn/updateConfigs.sh
Executable file
@@ -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 {} \;
|
Reference in New Issue
Block a user