From f659724a6f222bfbd03f5399426f2dbe97ec5f6b Mon Sep 17 00:00:00 2001 From: Nyr Date: Tue, 21 Apr 2020 16:45:49 +0200 Subject: [PATCH] Addresses #694 - Use a checkip service which works fine over HTTP to avoid issues in systems where ca-certificates is not available - Increase timeout to 10 seconds, because the new service is a bit slower from some locations - Improve grep sanitization --- openvpn-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index f5c1c38..d35419c 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -100,7 +100,7 @@ if [[ ! -e /etc/openvpn/server/server.conf ]]; then echo echo "This server is behind NAT. What is the public IPv4 address or hostname?" # Get public IP and sanitize with grep - get_public_ip=$(grep -oE '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' <<< "$(wget -T 5 -t 1 -4qO- "https://checkip.amazonaws.com/" || curl -m 5 -4Ls "https://checkip.amazonaws.com/")") + get_public_ip=$(grep -m 1 -oE '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' <<< "$(wget -T 10 -t 1 -4qO- "http://ip1.dynupdate.no-ip.com/" || curl -m 10 -4Ls "http://ip1.dynupdate.no-ip.com/")") read -p "Public IPv4 address / hostname [$get_public_ip]: " public_ip # If the checkip service is unavailable and user didn't provide input, ask again until [[ -n "$get_public_ip" || -n $public_ip ]]; do