Skip to content

Commit

Permalink
Merge pull request #4720 from acmesh-official/dev
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
Neilpang authored Jul 30, 2023
2 parents b7caf7a + b6f62ac commit 0da839c
Show file tree
Hide file tree
Showing 9 changed files with 540 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/DragonFlyBSD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
nat: |
"8080": "80"
prepare: |
pkg install -y curl socat
pkg install -y curl socat libnghttp2
usesh: true
run: |
cd ../acmetest \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/OpenBSD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
envs: 'TEST_LOCAL TestingDomain TEST_ACME_Server CA_ECDSA CA CA_EMAIL TEST_PREFERRED_CHAIN ACME_USE_WGET'
nat: |
"8080": "80"
prepare: pkg_add socat curl wget
prepare: pkg_add socat curl wget libnghttp2
usesh: true
copyback: false
run: |
Expand Down
47 changes: 36 additions & 11 deletions acme.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

VER=3.0.6
VER=3.0.7

PROJECT_NAME="acme.sh"

Expand Down Expand Up @@ -923,8 +923,16 @@ _sed_i() {
fi
}

if [ "$(echo abc | egrep -o b 2>/dev/null)" = "b" ]; then
__USE_EGREP=1
else
__USE_EGREP=""
fi

_egrep_o() {
if ! egrep -o "$1" 2>/dev/null; then
if [ "$__USE_EGREP" ]; then
egrep -o "$1"
else
sed -n 's/.*\('"$1"'\).*/\1/p'
fi
}
Expand Down Expand Up @@ -2101,9 +2109,20 @@ _head_n() {
}

_tail_n() {
if ! tail -n "$1" 2>/dev/null; then
if _is_solaris; then
#fix for solaris
tail -"$1"
else
tail -n "$1"
fi
}

_tail_c() {
if _is_solaris; then
#fix for solaris
tail -"$1"c
else
tail -c "$1"
fi
}

Expand All @@ -2116,6 +2135,7 @@ _send_signed_request() {
if [ -z "$keyfile" ]; then
keyfile="$ACCOUNT_KEY_PATH"
fi
_debug "=======Begin Send Signed Request======="
_debug url "$url"
_debug payload "$payload"

Expand Down Expand Up @@ -2277,7 +2297,7 @@ _setopt() {
if [ ! -f "$__conf" ]; then
touch "$__conf"
fi
if [ -n "$(tail -c 1 <"$__conf")" ]; then
if [ -n "$(_tail_c 1 <"$__conf")" ]; then
echo >>"$__conf"
fi

Expand Down Expand Up @@ -4602,9 +4622,10 @@ issue() {
_d="*.$_d"
fi
_debug2 _d "$_d"
_authorizations_map="$_d,$response
_authorizations_map="$_d,$response#$_authz_url
$_authorizations_map"
done

_debug2 _authorizations_map "$_authorizations_map"

_index=0
Expand Down Expand Up @@ -4656,7 +4677,8 @@ $_authorizations_map"
_on_issue_err "$_post_hook"
return 1
fi

_authz_url="$(echo "$_candidates" | sed "s/$_idn_d,//" | _egrep_o "#.*" | sed "s/^#//")"
_debug _authz_url "$_authz_url"
if [ -z "$thumbprint" ]; then
thumbprint="$(__calc_account_thumbprint)"
fi
Expand Down Expand Up @@ -4708,7 +4730,7 @@ $_authorizations_map"
_debug keyauthorization "$keyauthorization"
fi

dvlist="$d$sep$keyauthorization$sep$uri$sep$vtype$sep$_currentRoot"
dvlist="$d$sep$keyauthorization$sep$uri$sep$vtype$sep$_currentRoot$sep$_authz_url"
_debug dvlist "$dvlist"

vlist="$vlist$dvlist$dvsep"
Expand All @@ -4725,6 +4747,7 @@ $_authorizations_map"
keyauthorization=$(echo "$ventry" | cut -d "$sep" -f 2)
vtype=$(echo "$ventry" | cut -d "$sep" -f 4)
_currentRoot=$(echo "$ventry" | cut -d "$sep" -f 5)
_authz_url=$(echo "$ventry" | cut -d "$sep" -f 6)
_debug d "$d"
if [ "$keyauthorization" = "$STATE_VERIFIED" ]; then
_debug "$d is already verified, skip $vtype."
Expand Down Expand Up @@ -4850,7 +4873,7 @@ $_authorizations_map"
uri=$(echo "$ventry" | cut -d "$sep" -f 3)
vtype=$(echo "$ventry" | cut -d "$sep" -f 4)
_currentRoot=$(echo "$ventry" | cut -d "$sep" -f 5)

_authz_url=$(echo "$ventry" | cut -d "$sep" -f 6)
if [ "$keyauthorization" = "$STATE_VERIFIED" ]; then
_info "$d is already verified, skip $vtype."
continue
Expand All @@ -4860,6 +4883,7 @@ $_authorizations_map"
_debug "d" "$d"
_debug "keyauthorization" "$keyauthorization"
_debug "uri" "$uri"
_debug "_authz_url" "$_authz_url"
removelevel=""
token="$(printf "%s" "$keyauthorization" | cut -d '.' -f 1)"

Expand Down Expand Up @@ -4967,6 +4991,7 @@ $_authorizations_map"
MAX_RETRY_TIMES=30
fi

_debug "Lets check the status of the authz"
while true; do
waittimes=$(_math "$waittimes" + 1)
if [ "$waittimes" -ge "$MAX_RETRY_TIMES" ]; then
Expand Down Expand Up @@ -5014,9 +5039,9 @@ $_authorizations_map"
break
fi

if [ "$status" = "pending" ]; then
if _contains "$status" "pending"; then
_info "Pending, The CA is processing your order, please just wait. ($waittimes/$MAX_RETRY_TIMES)"
elif [ "$status" = "processing" ]; then
elif _contains "$status" "processing"; then
_info "Processing, The CA is processing your order, please just wait. ($waittimes/$MAX_RETRY_TIMES)"
else
_err "$d:Verify error:$response"
Expand All @@ -5029,7 +5054,7 @@ $_authorizations_map"
_sleep 2
_debug "checking"

_send_signed_request "$uri"
_send_signed_request "$_authz_url"

if [ "$?" != "0" ]; then
_err "$d:Verify error:$response"
Expand Down
Loading

0 comments on commit 0da839c

Please sign in to comment.