|
@ -61,7 +61,6 @@ dns_miab_add() { |
|
|
_err "$result" |
|
|
_err "$result" |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#Usage: fulldomain txtvalue |
|
|
#Usage: fulldomain txtvalue |
|
@ -101,7 +100,7 @@ dns_miab_rm() { |
|
|
#Remove the challenge record |
|
|
#Remove the challenge record |
|
|
result="$(_miab_post "$txtvalue" "$baseurl" "" "DELETE" "" "$MIAB_Username" "$MIAB_Password")" |
|
|
result="$(_miab_post "$txtvalue" "$baseurl" "" "DELETE" "" "$MIAB_Username" "$MIAB_Password")" |
|
|
|
|
|
|
|
|
_debug result $result |
|
|
|
|
|
|
|
|
_debug result "$result" |
|
|
|
|
|
|
|
|
#check if result was good |
|
|
#check if result was good |
|
|
if _contains "$result" "updated DNS"; then |
|
|
if _contains "$result" "updated DNS"; then |
|
@ -115,43 +114,7 @@ dns_miab_rm() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#################### Private functions below ################################## |
|
|
#################### Private functions below ################################## |
|
|
#_acme-challenge.www.domain.com |
|
|
|
|
|
#returns |
|
|
|
|
|
# _sub_domain=_acme-challenge.www |
|
|
|
|
|
# _domain=domain.com |
|
|
|
|
|
# _domain_id=sdjkglgdfewsdfg |
|
|
|
|
|
_get_root() { |
|
|
|
|
|
domain=$1 |
|
|
|
|
|
i=2 |
|
|
|
|
|
p=1 |
|
|
|
|
|
|
|
|
|
|
|
while true; do |
|
|
|
|
|
h=$(printf "%s" "$domain" | cut -d . -f $i-100) |
|
|
|
|
|
_debug h "$h" |
|
|
|
|
|
if [ -z "$h" ]; then |
|
|
|
|
|
#not valid |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if _contains "$response" "\"name\":\"$h\"" >/dev/null; then |
|
|
|
|
|
_domain_id=$(printf "%s\n" "$response" | _egrep_o "\[.\"id\":\"[^\"]*\"" | head -n 1 | cut -d : -f 2 | tr -d \") |
|
|
|
|
|
|
|
|
|
|
|
if [ "$_domain_id" ]; then |
|
|
|
|
|
_sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-$p) |
|
|
|
|
|
_domain=$h |
|
|
|
|
|
return 0 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
p=$i |
|
|
|
|
|
i=$(_math "$i" + 1) |
|
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
return 1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
# post changes to MIAB dns (taken from acme.sh) |
|
|
# post changes to MIAB dns (taken from acme.sh) |
|
|
_miab_post() { |
|
|
_miab_post() { |
|
|
body="$1" |
|
|
body="$1" |
|
|