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
16d79eba
Commit
16d79eba
authored
Nov 20, 2016
by
neilpang
Browse files
fix format
parent
e009ec8b
Changes
2
Hide whitespace changes
Inline
Side-by-side
acme.sh
View file @
16d79eba
...
@@ -335,7 +335,7 @@ _hex() {
...
@@ -335,7 +335,7 @@ _hex() {
_str_len
=
${#
_str
}
_str_len
=
${#
_str
}
_h_i
=
1
_h_i
=
1
while
[
"
$_h_i
"
-le
"
$_str_len
"
]
;
do
while
[
"
$_h_i
"
-le
"
$_str_len
"
]
;
do
_str_c
=
"
$(
printf
"%s"
"
$_str
"
|
cut
-c
"
$_h_i
"
)
"
_str_c
=
"
$(
printf
"%s"
"
$_str
"
|
cut
-c
"
$_h_i
"
)
"
printf
"%02x"
"'
$_str_c
"
printf
"%02x"
"'
$_str_c
"
_h_i
=
"
$(
_math
"
$_h_i
"
+ 1
)
"
_h_i
=
"
$(
_math
"
$_h_i
"
+ 1
)
"
done
done
...
...
dnsapi/dns_aws.sh
View file @
16d79eba
...
@@ -40,31 +40,28 @@ dns_aws_add() {
...
@@ -40,31 +40,28 @@ dns_aws_add() {
_debug _domain
"
$_domain
"
_debug _domain
"
$_domain
"
_aws_tmpl_xml
=
"<ChangeResourceRecordSetsRequest xmlns=
\"
https://route53.amazonaws.com/doc/2013-04-01/
\"
><ChangeBatch><Changes><Change><Action>UPSERT</Action><ResourceRecordSet><Name>
$fulldomain
</Name><Type>TXT</Type><TTL>300</TTL><ResourceRecords><ResourceRecord><Value>
\"
$txtvalue
\"
</Value></ResourceRecord></ResourceRecords></ResourceRecordSet></Change></Changes></ChangeBatch></ChangeResourceRecordSetsRequest>"
_aws_tmpl_xml
=
"<ChangeResourceRecordSetsRequest xmlns=
\"
https://route53.amazonaws.com/doc/2013-04-01/
\"
><ChangeBatch><Changes><Change><Action>UPSERT</Action><ResourceRecordSet><Name>
$fulldomain
</Name><Type>TXT</Type><TTL>300</TTL><ResourceRecords><ResourceRecord><Value>
\"
$txtvalue
\"
</Value></ResourceRecord></ResourceRecords></ResourceRecordSet></Change></Changes></ChangeBatch></ChangeResourceRecordSetsRequest>"
if
aws_rest POST
"2013-04-01
$_domain_id
/rrset/"
""
"
$_aws_tmpl_xml
"
&&
_contains
"
$response
"
"ChangeResourceRecordSetsResponse"
;
then
if
aws_rest POST
"2013-04-01
$_domain_id
/rrset/"
""
"
$_aws_tmpl_xml
"
&&
_contains
"
$response
"
"ChangeResourceRecordSetsResponse"
;
then
_info
"txt record updated sucess."
_info
"txt record updated sucess."
return
0
return
0
fi
fi
return
1
;
return
1
}
}
#fulldomain
#fulldomain
dns_aws_rm
()
{
dns_aws_rm
()
{
fulldomain
=
$1
fulldomain
=
$1
}
}
#################### Private functions bellow ##################################
#################### Private functions bellow ##################################
_get_root
()
{
_get_root
()
{
domain
=
$1
domain
=
$1
i
=
2
i
=
2
p
=
1
p
=
1
if
aws_rest GET
"2013-04-01/hostedzone"
;
then
if
aws_rest GET
"2013-04-01/hostedzone"
;
then
_debug
"response"
"
$response
"
_debug
"response"
"
$response
"
while
true
;
do
while
true
;
do
...
@@ -96,7 +93,6 @@ _get_root() {
...
@@ -96,7 +93,6 @@ _get_root() {
return
1
return
1
}
}
#method uri qstr data
#method uri qstr data
aws_rest
()
{
aws_rest
()
{
mtd
=
"
$1
"
mtd
=
"
$1
"
...
@@ -137,13 +133,13 @@ aws_rest() {
...
@@ -137,13 +133,13 @@ aws_rest() {
CanonicalRequest
=
"
$mtd
\n
$CanonicalURI
\n
$CanonicalQueryString
\n
$CanonicalHeaders
\n
$SignedHeaders
\n
$(
printf
"%s"
"
$RequestPayload
"
| _digest
"
$Hash
"
hex
)
"
CanonicalRequest
=
"
$mtd
\n
$CanonicalURI
\n
$CanonicalQueryString
\n
$CanonicalHeaders
\n
$SignedHeaders
\n
$(
printf
"%s"
"
$RequestPayload
"
| _digest
"
$Hash
"
hex
)
"
_debug2 CanonicalRequest
"
$CanonicalRequest
"
_debug2 CanonicalRequest
"
$CanonicalRequest
"
HashedCanonicalRequest
=
"
$(
printf
"
$CanonicalRequest
%s"
| _digest
"
$Hash
"
hex
)
"
HashedCanonicalRequest
=
"
$(
printf
"
$CanonicalRequest
%s"
| _digest
"
$Hash
"
hex
)
"
_debug2 HashedCanonicalRequest
"
$HashedCanonicalRequest
"
_debug2 HashedCanonicalRequest
"
$HashedCanonicalRequest
"
Algorithm
=
"AWS4-HMAC-SHA256"
Algorithm
=
"AWS4-HMAC-SHA256"
_debug2 Algorithm
"
$Algorithm
"
_debug2 Algorithm
"
$Algorithm
"
RequestDateOnly
=
"
$(
echo
"
$RequestDate
"
|
cut
-c
1-8
)
"
RequestDateOnly
=
"
$(
echo
"
$RequestDate
"
|
cut
-c
1-8
)
"
_debug2 RequestDateOnly
"
$RequestDateOnly
"
_debug2 RequestDateOnly
"
$RequestDateOnly
"
Region
=
"us-east-1"
Region
=
"us-east-1"
...
@@ -204,17 +200,3 @@ aws_rest() {
...
@@ -204,17 +200,3 @@ aws_rest() {
return
"
$_ret
"
return
"
$_ret
"
}
}
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