Skip to content

Commit

Permalink
Merge pull request #1227 from dtomcej/tighter-regex
Browse files Browse the repository at this point in the history
Tighten regex match for wildcard certs [Addendum to #1018]
  • Loading branch information
emilevauge committed Mar 7, 2017
2 parents 920b5bb + 9cd76f1 commit dae28f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion acme/acme.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func (a *ACME) getCertificate(clientHello *tls.ClientHelloInfo) (*tls.Certificat
account := a.store.Get().(*Account)
//use regex to test for wildcard certs that might have been added into TLSConfig
for k := range a.TLSConfig.NameToCertificate {
selector := "^" + strings.Replace(k, "*.", ".*\\.?", -1) + "$"
selector := "^" + strings.Replace(k, "*.", "[^\\.]*\\.?", -1) + "$"
match, _ := regexp.MatchString(selector, domain)
if match {
return a.TLSConfig.NameToCertificate[k], nil
Expand Down

0 comments on commit dae28f7

Please sign in to comment.