Skip to content

Commit d2435cf

Browse files
authored
fix: restrict protocol for TLS Challenge.
1 parent 556f760 commit d2435cf

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pkg/tls/tlsmanager.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (m *Manager) Get(storeName, configName string) (*tls.Config, error) {
106106
tlsConfig.GetCertificate = func(clientHello *tls.ClientHelloInfo) (*tls.Certificate, error) {
107107
domainToCheck := types.CanonicalDomain(clientHello.ServerName)
108108

109-
if m.TLSAlpnGetter != nil {
109+
if m.TLSAlpnGetter != nil && isACMETLS(clientHello) {
110110
cert, err := m.TLSAlpnGetter(domainToCheck)
111111
if err != nil {
112112
return nil, err
@@ -282,3 +282,13 @@ func buildDefaultCertificate(defaultCertificate *Certificate) (*tls.Certificate,
282282
}
283283
return &cert, nil
284284
}
285+
286+
func isACMETLS(clientHello *tls.ClientHelloInfo) bool {
287+
for _, proto := range clientHello.SupportedProtos {
288+
if proto == tlsalpn01.ACMETLS1Protocol {
289+
return true
290+
}
291+
}
292+
293+
return false
294+
}

0 commit comments

Comments
 (0)