Skip to content

Commit d66b67b

Browse files
authored
Merge pull request #2897 from dcooper16/fix2896
Fix #2896
2 parents 97faadf + 41db430 commit d66b67b

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

testssl.sh

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,9 +2091,9 @@ check_revocation_crl() {
20912091
fi
20922092
fi
20932093
if grep -qe '-----BEGIN CERTIFICATE-----' $TEMPDIR/intermediatecerts.pem; then
2094-
$OPENSSL verify -crl_check -CAfile <(cat $ADDTL_CA_FILES "$GOOD_CA_BUNDLE" "${tmpfile%%.crl}.pem") -untrusted $TEMPDIR/intermediatecerts.pem $HOSTCERT &> "${tmpfile%%.crl}.err"
2094+
$OPENSSL verify -crl_check -CAfile <(cat ${ADDTL_CA_FILES//,/ } "$GOOD_CA_BUNDLE" "${tmpfile%%.crl}.pem") -untrusted $TEMPDIR/intermediatecerts.pem $HOSTCERT &> "${tmpfile%%.crl}.err"
20952095
else
2096-
$OPENSSL verify -crl_check -CAfile <(cat $ADDTL_CA_FILES "$GOOD_CA_BUNDLE" "${tmpfile%%.crl}.pem") $HOSTCERT &> "${tmpfile%%.crl}.err"
2096+
$OPENSSL verify -crl_check -CAfile <(cat ${ADDTL_CA_FILES//,/ } "$GOOD_CA_BUNDLE" "${tmpfile%%.crl}.pem") $HOSTCERT &> "${tmpfile%%.crl}.err"
20972097
fi
20982098
if [[ $? -eq 0 ]]; then
20992099
out ", "
@@ -2151,14 +2151,14 @@ check_revocation_ocsp() {
21512151
# Response appears to use SHA-1 in CertID
21522152
$OPENSSL ocsp -no_nonce -respin "$TEMPDIR/stapled_ocsp_response.dd" \
21532153
-issuer $TEMPDIR/hostcert_issuer.pem -verify_other $TEMPDIR/intermediatecerts.pem \
2154-
-CAfile <(cat $ADDTL_CA_FILES "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
2154+
-CAfile <(cat ${ADDTL_CA_FILES//,/ } "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
21552155
success=$?
21562156
fi
21572157
if [[ $success -ne 0 ]] && [[ "$stapled_response" =~ 0609608648016503040201 ]]; then
21582158
# Response appears to use SHA-256 in CertID
21592159
$OPENSSL ocsp -sha256 -no_nonce -respin "$TEMPDIR/stapled_ocsp_response.dd" \
21602160
-issuer $TEMPDIR/hostcert_issuer.pem -verify_other $TEMPDIR/intermediatecerts.pem \
2161-
-CAfile <(cat $ADDTL_CA_FILES "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
2161+
-CAfile <(cat ${ADDTL_CA_FILES//,/ } "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
21622162
success=$?
21632163
fi
21642164
else
@@ -2189,7 +2189,7 @@ check_revocation_ocsp() {
21892189
fi
21902190
$openssl_bin ocsp -no_nonce ${host_header} -url "$uri" \
21912191
-issuer $TEMPDIR/hostcert_issuer.pem -verify_other $TEMPDIR/intermediatecerts.pem \
2192-
-CAfile <(cat $ADDTL_CA_FILES "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
2192+
-CAfile <(cat ${ADDTL_CA_FILES//,/ } "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
21932193
success=$?
21942194
fi
21952195

@@ -7943,9 +7943,9 @@ determine_trust() {
79437943
# in a subshell because that should be valid here only
79447944
(export SSL_CERT_DIR="/dev/null"; export SSL_CERT_FILE="/dev/null"
79457945
if [[ $certificates_provided -ge 2 ]]; then
7946-
$OPENSSL verify $TRUSTED1ST -purpose sslserver -CAfile <(cat $ADDTL_CA_FILES "$bundle_fname") -untrusted $TEMPDIR/intermediatecerts.pem $HOSTCERT >$TEMPDIR/${certificate_file[i]}.1 2>$TEMPDIR/${certificate_file[i]}.2
7946+
$OPENSSL verify $TRUSTED1ST -purpose sslserver -CAfile <(cat ${ADDTL_CA_FILES//,/ } "$bundle_fname") -untrusted $TEMPDIR/intermediatecerts.pem $HOSTCERT >$TEMPDIR/${certificate_file[i]}.1 2>$TEMPDIR/${certificate_file[i]}.2
79477947
else
7948-
$OPENSSL verify $TRUSTED1ST -purpose sslserver -CAfile <(cat $ADDTL_CA_FILES "$bundle_fname") $HOSTCERT >$TEMPDIR/${certificate_file[i]}.1 2>$TEMPDIR/${certificate_file[i]}.2
7948+
$OPENSSL verify $TRUSTED1ST -purpose sslserver -CAfile <(cat ${ADDTL_CA_FILES//,/ } "$bundle_fname") $HOSTCERT >$TEMPDIR/${certificate_file[i]}.1 2>$TEMPDIR/${certificate_file[i]}.2
79497949
fi)
79507950
verify_retcode[i]=$(awk '/error [1-9][0-9]? at [0-9]+ depth lookup:/ { if (!found) {print $2; found=1} }' $TEMPDIR/${certificate_file[i]}.1 $TEMPDIR/${certificate_file[i]}.2)
79517951
[[ -z "${verify_retcode[i]}" ]] && verify_retcode[i]=0
@@ -25058,10 +25058,8 @@ parse_cmd_line() {
2505825058
fi
2505925059
if [[ -d "${ADDTL_CA_FILES}" ]]; then
2506025060
ADDTL_CA_FILES="$ADDTL_CA_FILES/*.pem"
25061-
else
25062-
ADDTL_CA_FILES="${ADDTL_CA_FILES//,/ }"
2506325061
fi
25064-
for fname in ${ADDTL_CA_FILES}; do
25062+
for fname in ${ADDTL_CA_FILES//,/ }; do
2506525063
[[ -s "$fname" ]] || fatal_cmd_line "The CA file \"$fname\" does not exist" $ERR_RESOURCE
2506625064
grep -q 'BEGIN CERTIFICATE' "$fname" || fatal_cmd_line "\"$fname\" is not CA file in PEM format" $ERR_RESOURCE
2506725065
done

0 commit comments

Comments
 (0)