@@ -2035,7 +2035,7 @@ check_revocation_ocsp() {
2035
2035
local stapled_response="$2"
2036
2036
local jsonID="$3"
2037
2037
local tmpfile=""
2038
- local -i success
2038
+ local -i success=1
2039
2039
local response=""
2040
2040
local host_header=""
2041
2041
@@ -2052,9 +2052,20 @@ check_revocation_ocsp() {
2052
2052
tmpfile=$TEMPDIR/${NODE}-${NODEIP}.${uri##*\/} || exit $ERR_FCREATE
2053
2053
if [[ -n "$stapled_response" ]]; then
2054
2054
hex2binary "$stapled_response" > "$TEMPDIR/stapled_ocsp_response.dd"
2055
- $OPENSSL ocsp -no_nonce -respin "$TEMPDIR/stapled_ocsp_response.dd" \
2056
- -issuer $TEMPDIR/hostcert_issuer.pem -verify_other $TEMPDIR/intermediatecerts.pem \
2057
- -CAfile <(cat $ADDTL_CA_FILES "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
2055
+ if [[ "$stapled_response" =~ 06052[bB]0[eE]03021[aA] ]]; then
2056
+ # Response appears to use SHA-1 in CertID
2057
+ $OPENSSL ocsp -no_nonce -respin "$TEMPDIR/stapled_ocsp_response.dd" \
2058
+ -issuer $TEMPDIR/hostcert_issuer.pem -verify_other $TEMPDIR/intermediatecerts.pem \
2059
+ -CAfile <(cat $ADDTL_CA_FILES "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
2060
+ success=$?
2061
+ fi
2062
+ if [[ $success -ne 0 ]] && [[ "$stapled_response" =~ 0609608648016503040201 ]]; then
2063
+ # Response appears to use SHA-256 in CertID
2064
+ $OPENSSL ocsp -sha256 -no_nonce -respin "$TEMPDIR/stapled_ocsp_response.dd" \
2065
+ -issuer $TEMPDIR/hostcert_issuer.pem -verify_other $TEMPDIR/intermediatecerts.pem \
2066
+ -CAfile <(cat $ADDTL_CA_FILES "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
2067
+ success=$?
2068
+ fi
2058
2069
else
2059
2070
host_header=${uri##http://}
2060
2071
host_header=${host_header%%/*}
@@ -2069,8 +2080,9 @@ check_revocation_ocsp() {
2069
2080
$OPENSSL ocsp -no_nonce ${host_header} -url "$uri" \
2070
2081
-issuer $TEMPDIR/hostcert_issuer.pem -verify_other $TEMPDIR/intermediatecerts.pem \
2071
2082
-CAfile <(cat $ADDTL_CA_FILES "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
2083
+ success=$?
2072
2084
fi
2073
- if [[ $? -eq 0 ]] && grep -Fq "Response verify OK" "$tmpfile"; then
2085
+ if [[ $success -eq 0 ]] && grep -Fq "Response verify OK" "$tmpfile"; then
2074
2086
response="$(grep -F "$HOSTCERT: " "$tmpfile")"
2075
2087
response="${response#$HOSTCERT: }"
2076
2088
response="${response%\.}"
0 commit comments