mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-22 13:11:41 +00:00
Merge pull request #3449 from anom-human/master
Update dns_servercow.sh to support wildcard certs
This commit is contained in:
commit
f594ed659e
@ -49,16 +49,42 @@ dns_servercow_add() {
|
|||||||
_debug _sub_domain "$_sub_domain"
|
_debug _sub_domain "$_sub_domain"
|
||||||
_debug _domain "$_domain"
|
_debug _domain "$_domain"
|
||||||
|
|
||||||
if _servercow_api POST "$_domain" "{\"type\":\"TXT\",\"name\":\"$fulldomain\",\"content\":\"$txtvalue\",\"ttl\":20}"; then
|
# check whether a txt record already exists for the subdomain
|
||||||
if printf -- "%s" "$response" | grep "ok" >/dev/null; then
|
if printf -- "%s" "$response" | grep "{\"name\":\"$_sub_domain\",\"ttl\":20,\"type\":\"TXT\"" >/dev/null; then
|
||||||
_info "Added, OK"
|
_info "A txt record with the same name already exists."
|
||||||
return 0
|
# trim the string on the left
|
||||||
else
|
txtvalue_old=${response#*{\"name\":\"$_sub_domain\",\"ttl\":20,\"type\":\"TXT\",\"content\":\"}
|
||||||
_err "add txt record error."
|
# trim the string on the right
|
||||||
return 1
|
txtvalue_old=${txtvalue_old%%\"*}
|
||||||
|
|
||||||
|
_debug txtvalue_old "$txtvalue_old"
|
||||||
|
|
||||||
|
_info "Add the new txtvalue to the existing txt record."
|
||||||
|
if _servercow_api POST "$_domain" "{\"type\":\"TXT\",\"name\":\"$fulldomain\",\"content\":[\"$txtvalue\",\"$txtvalue_old\"],\"ttl\":20}"; then
|
||||||
|
if printf -- "%s" "$response" | grep "ok" >/dev/null; then
|
||||||
|
_info "Added additional txtvalue, OK"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_err "add txt record error."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
_err "add txt record error."
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
_info "There is no txt record with the name yet."
|
||||||
|
if _servercow_api POST "$_domain" "{\"type\":\"TXT\",\"name\":\"$fulldomain\",\"content\":\"$txtvalue\",\"ttl\":20}"; then
|
||||||
|
if printf -- "%s" "$response" | grep "ok" >/dev/null; then
|
||||||
|
_info "Added, OK"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_err "add txt record error."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
_err "add txt record error."
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
_err "add txt record error."
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user