Files
docker-deluge-openvpn/openvpn/nordvpn/updateConfigs.sh
Tom Humphrey 04b117c521 Update NordVPN.sh
Added NordVPN Variables to docker file

Update start.sh

Update NordVPN.sh

Update NordVPN configs on run

NordVPN was missing server files. Have updated to run the nordvpn updateConfigs.sh script on start

Update NordVPN_Server_Selector.sh

Update start.sh

Moved Selector script to NordVPN directory

Update NordVPN_Server_Selector.sh

Update NordVPN_Server_Selector.sh

Update updateConfigs.sh

Update updateConfigs.sh

Added auto-update of NordVPN

container will auto-update NordVPN files on start. This increases the start up time by a bit. But ensures that all configs are present for the auto-selector script

Create default.ovpn

Update default.ovpn
2019-03-09 21:48:47 +00:00

64 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
set -e
TIME_FORMAT=`date "+%Y-%m-%d %H:%M:%S"`
log() {
printf "${TIME_FORMAT} %b\n" "$*";
}
fatal_error() {
printf "${TIME_FORMAT} \e[41mERROR:\033[0m %b\n" "$*" >&2;
exit 1
}
# check for utils
script_needs() {
command -v $1 >/dev/null 2>&1 || fatal_error "This script requires $1 but it's not installed. Please install it and run again."
}
script_init() {
log "Checking curl installation"
script_needs curl
# log "Checking dos2unix installation"
# script_needs dos2unix
log "Checking unzip installation"
script_needs unzip
}
script_init
# If the script is called from elsewhere
cd "${VPN_PROVIDER_CONFIGS}"
# Delete everything (not this script though)
log "Removing existing configs"
find . ! -name '*.sh' -type f -delete
# Get updated configuration zip
log "Downloading latest configs"
curl -skL https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip -o openvpn.zip \
&& unzip -j openvpn.zip $1 >/dev/null 2>&1 && rm openvpn.zip
# Ensure linux line endings
log "Checking line endings"
# dos2unix * $1 >/dev/null 2>&1
# find . -name '*.ovpn' -type f -print 0 | xargs -0 sed -i 's/^M$//'
find ${VPN_PROVIDER_CONFIGS} -name '*.ovpn' -type f -exec sed -i 's/^M$//' {} \;
# Update configs with correct options
log "Updating configs for docker-transmission-openvpn"
sed -i 's=auth-user-pass=auth-user-pass /config/openvpn-credentials.txt=g' *.ovpn
sed -i 's/ping 15/inactive 3600\
ping 10/g' *.ovpn
sed -i 's/ping-restart 0/ping-exit 60/g' *.ovpn
sed -i 's/ping-timer-rem//g' *.ovpn
# Pick a random file config for default.ovpn
random_config=$(ls uk*udp* | sort -R | head -n1)
log "Setting default.ovpn to $random_config"
ln -s $random_config default.ovpn
cd "${0%/*}"