diff --git a/openvpn-install.sh b/openvpn-install.sh index 4a426af..7faedd6 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -59,14 +59,6 @@ newclient () { echo "" >> ~/$1.ovpn } -# Try to get our IP from the system and fallback to the Internet. -# I do this to make the script compatible with NATed servers (lowendspirit.com) -# and to avoid getting an IPv6. -IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) -if [[ "$IP" = "" ]]; then - IP=$(wget -4qO- "http://whatismyip.akamai.com/") -fi - if [[ -e /etc/openvpn/server.conf ]]; then while : do @@ -187,6 +179,8 @@ else echo "" echo "First I need to know the IPv4 address of the network interface you want OpenVPN" echo "listening to." + # Autodetect IP address and pre-fill for the user + IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) read -p "IP address: " -e -i $IP IP echo "" echo "Which protocol do you want for OpenVPN connections?"