From ca29fd76e9b2af1491583f22669c3a9f1605b27d Mon Sep 17 00:00:00 2001 From: nachootal <nachootal@gmail.com> Date: Wed, 20 Mar 2019 20:33:04 +0000 Subject: [PATCH] Adding autodetection of the external IP using ifconfig.co --- openvpn-install.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 45ebe1b..abf8f0b 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -180,7 +180,14 @@ else if echo "$IP" | grep -qE '^(10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.|192\.168)'; then echo echo "This server is behind NAT. What is the public IPv4 address or hostname?" - read -p "Public IP address / hostname: " -e PUBLICIP + PUBLICIP=$(curl -s ifconfig.co) + echo "If you just hit enter, autodetected $PUBLICIP will be used." + read -p "Public IP address / hostname: " -e INPUTPUBLICIP + if [ ! -z "$(INPUTPUBLICIP)"] + then + PUBLICIP=$INPUTPUBLICIP + fi + echo "Public IP set to: $PUBLICIP" fi echo echo "Which protocol do you want for OpenVPN connections?"