Improved regex as pr timetoexpire comment

This commit is contained in:
9cco 2022-02-26 02:46:48 +01:00
parent 9d2e7fcc8a
commit ebcc60faa3
1 changed files with 1 additions and 1 deletions

View File

@ -24,7 +24,7 @@ elif [[ $(command -v dig &> /dev/null; echo $?) ]]; then
ip=$(dig +short myip.opendns.com @resolver1.opendns.com);
fi
if [[ ! $ip =~ [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} ]]; then
if [[ ! $ip =~ ^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$ ]]; then
logger -s "DDNS Updater: Failed to find a valid IP."
exit 1
fi