From c8703eac743d6a5734e6215349097883468da545 Mon Sep 17 00:00:00 2001 From: Ciaran Walsh Date: Fri, 8 Aug 2025 14:58:25 +0100 Subject: [PATCH] Fix for issue 4972 Fix for issue 4972 (https://github.com/acmesh-official/acme.sh/issues/4972) "can not get domain token entry" which appears to happen occasionally with ZeroSSL responses. Extends the previous fix where responses include empty response objects. Issue appears to be related to the _egrep_o regex not being able to match the `"type":"http-01"` or `"type":"dns-01"` challenge types as expected for some reason which is unclear to me. This fix adds a prior call to _egrep_o to extract the `"challenges":[{"type":"http-01",.....},{"type":"dns-01",....}]` array section of text from the response, which then appears to allow the extraction of the specific entry for the type being parsed to work. --- acme.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/acme.sh b/acme.sh index d9ae208a..3fb33c01 100755 --- a/acme.sh +++ b/acme.sh @@ -4763,7 +4763,8 @@ $_authorizations_map" fi # Fix for empty error objects in response which mess up the original code, adapted from fix suggested here: https://github.com/acmesh-official/acme.sh/issues/4933#issuecomment-1870499018 - entry="$(echo "$response" | sed s/'"error":{}'/'"error":null'/ | _egrep_o '[^\{]*"type":"'$vtype'"[^\}]*')" + # Additional fix for issue 4972 "cannot get domain token entry" with ZeroSSL (https://github.com/acmesh-official/acme.sh/issues/4972) + entry="$(echo "$response" | sed s/'"error":{}'/'"error":null'/ | _egrep_o "\"challenges\":\[[^]]*]" | _egrep_o '[^\{]*"type":"'$vtype'"[^\}]*')" _debug entry "$entry" if [ -z "$keyauthorization" -a -z "$entry" ]; then @@ -6353,7 +6354,8 @@ _deactivate() { _debug "Trigger validation." vtype="$(_getIdType "$_d_domain")" # Fix for empty error objects in response which mess up the original code, adapted from fix suggested here: https://github.com/acmesh-official/acme.sh/issues/4933#issuecomment-1870499018 - entry="$(echo "$response" | sed s/'"error":{}'/'"error":null'/ | _egrep_o '[^\{]*"type":"'$vtype'"[^\}]*')" + # Additional fix for issue 4972 "cannot get domain token entry" with ZeroSSL (https://github.com/acmesh-official/acme.sh/issues/4972) + entry="$(echo "$response" | sed s/'"error":{}'/'"error":null'/ | _egrep_o "\"challenges\":\[[^]]*]" | _egrep_o '[^\{]*"type":"'$vtype'"[^\}]*')" _debug entry "$entry" if [ -z "$entry" ]; then _err "$d: Cannot get domain token"