Felipe W Damasio
3 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
11 additions and
13 deletions
-
dnsapi/dns_knot.sh
|
@ -84,19 +84,17 @@ EOF |
|
|
# _domain=domain.com |
|
|
# _domain=domain.com |
|
|
_get_root() { |
|
|
_get_root() { |
|
|
domain=$1 |
|
|
domain=$1 |
|
|
i="$(echo "$fulldomain" | tr '.' ' ' | wc -w)" |
|
|
|
|
|
i=$(_math "$i" - 1) |
|
|
|
|
|
|
|
|
|
|
|
while true; do |
|
|
|
|
|
h=$(printf "%s" "$domain" | cut -d . -f "$i"-100) |
|
|
|
|
|
if [ -z "$h" ]; then |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
_domain="$h" |
|
|
|
|
|
return 0 |
|
|
|
|
|
done |
|
|
|
|
|
_debug "$domain not found" |
|
|
|
|
|
return 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
d=$(dig soa "$domain" | grep -v ^\; | grep SOA | awk '{print $1}') |
|
|
|
|
|
if [ -z "${d}" ]; then |
|
|
|
|
|
_debug "$domain not found" |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
d=${d%?} # remove last '.' |
|
|
|
|
|
|
|
|
|
|
|
_domain="$d" |
|
|
|
|
|
return 0 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
_checkKey() { |
|
|
_checkKey() { |
|
|