Skip to content

Commit 735cc66

Browse files
authored
Merge pull request #2792 from testssl/fix_issuerCN
Fix missing issuer CN
2 parents fd6dbb2 + 0a89d5c commit 735cc66

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

t/10_baseline_ipv4_http.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ my $openssl_json="";
2626
# @args="$prg $check2run $uri >/dev/null";
2727
# system("@args") == 0
2828
# or die ("FAILED: \"@args\" ");
29-
my $socket_errors='(e|E)rror|\.\/testssl\.sh: line |(f|F)atal|(c|C)ommand not found';
30-
my $openssl_errors='(e|E)rror|(f|F)atal|\.\/testssl\.sh: line |Oops|s_client connect problem|(c|C)ommand not found';
29+
my $socket_errors='(e|E)rror|FIXME|\.\/testssl\.sh: line |(f|F)atal|(c|C)ommand not found';
30+
my $openssl_errors='(e|E)rror|FIXME|(f|F)atal|\.\/testssl\.sh: line |Oops|s_client connect problem|(c|C)ommand not found';
3131
my $json_errors='(id".*:\s"scanProblem"|severity".*:\s"FATAL"|"Scan interrupted")';
3232

3333

testssl.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10121,9 +10121,12 @@ certificate_info() {
1012110121
expok="OK"
1012210122
fi
1012310123
out " ($enddate). "
10124-
# Match on Subject/Issuer plus next 3 lines
10125-
cn="$(awk '/Subject:/{stop=NR+3}; NR<=stop' <<< "${intermediate_certs_txt[i]}" | awk -F= '/CN/ { print $NF }')"
10126-
issuer_CN="$(awk '/Issuer:/{stop=NR+3}; NR<=stop' <<< "${intermediate_certs_txt[i]}" | awk -F= '/CN/ { print $NF }')"
10124+
# Match Subject/Issuer on next 5 lines, where the CN is (4 lines is fine in most cases, 5 should suffice for all certs)
10125+
cn="$(awk '/Subject:/{stop=NR+5}; NR<=stop' <<< "${intermediate_certs_txt[i]}" | awk -F= '/CN/ { print $NF }')"
10126+
issuer_CN="$(awk '/Issuer:/{stop=NR+5}; NR<=stop' <<< "${intermediate_certs_txt[i]}" | awk -F= '/CN/ { print $NF }')"
10127+
# to catch errors like #2789 during unit test:
10128+
[[ -z "$cn" ]] && cn="FIXME: cn error"
10129+
[[ -z "$issuer_CN" ]] && issuer_CN="FIXME: issuer_CN error"
1012710130
pr_italic "$(strip_leading_space "$cn")"; out " <-- "; prln_italic "$(strip_leading_space "$issuer_CN")"
1012810131
fileout "intermediate_cert_notAfter <#${i}>${json_postfix}" "$expok" "$enddate"
1012910132
fileout "intermediate_cert_expiration <#${i}>${json_postfix}" "$expok" "$cn_finding"

0 commit comments

Comments
 (0)