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
This commit is contained in:
@@ -43,6 +43,9 @@ ADD tinyproxy /opt/tinyproxy/
|
|||||||
ENV OPENVPN_USERNAME=**None** \
|
ENV OPENVPN_USERNAME=**None** \
|
||||||
OPENVPN_PASSWORD=**None** \
|
OPENVPN_PASSWORD=**None** \
|
||||||
OPENVPN_PROVIDER=**None** \
|
OPENVPN_PROVIDER=**None** \
|
||||||
|
NORDVPN_COUNTRY= \
|
||||||
|
NORDVPN_PROTOCOL=TCP \
|
||||||
|
NORDVPN_CATEGORY=P2P \
|
||||||
GLOBAL_APPLY_PERMISSIONS=true \
|
GLOBAL_APPLY_PERMISSIONS=true \
|
||||||
TRANSMISSION_ALT_SPEED_DOWN=50 \
|
TRANSMISSION_ALT_SPEED_DOWN=50 \
|
||||||
TRANSMISSION_ALT_SPEED_ENABLED=false \
|
TRANSMISSION_ALT_SPEED_ENABLED=false \
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
country_filter() { # curl -s "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | [.code, .name] | @tsv'
|
country_filter() { # curl -s "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | [.code, .name] | @tsv'
|
||||||
local nordvpn_api=$1 country=(${COUNTRY//[;,]/ })
|
local nordvpn_api=$1 country=(${NORDVPN_COUNTRY//[;,]/ })
|
||||||
if [[ ${#country[@]} -ge 1 ]]; then
|
if [[ ${#country[@]} -ge 1 ]]; then
|
||||||
country=${country[0]//_/ }
|
country=${country[0]//_/ }
|
||||||
local country_id=`curl -s "${nordvpn_api}/v1/servers/countries" | jq --raw-output ".[] |
|
local country_id=`curl -s "${nordvpn_api}/v1/servers/countries" | jq --raw-output ".[] |
|
||||||
@@ -15,7 +15,7 @@ country_filter() { # curl -s "https://api.nordvpn.com/v1/servers/countries" | jq
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
group_filter() { # curl -s "https://api.nordvpn.com/v1/servers/groups" | jq --raw-output '.[] | [.identifier, .title] | @tsv'
|
group_filter() { # curl -s "https://api.nordvpn.com/v1/servers/groups" | jq --raw-output '.[] | [.identifier, .title] | @tsv'
|
||||||
local nordvpn_api=$1 category=(${CATEGORY//[;,]/ })
|
local nordvpn_api=$1 category=(${NORDVPN_CATEGORY//[;,]/ })
|
||||||
if [[ ${#category[@]} -ge 1 ]]; then
|
if [[ ${#category[@]} -ge 1 ]]; then
|
||||||
category=${category[0]//_/ }
|
category=${category[0]//_/ }
|
||||||
local identifier=`curl -s "${nordvpn_api}/v1/servers/groups" | jq --raw-output ".[] |
|
local identifier=`curl -s "${nordvpn_api}/v1/servers/groups" | jq --raw-output ".[] |
|
||||||
@@ -30,9 +30,9 @@ group_filter() { # curl -s "https://api.nordvpn.com/v1/servers/groups" | jq --ra
|
|||||||
|
|
||||||
technology_filter() { # curl -s "https://api.nordvpn.com/v1/technologies" | jq --raw-output '.[] | [.identifier, .name ] | @tsv' | grep openvpn
|
technology_filter() { # curl -s "https://api.nordvpn.com/v1/technologies" | jq --raw-output '.[] | [.identifier, .name ] | @tsv' | grep openvpn
|
||||||
local identifier
|
local identifier
|
||||||
if [[ ${PROTOCOL,,} =~ .*udp.* ]]; then
|
if [[ ${NORDVPN_PROTOCOL,,} =~ .*udp.* ]]; then
|
||||||
identifier="openvpn_udp"
|
identifier="openvpn_udp"
|
||||||
elif [[ ${PROTOCOL,,} =~ .*tcp.* ]];then
|
elif [[ ${NORDVPN_PROTOCOL,,} =~ .*tcp.* ]];then
|
||||||
identifier="openvpn_tcp"
|
identifier="openvpn_tcp"
|
||||||
fi
|
fi
|
||||||
if [[ -n ${identifier} ]]; then
|
if [[ -n ${identifier} ]]; then
|
||||||
@@ -59,9 +59,5 @@ select_hostname() { #TODO return multiples
|
|||||||
echo ${hostname}
|
echo ${hostname}
|
||||||
}
|
}
|
||||||
|
|
||||||
COUNTRY="United_States"
|
# Select recommended VPN
|
||||||
|
echo "$(select_hostname).${NORDVPN_PROTOCOL,,}"
|
||||||
PROTOCOL="UDP"
|
|
||||||
CATEGORY="P2P"
|
|
||||||
|
|
||||||
echo "$(select_hostname).${PROTOCOL,,}"
|
|
@@ -1,5 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
TIME_FORMAT=`date "+%Y-%m-%d %H:%M:%S"`
|
TIME_FORMAT=`date "+%Y-%m-%d %H:%M:%S"`
|
||||||
|
|
||||||
@@ -21,8 +20,8 @@ script_init() {
|
|||||||
log "Checking curl installation"
|
log "Checking curl installation"
|
||||||
script_needs curl
|
script_needs curl
|
||||||
|
|
||||||
log "Checking dos2unix installation"
|
# log "Checking dos2unix installation"
|
||||||
script_needs dos2unix
|
# script_needs dos2unix
|
||||||
|
|
||||||
log "Checking unzip installation"
|
log "Checking unzip installation"
|
||||||
script_needs unzip
|
script_needs unzip
|
||||||
@@ -31,20 +30,23 @@ script_init() {
|
|||||||
script_init
|
script_init
|
||||||
|
|
||||||
# If the script is called from elsewhere
|
# If the script is called from elsewhere
|
||||||
cd "${0%/*}"
|
cd "${VPN_PROVIDER_CONFIGS}"
|
||||||
|
|
||||||
# Delete everything (not this script though)
|
# Delete everything (not this script though)
|
||||||
log "Removing existing configs"
|
log "Removing existing configs"
|
||||||
find . ! -name '*.sh' -delete
|
find . ! -name '*.sh' -type f -delete
|
||||||
|
|
||||||
# Get updated configuration zip
|
# Get updated configuration zip
|
||||||
log "Downloading latest configs"
|
log "Downloading latest configs"
|
||||||
curl -skL https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip -o openvpn.zip \
|
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
|
&& unzip -j openvpn.zip $1 >/dev/null 2>&1 && rm openvpn.zip
|
||||||
|
|
||||||
|
|
||||||
# Ensure linux line endings
|
# Ensure linux line endings
|
||||||
log "Checking line endings"
|
log "Checking line endings"
|
||||||
dos2unix * $1 >/dev/null 2>&1
|
# 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
|
# Update configs with correct options
|
||||||
log "Updating configs for docker-transmission-openvpn"
|
log "Updating configs for docker-transmission-openvpn"
|
||||||
@@ -57,4 +59,6 @@ sed -i 's/ping-timer-rem//g' *.ovpn
|
|||||||
# Pick a random file config for default.ovpn
|
# Pick a random file config for default.ovpn
|
||||||
random_config=$(ls uk*udp* | sort -R | head -n1)
|
random_config=$(ls uk*udp* | sort -R | head -n1)
|
||||||
log "Setting default.ovpn to $random_config"
|
log "Setting default.ovpn to $random_config"
|
||||||
ln -s $random_config default.ovpn
|
ln -s $random_config default.ovpn
|
||||||
|
|
||||||
|
cd "${0%/*}"
|
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
VPN_PROVIDER="${OPENVPN_PROVIDER,,}"
|
VPN_PROVIDER="${OPENVPN_PROVIDER,,}"
|
||||||
VPN_PROVIDER_CONFIGS="/etc/openvpn/${VPN_PROVIDER}"
|
VPN_PROVIDER_CONFIGS="/etc/openvpn/${VPN_PROVIDER}"
|
||||||
|
export VPN_PROVIDER_CONFIGS
|
||||||
|
|
||||||
# If create_tun_device is set, create /dev/net/tun
|
# If create_tun_device is set, create /dev/net/tun
|
||||||
if [[ "${CREATE_TUN_DEVICE,,}" == "true" ]]; then
|
if [[ "${CREATE_TUN_DEVICE,,}" == "true" ]]; then
|
||||||
@@ -32,7 +33,9 @@ if [[ "$OPENVPN_PROVIDER" = "NORDVPN" ]]
|
|||||||
then
|
then
|
||||||
if [[ -z "$OPENVPN_CONFIG" ]]
|
if [[ -z "$OPENVPN_CONFIG" ]]
|
||||||
then
|
then
|
||||||
export OPENVPN_CONFIG=$(./NordVPN.sh)
|
# Update config files
|
||||||
|
. ${VPN_PROVIDER_CONFIGS}/updateConfigs.sh
|
||||||
|
export OPENVPN_CONFIG=$(${VPN_PROVIDER_CONFIGS}/NordVPN_Server_Selector.sh)
|
||||||
echo "Setting best server ${OPENVPN_CONFIG}"
|
echo "Setting best server ${OPENVPN_CONFIG}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user