mirror of
https://github.com/caddyserver/caddy.git
synced 2026-03-14 22:12:11 -04:00
caddytls: Enable ECH on the "gotten" tls.Config instead of the "getter"
No idea if this fixes #7555
This commit is contained in:
parent
1fbb28720b
commit
6cef20d257
@ -167,12 +167,6 @@ func (cp ConnectionPolicies) TLSConfig(ctx caddy.Context) *tls.Config {
|
||||
}
|
||||
tlsApp.RegisterServerNames(echNames)
|
||||
}
|
||||
|
||||
tlsCfg.GetEncryptedClientHelloKeys = func(chi *tls.ClientHelloInfo) ([]tls.EncryptedClientHelloKey, error) {
|
||||
tlsApp.EncryptedClientHello.configsMu.RLock()
|
||||
defer tlsApp.EncryptedClientHello.configsMu.RUnlock()
|
||||
return tlsApp.EncryptedClientHello.stdlibReady, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,6 +370,19 @@ func (p *ConnectionPolicy) buildStandardTLSConfig(ctx caddy.Context) error {
|
||||
cfg.MaxVersion = SupportedProtocols[p.ProtocolMax]
|
||||
}
|
||||
|
||||
// enable ECH (Encrypted ClientHello) if configured
|
||||
if tlsApp.EncryptedClientHello != nil {
|
||||
cfg.GetEncryptedClientHelloKeys = func(_ *tls.ClientHelloInfo) ([]tls.EncryptedClientHelloKey, error) {
|
||||
tlsApp.EncryptedClientHello.configsMu.RLock()
|
||||
defer tlsApp.EncryptedClientHello.configsMu.RUnlock()
|
||||
return tlsApp.EncryptedClientHello.stdlibReady, nil
|
||||
}
|
||||
// TLS 1.3 is the first version that supports ECH
|
||||
if cfg.MinVersion < tls.VersionTLS13 {
|
||||
cfg.MaxVersion = tls.VersionTLS13
|
||||
}
|
||||
}
|
||||
|
||||
// client authentication
|
||||
if p.ClientAuthentication != nil {
|
||||
if err := p.ClientAuthentication.provision(ctx); err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user