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
5bb518ff
Commit
5bb518ff
authored
Jan 07, 2017
by
neil
Committed by
GitHub
Jan 07, 2017
Browse files
Merge pull request #512 from ksperling/dnsaws
Add support for AWS_SESSION_TOKEN and fix bug when multiple hosted zones exist
parents
058e5d5f
5415381c
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_aws.sh
View file @
5bb518ff
...
...
@@ -27,8 +27,10 @@ dns_aws_add() {
return
1
fi
_saveaccountconf AWS_ACCESS_KEY_ID
"
$AWS_ACCESS_KEY_ID
"
_saveaccountconf AWS_SECRET_ACCESS_KEY
"
$AWS_SECRET_ACCESS_KEY
"
if
[
-z
"
$AWS_SESSION_TOKEN
"
]
;
then
_saveaccountconf AWS_ACCESS_KEY_ID
"
$AWS_ACCESS_KEY_ID
"
_saveaccountconf AWS_SECRET_ACCESS_KEY
"
$AWS_SECRET_ACCESS_KEY
"
fi
_debug
"First detect the root zone"
if
!
_get_root
"
$fulldomain
"
;
then
...
...
@@ -91,7 +93,7 @@ _get_root() {
fi
if
_contains
"
$response
"
"<Name>
$h
.</Name>"
;
then
hostedzone
=
"
$(
echo
"
$response
"
|
sed
's/<HostedZone>/\n&/g'
| _egrep_o
"<HostedZone>.*<Name>
$h
.<.Name>.*<.HostedZone>"
)
"
hostedzone
=
"
$(
echo
"
$response
"
|
sed
's/<HostedZone>/\n&/g'
| _egrep_o
"<HostedZone>.*
?
<Name>
$h
.<.Name>.*
?
<.HostedZone>"
)
"
_debug hostedzone
"
$hostedzone
"
if
[
-z
"
$hostedzone
"
]
;
then
_err
"Error, can not get hostedzone."
...
...
@@ -139,9 +141,13 @@ aws_rest() {
aws_host
=
"
$AWS_HOST
"
CanonicalHeaders
=
"host:
$aws_host
\n
x-amz-date:
$RequestDate
\n
"
_debug2 CanonicalHeaders
"
$CanonicalHeaders
"
SignedHeaders
=
"host;x-amz-date"
if
[
-n
"
$AWS_SESSION_TOKEN
"
]
;
then
_H2
=
"x-amz-security-token:
$AWS_SESSION_TOKEN
"
CanonicalHeaders
=
"
${
CanonicalHeaders
}
x-amz-security-token:
$AWS_SESSION_TOKEN
\n
"
SignedHeaders
=
"
${
SignedHeaders
}
;x-amz-security-token"
fi
_debug2 CanonicalHeaders
"
$CanonicalHeaders
"
_debug2 SignedHeaders
"
$SignedHeaders
"
RequestPayload
=
"
$data
"
...
...
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