mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-04-23 08:48:30 +02:00
allow KEEP_GOING to also skip over ocsp stapling errors, update ocsp error message with a hint about deprecation on some CAs
This commit is contained in:
@@ -8,6 +8,7 @@ This file contains a log of major changes in dehydrated
|
|||||||
## Changed
|
## Changed
|
||||||
- Only validate existance of wellknown directory or hook script when actually needed
|
- Only validate existance of wellknown directory or hook script when actually needed
|
||||||
- Also allow setting `KEEP_GOING` in config file instead of relying on cli arguments
|
- Also allow setting `KEEP_GOING` in config file instead of relying on cli arguments
|
||||||
|
- Allow skipping over OCSP stapling errors, indicate that some CAs no longer support OCSP
|
||||||
|
|
||||||
## [0.7.2] - 2025-05-18
|
## [0.7.2] - 2025-05-18
|
||||||
## Added
|
## Added
|
||||||
|
|||||||
56
dehydrated
56
dehydrated
@@ -1641,6 +1641,36 @@ sign_domain() {
|
|||||||
echo " + Done!"
|
echo " + Done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Update OCSP stapling file
|
||||||
|
update_ocsp_stapling() {
|
||||||
|
local certdir="${1}"
|
||||||
|
local update_ocsp="${2}"
|
||||||
|
local cert="${3}"
|
||||||
|
local chain="${4}"
|
||||||
|
|
||||||
|
local ocsp_url="$(get_ocsp_url "${cert}")"
|
||||||
|
|
||||||
|
if [[ ! -e "${certdir}/ocsp.der" ]]; then
|
||||||
|
update_ocsp="yes"
|
||||||
|
elif ! ("${OPENSSL}" ocsp -no_nonce -issuer "${chain}" -verify_other "${chain}" -cert "${cert}" -respin "${certdir}/ocsp.der" -status_age $((OCSP_DAYS*24*3600)) 2>&1 | grep -q "${cert}: good"); then
|
||||||
|
update_ocsp="yes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${update_ocsp}" = "yes" ]]; then
|
||||||
|
echo " + Updating OCSP stapling file"
|
||||||
|
ocsp_timestamp="$(date +%s)"
|
||||||
|
if grep -qE "^(openssl (0|(1\.0))\.)|(libressl (1|2|3)\.)" <<< "$(${OPENSSL} version | awk '{print tolower($0)}')"; then
|
||||||
|
ocsp_log="$("${OPENSSL}" ocsp -no_nonce -issuer "${chain}" -verify_other "${chain}" -cert "${cert}" -respout "${certdir}/ocsp-${ocsp_timestamp}.der" -url "${ocsp_url}" -header "HOST" "$(echo "${ocsp_url}" | _sed -e 's/^http(s?):\/\///' -e 's/\/.*$//g')" 2>&1)" || _exiterr "Fetching of OCSP information failed. Please note that some CAs (e.g. LetsEncrypt) do no longer support OCSP. Error message: ${ocsp_log}"
|
||||||
|
else
|
||||||
|
ocsp_log="$("${OPENSSL}" ocsp -no_nonce -issuer "${chain}" -verify_other "${chain}" -cert "${cert}" -respout "${certdir}/ocsp-${ocsp_timestamp}.der" -url "${ocsp_url}" 2>&1)" || _exiterr "Fetching of OCSP information failed. Please note that some CAs (e.g. LetsEncrypt) do no longer support OCSP. Error message: ${ocsp_log}"
|
||||||
|
fi
|
||||||
|
ln -sf "ocsp-${ocsp_timestamp}.der" "${certdir}/ocsp.der"
|
||||||
|
[[ -n "${HOOK}" ]] && (altnames="${domain} ${morenames}" "${HOOK}" "deploy_ocsp" "${domain}" "${certdir}/ocsp.der" "${ocsp_timestamp}" || _exiterr 'deploy_ocsp hook returned with non-zero exit code')
|
||||||
|
else
|
||||||
|
echo " + OCSP stapling file is still valid (skipping update)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Usage: --version (-v)
|
# Usage: --version (-v)
|
||||||
# Description: Print version information
|
# Description: Print version information
|
||||||
command_version() {
|
command_version() {
|
||||||
@@ -1953,27 +1983,13 @@ command_sign_domains() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${OCSP_FETCH}" = "yes" ]]; then
|
if [[ "${OCSP_FETCH}" = "yes" ]]; then
|
||||||
local ocsp_url
|
if [[ "${KEEP_GOING:-}" = "yes" ]]; then
|
||||||
ocsp_url="$(get_ocsp_url "${cert}")"
|
skip_exit_hook=yes
|
||||||
|
update_ocsp_stapling "${certdir}" "${update_ocsp}" "${cert}" "${chain}" &
|
||||||
if [[ ! -e "${certdir}/ocsp.der" ]]; then
|
wait $! || exit_with_errorcode=1
|
||||||
update_ocsp="yes"
|
skip_exit_hook=no
|
||||||
elif ! ("${OPENSSL}" ocsp -no_nonce -issuer "${chain}" -verify_other "${chain}" -cert "${cert}" -respin "${certdir}/ocsp.der" -status_age $((OCSP_DAYS*24*3600)) 2>&1 | grep -q "${cert}: good"); then
|
|
||||||
update_ocsp="yes"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${update_ocsp}" = "yes" ]]; then
|
|
||||||
echo " + Updating OCSP stapling file"
|
|
||||||
ocsp_timestamp="$(date +%s)"
|
|
||||||
if grep -qE "^(openssl (0|(1\.0))\.)|(libressl (1|2|3)\.)" <<< "$(${OPENSSL} version | awk '{print tolower($0)}')"; then
|
|
||||||
ocsp_log="$("${OPENSSL}" ocsp -no_nonce -issuer "${chain}" -verify_other "${chain}" -cert "${cert}" -respout "${certdir}/ocsp-${ocsp_timestamp}.der" -url "${ocsp_url}" -header "HOST" "$(echo "${ocsp_url}" | _sed -e 's/^http(s?):\/\///' -e 's/\/.*$//g')" 2>&1)" || _exiterr "Error while fetching OCSP information: ${ocsp_log}"
|
|
||||||
else
|
|
||||||
ocsp_log="$("${OPENSSL}" ocsp -no_nonce -issuer "${chain}" -verify_other "${chain}" -cert "${cert}" -respout "${certdir}/ocsp-${ocsp_timestamp}.der" -url "${ocsp_url}" 2>&1)" || _exiterr "Error while fetching OCSP information: ${ocsp_log}"
|
|
||||||
fi
|
|
||||||
ln -sf "ocsp-${ocsp_timestamp}.der" "${certdir}/ocsp.der"
|
|
||||||
[[ -n "${HOOK}" ]] && (altnames="${domain} ${morenames}" "${HOOK}" "deploy_ocsp" "${domain}" "${certdir}/ocsp.der" "${ocsp_timestamp}" || _exiterr 'deploy_ocsp hook returned with non-zero exit code')
|
|
||||||
else
|
else
|
||||||
echo " + OCSP stapling file is still valid (skipping update)"
|
update_ocsp_stapling "${certdir}" "${update_ocsp}" "${cert}" "${chain}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -140,5 +140,5 @@
|
|||||||
# Amount of seconds to wait for processing of order until erroring out (default: 0 => no timeout)
|
# Amount of seconds to wait for processing of order until erroring out (default: 0 => no timeout)
|
||||||
#ORDER_TIMEOUT=0
|
#ORDER_TIMEOUT=0
|
||||||
|
|
||||||
# Skip over errors during certificate orders (default: no)
|
# Skip over errors during certificate orders and updating of OCSP stapling information (default: no)
|
||||||
#KEEP_GOING=no
|
#KEEP_GOING=no
|
||||||
|
|||||||
Reference in New Issue
Block a user