From f99dd3f63d99bcde25b45a46e3db2ae4b1f1f405 Mon Sep 17 00:00:00 2001 From: Angristan <11699655+Angristan@users.noreply.github.com> Date: Thu, 19 Jul 2018 20:00:57 +0200 Subject: [PATCH] Update IPv4 regex --- openvpn-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 178c700..9d5d3f5 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -268,11 +268,11 @@ else done if [[ $DNS == "10" ]]; then # Get DNS IP and validate - until [[ "$DNS1" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; do + until [[ "$DNS1" =~ ^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ ]]; do read -rp "Primary DNS: " -e DNS1 done echo "Optionally add secondary DNS (recommended)" - until [[ "$DNS2" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; do + until [[ "$DNS2" =~ ^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ ]]; do read -rp "Secondary DNS: " -e DNS2 if [[ "$DNS2" == "" ]]; then break