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
6d5874fc
Unverified
Commit
6d5874fc
authored
Apr 01, 2018
by
neil
Committed by
GitHub
Apr 01, 2018
Browse files
Merge pull request #1448 from martgras/patch-3
dns_azure add support for validation record at domain apex
parents
3d563dea
9e3c931b
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_azure.sh
View file @
6d5874fc
...
@@ -76,10 +76,10 @@ dns_azure_add() {
...
@@ -76,10 +76,10 @@ dns_azure_add() {
values
=
"{
\"
value
\"
:[
\"
$txtvalue
\"
]}"
values
=
"{
\"
value
\"
:[
\"
$txtvalue
\"
]}"
timestamp
=
"
$(
_time
)
"
timestamp
=
"
$(
_time
)
"
if
[
"
$_code
"
=
"200"
]
;
then
if
[
"
$_code
"
=
"200"
]
;
then
vlist
=
"
$(
echo
"
$response
"
| _egrep_o
"
\"
value
\"\s
*:
\s
*
\
[
\s
*
\"
[^
\"
]*
\"\s
*]"
|
cut
-d
:
-f
2 |
tr
-d
"[]
\"
"
)
"
vlist
=
"
$(
echo
"
$response
"
| _egrep_o
"
\"
value
\"\
\
s*:
\
\
s*
\
\
[
\
\
s*
\"
[^
\"
]*
\"\
\
s*]"
|
cut
-d
:
-f
2 |
tr
-d
"[]
\"
"
)
"
_debug
"existing TXT found"
_debug
"existing TXT found"
_debug
"
$vlist
"
_debug
"
$vlist
"
existingts
=
"
$(
echo
"
$response
"
| _egrep_o
"
\"
acmetscheck
\"\s
*:
\s
*
\"
[^
\"
]*
\"
"
| _head_n 1 |
cut
-d
:
-f
2 |
tr
-d
"
\"
"
)
"
existingts
=
"
$(
echo
"
$response
"
| _egrep_o
"
\"
acmetscheck
\"\
\
s*:
\
\
s*
\"
[^
\"
]*
\"
"
| _head_n 1 |
cut
-d
:
-f
2 |
tr
-d
"
\"
"
)
"
if
[
-z
"
$existingts
"
]
;
then
if
[
-z
"
$existingts
"
]
;
then
# the record was not created by acme.sh. Copy the exisiting entires
# the record was not created by acme.sh. Copy the exisiting entires
existingts
=
$timestamp
existingts
=
$timestamp
...
@@ -172,7 +172,7 @@ dns_azure_rm() {
...
@@ -172,7 +172,7 @@ dns_azure_rm() {
_azure_rest GET
"
$acmeRecordURI
"
""
"
$accesstoken
"
_azure_rest GET
"
$acmeRecordURI
"
""
"
$accesstoken
"
timestamp
=
"
$(
_time
)
"
timestamp
=
"
$(
_time
)
"
if
[
"
$_code
"
=
"200"
]
;
then
if
[
"
$_code
"
=
"200"
]
;
then
vlist
=
"
$(
echo
"
$response
"
| _egrep_o
"
\"
value
\"\s
*:
\s
*
\
[
\s
*
\"
[^
\"
]*
\"\s
*]"
|
cut
-d
:
-f
2 |
tr
-d
"[]
\"
"
|
grep
-v
"
$txtvalue
"
)
"
vlist
=
"
$(
echo
"
$response
"
| _egrep_o
"
\"
value
\"\
\
s*:
\
\
s*
\
\
[
\
\
s*
\"
[^
\"
]*
\"\
\
s*]"
|
cut
-d
:
-f
2 |
tr
-d
"[]
\"
"
|
grep
-v
"
$txtvalue
"
)
"
values
=
""
values
=
""
comma
=
""
comma
=
""
for
v
in
$vlist
;
do
for
v
in
$vlist
;
do
...
@@ -230,7 +230,7 @@ _azure_rest() {
...
@@ -230,7 +230,7 @@ _azure_rest() {
fi
fi
_ret
=
"
$?
"
_ret
=
"
$?
"
_secure_debug2
"response
$response
"
_secure_debug2
"response
$response
"
_code
=
"
$(
grep
"^HTTP"
"
$HTTP_HEADER
"
| _tail_n 1 |
cut
-d
" "
-f
2 |
tr
-d
"
\
r
\n
"
)
"
_code
=
"
$(
grep
"^HTTP"
"
$HTTP_HEADER
"
| _tail_n 1 |
cut
-d
" "
-f
2 |
tr
-d
"
\
\
r
\
\
n"
)
"
_debug
"http response code
$_code
"
_debug
"http response code
$_code
"
if
[
"
$_code
"
=
"401"
]
;
then
if
[
"
$_code
"
=
"401"
]
;
then
# we have an invalid access token set to expired
# we have an invalid access token set to expired
...
@@ -308,7 +308,7 @@ _get_root() {
...
@@ -308,7 +308,7 @@ _get_root() {
domain
=
$1
domain
=
$1
subscriptionId
=
$2
subscriptionId
=
$2
accesstoken
=
$3
accesstoken
=
$3
i
=
2
i
=
1
p
=
1
p
=
1
## Ref: https://docs.microsoft.com/en-us/rest/api/dns/zones/list
## Ref: https://docs.microsoft.com/en-us/rest/api/dns/zones/list
...
@@ -328,9 +328,14 @@ _get_root() {
...
@@ -328,9 +328,14 @@ _get_root() {
fi
fi
if
_contains
"
$response
"
"
\"
name
\"
:
\"
$h
\"
"
>
/dev/null
;
then
if
_contains
"
$response
"
"
\"
name
\"
:
\"
$h
\"
"
>
/dev/null
;
then
_domain_id
=
$(
echo
"
$response
"
| _egrep_o
"
\{\"
id
\"
:
\"
[^
\"
]*
$h
\"
"
|
head
-n
1 |
cut
-d
:
-f
2 |
tr
-d
\"
)
_domain_id
=
$(
echo
"
$response
"
| _egrep_o
"
\
\
{
\"
id
\"
:
\"
[^
\"
]*
$h
\"
"
|
head
-n
1 |
cut
-d
:
-f
2 |
tr
-d
\"
)
if
[
"
$_domain_id
"
]
;
then
if
[
"
$_domain_id
"
]
;
then
_sub_domain
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
1-
$p
)
if
[
"
$i
"
=
1
]
;
then
#create the record at the domain apex (@) if only the domain name was provided as --domain-alias
_sub_domain
=
"@"
else
_sub_domain
=
$(
echo
"
$domain
"
|
cut
-d
.
-f
1-
$p
)
fi
_domain
=
$h
_domain
=
$h
return
0
return
0
fi
fi
...
...
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