Skip to content

Commit

Permalink
Recognise self-signed certificates rather than assuming everything is…
Browse files Browse the repository at this point in the history
… issued from some CA.

It turns out that a number of members use self-signed browser-facing certificates on test entities.
  • Loading branch information
iay committed Nov 30, 2012
1 parent 1e0f42b commit d3ed366
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions build/probe_nocerts.pl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}

#
# Use openssl to convert the certificate to text
# Use openssl to convert the certificate to text
#
my(@lines, $issuer, $subjectCN, $issuerCN);
$cmd = "openssl x509 -in $temp_der -inform der -noout -text -nameopt RFC2253 -modulus |";
Expand All @@ -77,16 +77,24 @@
if (/^\s*Issuer:\s*(.*)$/) {
$issuer = $1;
#print "$hostPort: issuer is $issuer\n";
$issuers{$issuer}{$loc} = 1;
$numissued++;
if ($issuer =~ /CN=([^,]+)/) {
$issuerCN = $1;
} else {
$issuerCN = $issuer;
}
}
if (/^\s*Subject:\s*(.*)$/) {
$subject = $1;
}
}

if ($subject eq $issuer) {
$issuer = "(self signed certificate)";
}

if ($issuer =~ /CN=([^,]+)/) {
$issuerCN = $1;
} else {
$issuerCN = $issuer;
}

$issuers{$issuer}{$loc} = 1;
$numissued++;
}
print "\n\n";

Expand All @@ -108,3 +116,8 @@
print " $loc\n";
}
}

#
# Clean up
#
unlink $temp_der;

0 comments on commit d3ed366

Please sign in to comment.