Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
4a5d2e16
Unverified
Commit
4a5d2e16
authored
Feb 07, 2018
by
neil
Committed by
GitHub
Feb 07, 2018
Browse files
Merge pull request #1249 from Neilpang/dev
sync
parents
7128d799
3e3161c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
acme.sh
View file @
4a5d2e16
...
@@ -1787,7 +1787,7 @@ _send_signed_request() {
...
@@ -1787,7 +1787,7 @@ _send_signed_request() {
if
[
"
$url
"
=
"
$ACME_NEW_ACCOUNT
"
]
||
[
"
$url
"
=
"
$ACME_REVOKE_CERT
"
]
;
then
if
[
"
$url
"
=
"
$ACME_NEW_ACCOUNT
"
]
||
[
"
$url
"
=
"
$ACME_REVOKE_CERT
"
]
;
then
protected
=
"
$JWK_HEADERPLACE_PART1$nonce
\"
,
\"
url
\"
:
\"
${
url
}
$JWK_HEADERPLACE_PART2
,
\"
jwk
\"
:
$jwk
"
'}'
protected
=
"
$JWK_HEADERPLACE_PART1$nonce
\"
,
\"
url
\"
:
\"
${
url
}
$JWK_HEADERPLACE_PART2
,
\"
jwk
\"
:
$jwk
"
'}'
else
else
protected
=
"
$JWK_HEADERPLACE_PART1$nonce
\"
,
\"
url
\"
:
\"
${
url
}
$JWK_HEADERPLACE_PART2
,
\"
kid
\"
:
\"
$ACCOUNT_URL
\"
"
'}'
protected
=
"
$JWK_HEADERPLACE_PART1$nonce
\"
,
\"
url
\"
:
\"
${
url
}
$JWK_HEADERPLACE_PART2
,
\"
kid
\"
:
\"
$
{
ACCOUNT_URL
}
\"
"
'}'
fi
fi
else
else
protected
=
"
$JWK_HEADERPLACE_PART1$nonce
\"
,
\"
url
\"
:
\"
${
url
}
$JWK_HEADERPLACE_PART2
,
\"
jwk
\"
:
$jwk
"
'}'
protected
=
"
$JWK_HEADERPLACE_PART1$nonce
\"
,
\"
url
\"
:
\"
${
url
}
$JWK_HEADERPLACE_PART2
,
\"
jwk
\"
:
$jwk
"
'}'
...
@@ -3170,7 +3170,7 @@ _regAccount() {
...
@@ -3170,7 +3170,7 @@ _regAccount() {
if
[
"
$code
"
=
""
]
||
[
"
$code
"
=
'201'
]
;
then
if
[
"
$code
"
=
""
]
||
[
"
$code
"
=
'201'
]
;
then
echo
"
$response
"
>
"
$ACCOUNT_JSON_PATH
"
echo
"
$response
"
>
"
$ACCOUNT_JSON_PATH
"
_info
"Registered"
_info
"Registered"
elif
[
"
$code
"
=
'409'
]
;
then
elif
[
"
$code
"
=
'409'
]
||
[
"
$code
"
=
'200'
]
;
then
_info
"Already registered"
_info
"Already registered"
else
else
_err
"Register account Error:
$response
"
_err
"Register account Error:
$response
"
...
@@ -3594,7 +3594,7 @@ $_authorizations_map"
...
@@ -3594,7 +3594,7 @@ $_authorizations_map"
entry
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'[^\{]*"type":"'
$vtype
'"[^\}]*'
)
"
entry
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'[^\{]*"type":"'
$vtype
'"[^\}]*'
)
"
_debug entry
"
$entry
"
_debug entry
"
$entry
"
if
[
-z
"
$entry
"
]
;
then
if
[
-z
"
$entry
"
]
;
then
_err
"Error, can not get domain token
$d
"
_err
"Error, can not get domain token
entry
$d
"
_clearup
_clearup
_on_issue_err
"
$_post_hook
"
_on_issue_err
"
$_post_hook
"
return
1
return
1
...
@@ -3602,6 +3602,12 @@ $_authorizations_map"
...
@@ -3602,6 +3602,12 @@ $_authorizations_map"
token
=
"
$(
printf
"%s
\n
"
"
$entry
"
| _egrep_o
'"token":"[^"]*'
|
cut
-d
:
-f
2 |
tr
-d
'"'
)
"
token
=
"
$(
printf
"%s
\n
"
"
$entry
"
| _egrep_o
'"token":"[^"]*'
|
cut
-d
:
-f
2 |
tr
-d
'"'
)
"
_debug token
"
$token
"
_debug token
"
$token
"
if
[
-z
"
$token
"
]
;
then
_err
"Error, can not get domain token
$entry
"
_clearup
_on_issue_err
"
$_post_hook
"
return
1
fi
if
[
"
$ACME_VERSION
"
=
"2"
]
;
then
if
[
"
$ACME_VERSION
"
=
"2"
]
;
then
uri
=
"
$(
printf
"%s
\n
"
"
$entry
"
| _egrep_o
'"url":"[^"]*'
|
cut
-d
'"'
-f
4 | _head_n 1
)
"
uri
=
"
$(
printf
"%s
\n
"
"
$entry
"
| _egrep_o
'"url":"[^"]*'
|
cut
-d
'"'
-f
4 | _head_n 1
)
"
else
else
...
@@ -3609,6 +3615,12 @@ $_authorizations_map"
...
@@ -3609,6 +3615,12 @@ $_authorizations_map"
fi
fi
_debug uri
"
$uri
"
_debug uri
"
$uri
"
if
[
-z
"
$uri
"
]
;
then
_err
"Error, can not get domain uri.
$entry
"
_clearup
_on_issue_err
"
$_post_hook
"
return
1
fi
keyauthorization
=
"
$token
.
$thumbprint
"
keyauthorization
=
"
$token
.
$thumbprint
"
_debug keyauthorization
"
$keyauthorization
"
_debug keyauthorization
"
$keyauthorization
"
...
@@ -5151,8 +5163,14 @@ install() {
...
@@ -5151,8 +5163,14 @@ install() {
if
[
-z
"
$NO_DETECT_SH
"
]
;
then
if
[
-z
"
$NO_DETECT_SH
"
]
;
then
#Modify shebang
#Modify shebang
if
_exists bash
;
then
if
_exists bash
;
then
_bash_path
=
"
$(
bash
-c
"command -v bash 2>/dev/null"
)
"
if
[
-z
"
$_bash_path
"
]
;
then
_bash_path
=
"
$(
bash
-c
'echo $SHELL'
)
"
fi
fi
if
[
"
$_bash_path
"
]
;
then
_info
"Good, bash is found, so change the shebang to use bash as preferred."
_info
"Good, bash is found, so change the shebang to use bash as preferred."
_shebang
=
'#!'
"
$
(
bash
-c
"command -v bash"
)
"
_shebang
=
'#!'
"
$
_
bash
_path
"
_setShebang
"
$LE_WORKING_DIR
/
$PROJECT_ENTRY
"
"
$_shebang
"
_setShebang
"
$LE_WORKING_DIR
/
$PROJECT_ENTRY
"
"
$_shebang
"
for
subf
in
$_SUB_FOLDERS
;
do
for
subf
in
$_SUB_FOLDERS
;
do
if
[
-d
"
$LE_WORKING_DIR
/
$subf
"
]
;
then
if
[
-d
"
$LE_WORKING_DIR
/
$subf
"
]
;
then
...
...
dnsapi/dns_inwx.sh
View file @
4a5d2e16
...
@@ -35,53 +35,9 @@ dns_inwx_add() {
...
@@ -35,53 +35,9 @@ dns_inwx_add() {
fi
fi
_debug _sub_domain
"
$_sub_domain
"
_debug _sub_domain
"
$_sub_domain
"
_debug _domain
"
$_domain
"
_debug _domain
"
$_domain
"
_debug
"Getting txt records"
xml_content
=
$(
printf
'<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>nameserver.info</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>domain</name>
<value>
<string>%s</string>
</value>
</member>
<member>
<name>type</name>
<value>
<string>TXT</string>
</value>
</member>
<member>
<name>name</name>
<value>
<string>%s</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>'
"
$_domain
"
"
$_sub_domain
"
)
response
=
"
$(
_post
"
$xml_content
"
"
$INWX_Api
"
""
"POST"
)
"
if
!
printf
"%s"
"
$response
"
|
grep
"Command completed successfully"
>
/dev/null
;
then
_err
"Error could net get txt records"
return
1
fi
if
!
printf
"%s"
"
$response
"
|
grep
"count"
>
/dev/null
;
then
_info
"Adding record"
_info
"Adding record"
_inwx_add_record
"
$_domain
"
"
$_sub_domain
"
"
$txtvalue
"
_inwx_add_record
"
$_domain
"
"
$_sub_domain
"
"
$txtvalue
"
else
_record_id
=
$(
printf
'%s'
"
$response
"
| _egrep_o
'.*(<member><name>record){1}(.*)([0-9]+){1}'
| _egrep_o
'<name>id<\/name><value><int>[0-9]+'
| _egrep_o
'[0-9]+'
)
_info
"Updating record"
_inwx_update_record
"
$_record_id
"
"
$txtvalue
"
fi
}
}
...
@@ -147,7 +103,7 @@ dns_inwx_rm() {
...
@@ -147,7 +103,7 @@ dns_inwx_rm() {
</methodCall>'
"
$_domain
"
"
$_sub_domain
"
)
</methodCall>'
"
$_domain
"
"
$_sub_domain
"
)
response
=
"
$(
_post
"
$xml_content
"
"
$INWX_Api
"
""
"POST"
)
"
response
=
"
$(
_post
"
$xml_content
"
"
$INWX_Api
"
""
"POST"
)
"
if
!
printf
"%s"
"
$response
"
|
grep
"Command completed successfully"
>
/dev/null
;
then
if
!
_contains
"
$response
"
"Command completed successfully"
;
then
_err
"Error could not get txt records"
_err
"Error could not get txt records"
return
1
return
1
fi
fi
...
...
dnsapi/dns_yandex.sh
View file @
4a5d2e16
...
@@ -18,7 +18,6 @@ dns_yandex_add() {
...
@@ -18,7 +18,6 @@ dns_yandex_add() {
curDomain
=
$(
_PDD_get_domain
"
$fulldomain
"
)
curDomain
=
$(
_PDD_get_domain
"
$fulldomain
"
)
_debug
"Found suitable domain in pdd:
$curDomain
"
_debug
"Found suitable domain in pdd:
$curDomain
"
curSubdomain
=
"
$(
echo
"
${
fulldomain
}
"
|
sed
-e
"s@.
${
curDomain
}
\$
@@"
)
"
curData
=
"domain=
${
curDomain
}
&type=TXT&subdomain=
${
curSubdomain
}
&ttl=360&content=
${
txtvalue
}
"
curData
=
"domain=
${
curDomain
}
&type=TXT&subdomain=
${
curSubdomain
}
&ttl=360&content=
${
txtvalue
}
"
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/add"
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/add"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
curUri
}
"
)
"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
curUri
}
"
)
"
...
@@ -36,7 +35,6 @@ dns_yandex_rm() {
...
@@ -36,7 +35,6 @@ dns_yandex_rm() {
curDomain
=
$(
_PDD_get_domain
"
$fulldomain
"
)
curDomain
=
$(
_PDD_get_domain
"
$fulldomain
"
)
_debug
"Found suitable domain in pdd:
$curDomain
"
_debug
"Found suitable domain in pdd:
$curDomain
"
curSubdomain
=
"
$(
echo
"
${
fulldomain
}
"
|
sed
-e
"s@.
${
curDomain
}
\$
@@"
)
"
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/del"
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/del"
curData
=
"domain=
${
curDomain
}
&record_id=
${
record_id
}
"
curData
=
"domain=
${
curDomain
}
&record_id=
${
record_id
}
"
...
@@ -61,7 +59,7 @@ _PDD_get_domain() {
...
@@ -61,7 +59,7 @@ _PDD_get_domain() {
__last
=
1
__last
=
1
fi
fi
__all_domains
=
"
$__all_domains
$(
echo
"
$res1
"
|
sed
-e
"s@,@
\n
@g
"
|
grep
'"name"'
|
cut
-d
:
-f2
|
sed
-e
's@"@@g'
)
"
__all_domains
=
"
$__all_domains
$(
echo
"
$res1
"
|
tr
","
"
\n
"
|
grep
'"name"'
|
cut
-d
:
-f2
|
sed
-e
's@"@@g'
)
"
__page
=
$(
_math
$__page
+ 1
)
__page
=
$(
_math
$__page
+ 1
)
done
done
...
@@ -72,6 +70,8 @@ _PDD_get_domain() {
...
@@ -72,6 +70,8 @@ _PDD_get_domain() {
_debug
"finding zone for domain
$__t
"
_debug
"finding zone for domain
$__t
"
for
d
in
$__all_domains
;
do
for
d
in
$__all_domains
;
do
if
[
"
$d
"
=
"
$__t
"
]
;
then
if
[
"
$d
"
=
"
$__t
"
]
;
then
p
=
$(
_math
$k
- 1
)
curSubdomain
=
"
$(
echo
"
$fulldomain
"
|
cut
-d
.
-f
"1-
$p
"
)
"
echo
"
$__t
"
echo
"
$__t
"
return
return
fi
fi
...
@@ -98,7 +98,6 @@ pdd_get_record_id() {
...
@@ -98,7 +98,6 @@ pdd_get_record_id() {
curDomain
=
$(
_PDD_get_domain
"
$fulldomain
"
)
curDomain
=
$(
_PDD_get_domain
"
$fulldomain
"
)
_debug
"Found suitable domain in pdd:
$curDomain
"
_debug
"Found suitable domain in pdd:
$curDomain
"
curSubdomain
=
"
$(
echo
"
${
fulldomain
}
"
|
sed
-e
"s@.
${
curDomain
}
\$
@@"
)
"
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/list?domain=
${
curDomain
}
"
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/list?domain=
${
curDomain
}
"
curResult
=
"
$(
_get
"
${
curUri
}
"
| _normalizeJson
)
"
curResult
=
"
$(
_get
"
${
curUri
}
"
| _normalizeJson
)
"
...
...
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