mirror of
https://github.com/acmesh-official/acme.sh
synced 2025-11-04 05:46:05 +08:00
Compare commits
9 Commits
68587dd9bf
...
2989b5c910
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2989b5c910 | ||
|
|
a5754e9ec4 | ||
|
|
2584f09083 | ||
|
|
d439933b52 | ||
|
|
094d03bf7a | ||
|
|
0f5093c0b7 | ||
|
|
80748b9fe0 | ||
|
|
b244c76dd5 | ||
|
|
c8703eac74 |
58
acme.sh
58
acme.sh
@@ -4790,7 +4790,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
|
||||
@@ -5804,7 +5805,7 @@ list() {
|
||||
_sep="|"
|
||||
if [ "$_raw" ]; then
|
||||
if [ -z "$_domain" ]; then
|
||||
printf "%s\n" "Main_Domain${_sep}KeyLength${_sep}SAN_Domains${_sep}CA${_sep}Created${_sep}Renew"
|
||||
printf "%s\n" "Main_Domain${_sep}KeyLength${_sep}SAN_Domains${_sep}Profile${_sep}CA${_sep}Created${_sep}Renew"
|
||||
fi
|
||||
for di in "${CERT_HOME}"/*.*/; do
|
||||
d=$(basename "$di")
|
||||
@@ -5819,7 +5820,7 @@ list() {
|
||||
. "$DOMAIN_CONF"
|
||||
_ca="$(_getCAShortName "$Le_API")"
|
||||
if [ -z "$_domain" ]; then
|
||||
printf "%s\n" "$Le_Domain${_sep}\"$Le_Keylength\"${_sep}$Le_Alt${_sep}$_ca${_sep}$Le_CertCreateTimeStr${_sep}$Le_NextRenewTimeStr"
|
||||
printf "%s\n" "$Le_Domain${_sep}\"$Le_Keylength\"${_sep}$Le_Alt${_sep}$Le_Certificate_Profile${_sep}$_ca${_sep}$Le_CertCreateTimeStr${_sep}$Le_NextRenewTimeStr"
|
||||
else
|
||||
if [ "$_domain" = "$d" ]; then
|
||||
cat "$DOMAIN_CONF"
|
||||
@@ -5838,6 +5839,48 @@ list() {
|
||||
|
||||
}
|
||||
|
||||
list_profiles() {
|
||||
_initpath
|
||||
_initAPI
|
||||
|
||||
_l_server_url="$ACME_DIRECTORY"
|
||||
_l_server_name="$(_getCAShortName "$_l_server_url")"
|
||||
_info "Fetching profiles from $_l_server_name ($_l_server_url)..."
|
||||
|
||||
response=$(_get "$_l_server_url" "" 10)
|
||||
if [ "$?" != "0" ]; then
|
||||
_err "Failed to connect to CA directory: $_l_server_url"
|
||||
return 1
|
||||
fi
|
||||
|
||||
normalized_response=$(echo "$response" | _normalizeJson)
|
||||
profiles_json=$(echo "$normalized_response" | _egrep_o '"profiles" *: *\{[^\}]*\}')
|
||||
|
||||
if [ -z "$profiles_json" ]; then
|
||||
_info "The CA '$_l_server_name' does not publish certificate profiles via its directory endpoint."
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Strip the outer layer to get the key-value pairs
|
||||
profiles_kv=$(echo "$profiles_json" | sed 's/"profiles" *: *{//' | sed 's/}$//' | tr ',' '\n')
|
||||
|
||||
printf "\n%-15s %s\n" "name" "info"
|
||||
printf -- "--------------------------------------------------------------------\n"
|
||||
|
||||
_old_IFS="$IFS"
|
||||
IFS='
|
||||
'
|
||||
for pair in $profiles_kv; do
|
||||
# Trim quotes and whitespace
|
||||
_name=$(echo "$pair" | cut -d: -f1 | tr -d '" \t')
|
||||
_info_url=$(echo "$pair" | cut -d: -f2- | sed 's/^ *//' | tr -d '"')
|
||||
printf "%-15s %s\n" "$_name" "$_info_url"
|
||||
done
|
||||
IFS="$_old_IFS"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
_deploy() {
|
||||
_d="$1"
|
||||
_hooks="$2"
|
||||
@@ -6377,7 +6420,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"
|
||||
@@ -7498,6 +7542,9 @@ _process() {
|
||||
--set-default-chain)
|
||||
_CMD="setdefaultchain"
|
||||
;;
|
||||
--list-profiles)
|
||||
_CMD="list_profiles"
|
||||
;;
|
||||
-d | --domain)
|
||||
_dvalue="$2"
|
||||
|
||||
@@ -8063,6 +8110,9 @@ _process() {
|
||||
setdefaultchain)
|
||||
setdefaultchain "$_preferred_chain"
|
||||
;;
|
||||
list_profiles)
|
||||
list_profiles
|
||||
;;
|
||||
*)
|
||||
if [ "$_CMD" ]; then
|
||||
_err "Invalid command: $_CMD"
|
||||
|
||||
Reference in New Issue
Block a user