From 61c5e8b96dc696fc282d5a778acf1abf03320433 Mon Sep 17 00:00:00 2001 From: Dirk Date: Wed, 11 Jul 2018 10:59:05 +0200 Subject: [PATCH] (Slightly) improved JSON output for certificates This commit fixes a bug mentioned in #1084 where a server with multiple host certificates wa missing a certificate number the the host certificate itself. It also adds a JSON object for the number of host certificates. --- testssl.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index 09a0040..ed2f4d2 100755 --- a/testssl.sh +++ b/testssl.sh @@ -7259,7 +7259,7 @@ certificate_info() { outln "$spaces$cert_fingerprint_sha2" # " " needs to be converted back to lf in JSON/CSV output - fileout "cert" "INFO" "$(< $HOSTCERT)" + fileout "cert${json_postfix}" "INFO" "$(< $HOSTCERT)" [[ -z $CERT_FINGERPRINT_SHA2 ]] && \ CERT_FINGERPRINT_SHA2="$cert_fingerprint_sha2" || @@ -8050,6 +8050,8 @@ run_server_defaults() { fi fi [[ $DEBUG -ge 1 ]] && [[ -e $HOSTCERT.nosni ]] && $OPENSSL x509 -in $HOSTCERT.nosni -text -noout 2>>$ERRFILE > $HOSTCERT.nosni.txt + + fileout "cert_numbers" "INFO" "$certs_found" for (( i=1; i <= certs_found; i++ )); do echo "${previous_hostcert[i]}" > $HOSTCERT echo "${previous_intermediates[i]}" > $TEMPDIR/intermediatecerts.pem