Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
f594ed65
Unverified
Commit
f594ed65
authored
Mar 13, 2021
by
neil
Committed by
GitHub
Mar 13, 2021
Browse files
Merge pull request #3449 from anom-human/master
Update dns_servercow.sh to support wildcard certs
parents
52cfb9a0
5c4bfbbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_servercow.sh
View file @
f594ed65
...
@@ -49,16 +49,42 @@ dns_servercow_add() {
...
@@ -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
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment