mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-05-14 02:32:47 +00:00
Merge branch 'dev' of https://github.com/Neilpang/acme.sh into feat/mydevil.net
This commit is contained in:
commit
00f1b5764b
46
acme.sh
46
acme.sh
@ -139,6 +139,7 @@ __red() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_printargs() {
|
_printargs() {
|
||||||
|
_exitstatus="$?"
|
||||||
if [ -z "$NO_TIMESTAMP" ] || [ "$NO_TIMESTAMP" = "0" ]; then
|
if [ -z "$NO_TIMESTAMP" ] || [ "$NO_TIMESTAMP" = "0" ]; then
|
||||||
printf -- "%s" "[$(date)] "
|
printf -- "%s" "[$(date)] "
|
||||||
fi
|
fi
|
||||||
@ -148,6 +149,8 @@ _printargs() {
|
|||||||
printf -- "%s" "$1='$2'"
|
printf -- "%s" "$1='$2'"
|
||||||
fi
|
fi
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
# return the saved exit status
|
||||||
|
return "$_exitstatus"
|
||||||
}
|
}
|
||||||
|
|
||||||
_dlg_versions() {
|
_dlg_versions() {
|
||||||
@ -183,6 +186,7 @@ _dlg_versions() {
|
|||||||
|
|
||||||
#class
|
#class
|
||||||
_syslog() {
|
_syslog() {
|
||||||
|
_exitstatus="$?"
|
||||||
if [ "${SYS_LOG:-$SYSLOG_LEVEL_NONE}" = "$SYSLOG_LEVEL_NONE" ]; then
|
if [ "${SYS_LOG:-$SYSLOG_LEVEL_NONE}" = "$SYSLOG_LEVEL_NONE" ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -196,6 +200,7 @@ _syslog() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
$__logger_i -t "$PROJECT_NAME" -p "$_logclass" "$(_printargs "$@")" >/dev/null 2>&1
|
$__logger_i -t "$PROJECT_NAME" -p "$_logclass" "$(_printargs "$@")" >/dev/null 2>&1
|
||||||
|
return "$_exitstatus"
|
||||||
}
|
}
|
||||||
|
|
||||||
_log() {
|
_log() {
|
||||||
@ -1188,7 +1193,7 @@ _ss() {
|
|||||||
|
|
||||||
if _exists "netstat"; then
|
if _exists "netstat"; then
|
||||||
_debug "Using: netstat"
|
_debug "Using: netstat"
|
||||||
if netstat -h 2>&1 | grep "\-p proto" >/dev/null; then
|
if netstat -help 2>&1 | grep "\-p proto" >/dev/null; then
|
||||||
#for windows version netstat tool
|
#for windows version netstat tool
|
||||||
netstat -an -p tcp | grep "LISTENING" | grep ":$_port "
|
netstat -an -p tcp | grep "LISTENING" | grep ":$_port "
|
||||||
else
|
else
|
||||||
@ -1882,29 +1887,34 @@ _send_signed_request() {
|
|||||||
_err "Can not post to $url"
|
_err "Can not post to $url"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
_debug2 original "$response"
|
|
||||||
response="$(echo "$response" | _normalizeJson)"
|
|
||||||
|
|
||||||
responseHeaders="$(cat "$HTTP_HEADER")"
|
responseHeaders="$(cat "$HTTP_HEADER")"
|
||||||
|
|
||||||
_debug2 responseHeaders "$responseHeaders"
|
_debug2 responseHeaders "$responseHeaders"
|
||||||
_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 code "$code"
|
_debug code "$code"
|
||||||
|
|
||||||
_CACHED_NONCE="$(echo "$responseHeaders" | grep "Replay-Nonce:" | _head_n 1 | tr -d "\r\n " | cut -d ':' -f 2)"
|
_debug2 original "$response"
|
||||||
|
if echo "$responseHeaders" | grep -i "Content-Type: application/json" >/dev/null 2>&1; then
|
||||||
_body="$response"
|
response="$(echo "$response" | _normalizeJson)"
|
||||||
if [ "$needbase64" ]; then
|
|
||||||
_body="$(echo "$_body" | _dbase64 | tr -d '\0')"
|
|
||||||
_debug3 _body "$_body"
|
|
||||||
fi
|
fi
|
||||||
|
_debug2 response "$response"
|
||||||
|
|
||||||
if _contains "$_body" "JWS has invalid anti-replay nonce" || _contains "$_body" "JWS has an invalid anti-replay nonce"; then
|
_CACHED_NONCE="$(echo "$responseHeaders" | grep -i "Replay-Nonce:" | _head_n 1 | tr -d "\r\n " | cut -d ':' -f 2)"
|
||||||
_info "It seems the CA server is busy now, let's wait and retry. Sleeping $_sleep_retry_sec seconds."
|
|
||||||
_CACHED_NONCE=""
|
if ! _startswith "$code" "2"; then
|
||||||
_sleep $_sleep_retry_sec
|
_body="$response"
|
||||||
continue
|
if [ "$needbase64" ]; then
|
||||||
|
_body="$(echo "$_body" | _dbase64 multiline)"
|
||||||
|
_debug3 _body "$_body"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if _contains "$_body" "JWS has invalid anti-replay nonce" || _contains "$_body" "JWS has an invalid anti-replay nonce"; then
|
||||||
|
_info "It seems the CA server is busy now, let's wait and retry. Sleeping $_sleep_retry_sec seconds."
|
||||||
|
_CACHED_NONCE=""
|
||||||
|
_sleep $_sleep_retry_sec
|
||||||
|
continue
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
@ -4113,14 +4123,14 @@ $_authorizations_map"
|
|||||||
Le_LinkCert="$(echo "$response" | tr -d '\r\n' | _egrep_o '"certificate" *: *"[^"]*"' | cut -d '"' -f 4)"
|
Le_LinkCert="$(echo "$response" | tr -d '\r\n' | _egrep_o '"certificate" *: *"[^"]*"' | cut -d '"' -f 4)"
|
||||||
|
|
||||||
_tempSignedResponse="$response"
|
_tempSignedResponse="$response"
|
||||||
if ! _send_signed_request "$Le_LinkCert" "" "needbase64"; then
|
if ! _send_signed_request "$Le_LinkCert"; then
|
||||||
_err "Sign failed, can not download cert:$Le_LinkCert."
|
_err "Sign failed, can not download cert:$Le_LinkCert."
|
||||||
_err "$response"
|
_err "$response"
|
||||||
_on_issue_err "$_post_hook"
|
_on_issue_err "$_post_hook"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$response" | _dbase64 "multiline" >"$CERT_PATH"
|
echo "$response" >"$CERT_PATH"
|
||||||
|
|
||||||
if [ "$(grep -- "$BEGIN_CERT" "$CERT_PATH" | wc -l)" -gt "1" ]; then
|
if [ "$(grep -- "$BEGIN_CERT" "$CERT_PATH" | wc -l)" -gt "1" ]; then
|
||||||
_debug "Found cert chain"
|
_debug "Found cert chain"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user