Firewall Changes

This commit is contained in:
Mike Reeves
2022-09-22 16:32:09 -04:00
parent 3100efc954
commit 81f79c3a02
2 changed files with 17 additions and 12 deletions
+12
View File
@@ -507,6 +507,18 @@ valid_hostname() {
[[ $hostname =~ ^[a-zA-Z0-9\-]+$ ]] && [[ $hostname != 'localhost' ]] && return 0 || return 1
}
verify_ip4() {
local ip=$1
# Is this an IP or CIDR?
if grep -qP "^[^/]+/[^/]+$" <<< $ip; then
# Looks like a CIDR
valid_ip4_cidr_mask "$ip"
else
# We know this is not a CIDR - Is it an IP?
valid_ip4 "$ip"
fi
}
valid_ip4() {
local ip=$1