@marcel91200 / caddy Mirror · read-only / commits / 839507e2
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

http: Consider wildcards when evaluating automatic HTTPS

Matthew Holt committed Sep 13, 2019 at 11:46 UTC 839507e24e4d8d2d8052335fafb110513865efc0
4 files changed +9 -9
go.mod
+1 -1
@@ -17,7 +17,7 @@ require (
17 github.com/klauspost/compress v1.7.1-0.20190613161414-0b31f265a57b
18 github.com/klauspost/cpuid v1.2.1
19 github.com/lucas-clemente/quic-go v0.7.1-0.20190908032346-fc962d18373a
20 - github.com/mholt/certmagic v0.7.0
20 + github.com/mholt/certmagic v0.7.1
21 github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936
22 github.com/muhammadmuzzammil1998/jsonc v0.0.0-20190902132743-e4903c4dea48
23 github.com/rs/cors v1.6.0
go.sum
+2 -2
@@ -156,8 +156,8 @@ github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp
156 github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
157 github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
158 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
159 -github.com/mholt/certmagic v0.7.0 h1:F1rn76bjfSq5hNF19Jb8TbfCkgR/AAxfSMLUGy1FpX8=
160 -github.com/mholt/certmagic v0.7.0/go.mod h1:hqHzDsY32TwZpj/KswVylheSISjquF/eOVOaJTYV15w=
159 +github.com/mholt/certmagic v0.7.1 h1:nbSSVwvlDE3+vttD/RBikBIkxrlKVkIQOz449gCrG5Q=
160 +github.com/mholt/certmagic v0.7.1/go.mod h1:hqHzDsY32TwZpj/KswVylheSISjquF/eOVOaJTYV15w=
161 github.com/miekg/dns v1.1.15 h1:CSSIDtllwGLMoA6zjdKnaE6Tx6eVUxQ29LUgGetiDCI=
162 github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
163 github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
modules/caddyhttp/caddyhttp.go
+2 -2
@@ -313,8 +313,8 @@ func (app *App) automaticHTTPS() error {
313 // don't obtain another one for it, unless we are
314 // supposed to ignore loaded certificates
315 if !srv.AutoHTTPS.IgnoreLoadedCerts &&
316 - len(tlsApp.CertificatesWithSAN(d)) > 0 {
317 - log.Printf("[INFO][%s] Skipping automatic certificate management because a certificate with that SAN is already loaded", d)
316 + len(tlsApp.AllMatchingCertificates(d)) > 0 {
317 + log.Printf("[INFO][%s] Skipping automatic certificate management because one or more matching certificates are already loaded", d)
318 continue
319 }
320 domainsForCerts = append(domainsForCerts, d)
modules/caddytls/tls.go
+4 -4
@@ -200,10 +200,10 @@ func (t *TLS) getAutomationPolicyForName(name string) AutomationPolicy {
200 return AutomationPolicy{Management: new(ACMEManagerMaker)}
201 }
202
203 -// CertificatesWithSAN returns the list of all certificates
204 -// in the cache the match the given SAN value.
205 -func (t *TLS) CertificatesWithSAN(san string) []certmagic.Certificate {
206 - return t.certCache.CertificatesWithSAN(san)
203 +// CertificatesForSAN returns the list of all certificates in
204 +// the cache which could be used to satisfy the given SAN.
205 +func (t *TLS) AllMatchingCertificates(san string) []certmagic.Certificate {
206 + return t.certCache.AllMatchingCertificates(san)
207 }
208
209 // CertificateLoader is a type that can load certificates.