check-certificates: include SANs in information

This commit is contained in:
Christian Hesse 2023-04-06 10:26:24 +02:00
parent 706e4de6d1
commit 4073daa139
2 changed files with 11 additions and 0 deletions

View file

@ -38,9 +38,20 @@
:return [ $CharacterReplace [ $CharacterReplace [ :tostr $1 ] "w" "w " ] "d" "d " ];
}
:local FormatSANs do={
:local SANs $1;
:local Return "";
:foreach SAN in=$SANs do={
:set Return ($Return . "\n " . $SAN);
}
:return $Return;
}
:return ( \
"Name: " . ($CertVal->"name") . "\n" . \
[ $IfThenElse ([ :len ($CertVal->"common-name") ] > 0) ("CommonName: " . ($CertVal->"common-name") . "\n") ] . \
[ $IfThenElse ([ :len ($CertVal->"subject-alt-name") ] > 0) ("SubjectAltNames:" . [ $FormatSANs ($CertVal->"subject-alt-name") ] . "\n") ] . \
"Private key: " . [ $IfThenElse (($CertVal->"private-key") = true) "available" "missing" ] . "\n" . \
"Fingerprint: " . ($CertVal->"fingerprint") . "\n" . \
"Issuer: " . ($CertVal->"ca") . ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN") . "\n" . \