mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-10-10 12:42:53 +02:00
Merge pull request #2792 from testssl/fix_issuerCN
Fix missing issuer CN
This commit is contained in:
@ -10121,9 +10121,12 @@ certificate_info() {
|
||||
expok="OK"
|
||||
fi
|
||||
out " ($enddate). "
|
||||
# Match on Subject/Issuer plus next 3 lines
|
||||
cn="$(awk '/Subject:/{stop=NR+3}; NR<=stop' <<< "${intermediate_certs_txt[i]}" | awk -F= '/CN/ { print $NF }')"
|
||||
issuer_CN="$(awk '/Issuer:/{stop=NR+3}; NR<=stop' <<< "${intermediate_certs_txt[i]}" | awk -F= '/CN/ { print $NF }')"
|
||||
# Match Subject/Issuer on next 5 lines, where the CN is (4 lines is fine in most cases, 5 should suffice for all certs)
|
||||
cn="$(awk '/Subject:/{stop=NR+5}; NR<=stop' <<< "${intermediate_certs_txt[i]}" | awk -F= '/CN/ { print $NF }')"
|
||||
issuer_CN="$(awk '/Issuer:/{stop=NR+5}; NR<=stop' <<< "${intermediate_certs_txt[i]}" | awk -F= '/CN/ { print $NF }')"
|
||||
# to catch errors like #2789 during unit test:
|
||||
[[ -z "$cn" ]] && cn="FIXME: cn error"
|
||||
[[ -z "$issuer_CN" ]] && issuer_CN="FIXME: issuer_CN error"
|
||||
pr_italic "$(strip_leading_space "$cn")"; out " <-- "; prln_italic "$(strip_leading_space "$issuer_CN")"
|
||||
fileout "intermediate_cert_notAfter <#${i}>${json_postfix}" "$expok" "$enddate"
|
||||
fileout "intermediate_cert_expiration <#${i}>${json_postfix}" "$expok" "$cn_finding"
|
||||
|
Reference in New Issue
Block a user