From 2726a148ee8d34bf75ff3592a5cb0faa661b8fa7 Mon Sep 17 00:00:00 2001 From: Nyr Date: Thu, 19 Apr 2018 21:00:58 +0200 Subject: [PATCH] Remove IP address detection fallback It was never used, the one-liner is enough. --- openvpn-install.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) 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?"