Skip to content

Commit

Permalink
fix for empty subject cert
Browse files Browse the repository at this point in the history
  • Loading branch information
neil committed Mar 18, 2024
1 parent ba17419 commit 5ab64c5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions letest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,10 @@ _assertcert() {
issuername="$3"
printf "$filename is cert ? "
subj="$(echo $(openssl x509 -in $filename -text -noout | grep 'Subject:.*CN *=' | _egrep_o " CN *=.*" | cut -d '=' -f 2 | cut -d / -f 1))"
if [ -z "$subj" ]; then
#empty subject, let's try dns alt names.
subj="$(echo \"$(openssl x509 -in $filename -text -noout | grep ' *DNS:' | tr -d ' '),\" | _egrep_o "DNS:$subname," | sed 's/DNS://g' | tr -d ,)"
fi
printf "'$subj'"
if _contains "$subj" "$subname" || _isIP "$subname"; then
if [ "$issuername" ] ; then
Expand Down

0 comments on commit 5ab64c5

Please sign in to comment.