]> git.ipfire.org Git - thirdparty/dehydrated.git/commitdiff
moved deploy_challenge to earlier loop so it works with multiple challenge tokens...
authorLukas Schauer <lukas@schauer.so>
Sun, 28 Jan 2018 18:43:03 +0000 (19:43 +0100)
committerLukas Schauer <lukas@schauer.so>
Sun, 28 Jan 2018 18:48:25 +0000 (19:48 +0100)
CHANGELOG
dehydrated
docs/hook_chain.md

index e9f0b1a46d690fd309a193d875b98b205e3c5e3f..ab546137778dc668c792d6303f541d6fcdb80368 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,7 +3,7 @@ This file contains a log of major changes in dehydrated
 
 ## [x.x.x] - xxxx-xx-xx
 ## Changed
-- ...
+- Challenge validation loop has been modified to loop over authorization identifiers instead of altnames (ACMEv2 + wildcard support)
 
 ## Added
 - Support for ACME v02 (including wildcard certificates!)
index 6c3af646b60bb07549060cecb9b66755ed1a7f89..88455bd66bf218349b35c56e1bd2af4fa8328476 100755 (executable)
@@ -675,7 +675,7 @@ sign_csr() {
     fi
 
     # Gather challenge information
-    challenge_identifier[${idx}]="${identifier}"
+    challenge_identifiers[${idx}]="${identifier}"
     challenge_tokens[${idx}]="$(echo "${challenge}" | get_json_string_value token)"
     if [[ ${API} -eq 2 ]]; then
       challenge_uris[${idx}]="$(echo "${challenge}" | get_json_string_value url)"
@@ -698,6 +698,7 @@ sign_csr() {
         keyauth_hook="$(printf '%s' "${keyauth}" | "${OPENSSL}" dgst -sha256 -binary | urlbase64)"
         ;;
     esac
+
     keyauths[${idx}]="${keyauth}"
     deploy_args[${idx}]="${identifier} ${challenge_tokens[${idx}]} ${keyauth_hook}"
 
@@ -706,30 +707,25 @@ sign_csr() {
   local num_pending_challenges=${idx}
   echo " + ${num_pending_challenges} pending challenge(s)"
 
-  # Detect duplicate challenge identifiers
-  if [ "${HOOK_CHAIN}" = "yes" ] && [ -n "$(tr ' ' '\n' <<< "${challenge_identifier[*]}" | sort | uniq -d)" ]; then
-    echo "!! Disabling HOOK_CHAIN for this certificate (see https://dehydrated.de/docs/hook_chain.md#problem-with-wildcard-certificates for more information)"
-    HOOK_CHAIN=no
-  fi
-
-  # Deploy challenge tokens using chained hook
+  # Deploy challenge tokens
   if [[ ${num_pending_challenges} -ne 0 ]]; then
-    # shellcheck disable=SC2068
+    echo " + Deploying challenge tokens..."
     if [[ -n "${HOOK}" ]] && [[ "${HOOK_CHAIN}" = "yes" ]]; then
-      echo " + Deploying challenge tokens..."
       "${HOOK}" "deploy_challenge" ${deploy_args[@]}
+    elif [[ -n "${HOOK}" ]]; then
+      # Run hook script to deploy the challenge token
+      local idx=0
+      while [ ${idx} -lt ${num_pending_challenges} ]; do
+        "${HOOK}" "deploy_challenge" ${deploy_args[${idx}]}
+        idx=$((idx+1))
+      done
     fi
   fi
 
   # Validate pending challenges
   local idx=0
   while [ ${idx} -lt ${num_pending_challenges} ]; do
-    echo " + Responding to challenge for ${challenge_identifier[${idx}]} authorization..."
-
-    # Run hook script to deploy the challenge token
-    if [[ -n "${HOOK}" ]] && [[ "${HOOK_CHAIN}" != "yes" ]]; then
-      "${HOOK}" "deploy_challenge" ${deploy_args[${idx}]}
-    fi
+    echo " + Responding to challenge for ${challenge_identifiers[${idx}]} authorization..."
 
     # Ask the acme-server to verify our challenge and wait until it is no longer pending
     if [[ ${API} -eq 1 ]]; then
index 5a3da122b99e728c1bea80c2d071e65e0eef5d84..a4f7a5b8d1d103557a09a46b308ca4370c535a0c 100644 (file)
@@ -60,15 +60,3 @@ HOOK: clean_challenge lukas.im blablabla blablabla.supersecure www.lukas.im blub
 HOOK: deploy_cert lukas.im /etc/dehydrated/certs/lukas.im/privkey.pem /etc/dehydrated/certs/lukas.im/cert.pem /etc/dehydrated/certs/lukas.im/fullchain.pem /etc/dehydrated/certs/lukas.im/chain.pem 1460152408
  + Done!
 ```
-
-# Problem with wildcard certificates
-
-For wildcard certificates the upper level domain is used for verification, e.g.
-`*.foo.example.com` will be verified at `foo.example.com`.
-
-In cases where both `foo.example.com` and `*.foo.example.com` would have to be
-validated there would be a conflict since both will have different tokens but
-both are expected to be resolved under `_acme-challenge.foo.example.com`.
-
-If dehydrated detects this kind of configuration it will automatically fall back
-to non-chaining behaviour (until the next certificate).