Skip to content

Commit

Permalink
Add verification before adding to DNS names to also fix #3918
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferai committed Feb 9, 2018
1 parent d95977b commit ae579f2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions builtin/logical/pki/cert_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,10 @@ func generateCreationBundle(b *backend,
// used for the purpose for which they are presented
emailAddresses = append(emailAddresses, cn)
} else {
dnsNames = append(dnsNames, cn)
// Only add to dnsNames if it's actually a DNS name
if hostnameRegex.MatchString(cn) {
dnsNames = append(dnsNames, cn)
}
}
}

Expand All @@ -654,7 +657,9 @@ func generateCreationBundle(b *backend,
if strings.Contains(v, "@") {
emailAddresses = append(emailAddresses, v)
} else {
dnsNames = append(dnsNames, v)
if hostnameRegex.MatchString(cnAlt) {
dnsNames = append(dnsNames, v)
}
}
}
}
Expand Down

0 comments on commit ae579f2

Please sign in to comment.