dehydrated-io / dehydrated

letsencrypt/acme client implemented as a shell-script – just add water
https://dehydrated.io
MIT License
5.97k stars 717 forks source link

[critical] new call syntax regression breaks hook.sh deploy_challenge and probably clean_challenge #850

Closed struanb closed 3 years ago

struanb commented 3 years ago

I'm experiencing a regression in master branch, probably caused by commit e963438c5a5d58ce3f997eef1e8e25f3cb4238d8 (make shellcheck happy again), specifically the following lines:

@@ -1083,12 +1096,12 @@ sign_csr() {
   if [[ ${num_pending_challenges} -ne 0 ]]; then
     echo " + Deploying challenge tokens..."
     if [[ -n "${HOOK}" ]] && [[ "${HOOK_CHAIN}" = "yes" ]]; then
-      "${HOOK}" "deploy_challenge" ${deploy_args[@]} || _exiterr 'deploy_challenge hook returned with non-zero exit code'
+      "${HOOK}" "deploy_challenge" "${deploy_args[@]}" || _exiterr 'deploy_challenge hook returned with non-zero exit code'
     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}]} || _exiterr 'deploy_challenge hook returned with non-zero exit code'
+        "${HOOK}" "deploy_challenge" "${deploy_args[${idx}]}" || _exiterr 'deploy_challenge hook returned with non-zero exit code'
         idx=$((idx+1))
       done
     fi

The result of the change appears to be that instead of the hook.sh deploy_challenge being passed three arguments (the expanded ${deploy_args[${idx}]}), it is now passed one argument ("${deploy_args[${idx}]}", which expands to a string consisting of the three arguments joined by spaces).

I suspect the modified call to the hook for clean_challenge is also broken in the same way.

To reproduce the issue, just run dehydrated with a stock hook.

lukas2511 commented 3 years ago

Mh... interesting...

lukas2511 commented 3 years ago

Ah... i see what my mistake was... sorry for that... Should be fully reverted now.