Implement Case-insensitive SNI matching

This commit is contained in:
Daniel Tomcej
2018-11-26 03:38:03 -06:00
committed by Traefiker Bot
parent 479ee9af49
commit 4a5f5440d7
8 changed files with 232 additions and 14 deletions

View File

@@ -13,6 +13,7 @@ import (
"net/url"
"os"
"os/signal"
"strings"
"sync"
"time"
@@ -711,13 +712,13 @@ func (s *Server) buildNameOrIPToCertificate(certs []tls.Certificate) map[string]
continue
}
if len(x509Cert.Subject.CommonName) > 0 {
certMap[x509Cert.Subject.CommonName] = cert
certMap[strings.ToLower(x509Cert.Subject.CommonName)] = cert
}
for _, san := range x509Cert.DNSNames {
certMap[san] = cert
certMap[strings.ToLower(san)] = cert
}
for _, ipSan := range x509Cert.IPAddresses {
certMap[ipSan.String()] = cert
certMap[strings.ToLower(ipSan.String())] = cert
}
}
return certMap