From cf18efc081ca67e54c99e7941749e2b1101da049 Mon Sep 17 00:00:00 2001 From: MarkusMcNugen Date: Fri, 2 Feb 2018 23:36:40 -0500 Subject: [PATCH] Update start.sh --- openvpn/start.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openvpn/start.sh b/openvpn/start.sh index 7458e67..6878476 100755 --- a/openvpn/start.sh +++ b/openvpn/start.sh @@ -114,5 +114,19 @@ elif [[ $VPN_ENABLED == "no" ]]; then echo "[warn] !!IMPORTANT!! You have set the VPN to disabled, you will NOT be secure!" | ts '%Y-%m-%d %H:%M:%.S' fi +# split comma seperated string into list from NAME_SERVERS env variable +IFS=',' read -ra name_server_list <<< "${NAME_SERVERS}" + +# process name servers in the list +for name_server_item in "${name_server_list[@]}"; do + + # strip whitespace from start and end of lan_network_item + name_server_item=$(echo "${name_server_item}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~') + + echo "[info] Adding ${name_server_item} to resolv.conf" + echo "nameserver ${name_server_item}" >> /etc/resolv.conf + +done + echo "[info] Starting OpenVPN..." exec openvpn --config "$VPN_CONFIG"