Skip to content

Commit

Permalink
Addresses Nyr#694
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Nyr committed Apr 21, 2020
1 parent cec053d commit f659724
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion openvpn-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f659724

Please sign in to comment.