(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.
This commit is contained in:
Dirk 2018-07-11 10:59:05 +02:00
parent 4aabc3f999
commit 61c5e8b96d
1 changed files with 3 additions and 1 deletions

View File

@ -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