Skip to content

Commit f2a0828

Browse files
committed
Make tls_cipher_suite a no-op
This has been the source of confusion, it makes more harm than good, and it complicates the code.
1 parent 7e1fa93 commit f2a0828

File tree

3 files changed

+2
-61
lines changed

3 files changed

+2
-61
lines changed

dnscrypt-proxy/config_loader.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func configureLogging(proxy *Proxy, flags *ConfigFlags, config *Config) {
6565
// configureXTransport - Configures the XTransport
6666
func configureXTransport(proxy *Proxy, config *Config) error {
6767
proxy.xTransport.tlsDisableSessionTickets = config.TLSDisableSessionTickets
68-
proxy.xTransport.tlsCipherSuite = config.TLSCipherSuite
6968
proxy.xTransport.http3 = config.HTTP3
7069
proxy.xTransport.http3Probe = config.HTTP3Probe
7170

dnscrypt-proxy/example-dnscrypt-proxy.toml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -287,23 +287,6 @@ cert_refresh_delay = 240
287287
# tls_disable_session_tickets = false
288288

289289

290-
## DoH: Use TLS 1.2 and specific cipher suite instead of the server preference
291-
## 49199 = TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
292-
## 49195 = TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
293-
## 52392 = TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
294-
## 52393 = TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
295-
##
296-
## On non-Intel CPUs such as MIPS routers and ARM systems (Android, Raspberry Pi...),
297-
## uncommenting the following line may improve performance.
298-
## This may also help on Intel CPUs running 32-bit operating systems.
299-
## However, this can cause issues fetching sources or connecting to some HTTP servers,
300-
## and should not be set on regular CPUs.
301-
##
302-
## Keep tls_cipher_suite undefined to let the app automatically choose secure parameters.
303-
304-
# tls_cipher_suite = [52392, 49199]
305-
306-
307290
## Log TLS key material to a file, for debugging purposes only.
308291
## This file will contain the TLS master key, which can be used to decrypt
309292
## all TLS traffic to/from DoH servers.

dnscrypt-proxy/xtransport.go

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ type XTransport struct {
7777
http3 bool
7878
http3Probe bool
7979
tlsDisableSessionTickets bool
80-
tlsCipherSuite []uint16
8180
proxyDialer *netproxy.Dialer
8281
httpProxyFunction func(*http.Request) (*url.URL, error)
8382
tlsClientCreds DOHClientCreds
@@ -100,7 +99,6 @@ func NewXTransport() *XTransport {
10099
useIPv6: false,
101100
http3Probe: false,
102101
tlsDisableSessionTickets: false,
103-
tlsCipherSuite: nil,
104102
keyLogWriter: nil,
105103
}
106104
return &xTransport
@@ -327,40 +325,8 @@ func (xTransport *XTransport) rebuildTransport() {
327325
tlsClientConfig.Certificates = []tls.Certificate{cert}
328326
}
329327

330-
overrideCipherSuite := len(xTransport.tlsCipherSuite) > 0
331-
if xTransport.tlsDisableSessionTickets || overrideCipherSuite {
332-
tlsClientConfig.SessionTicketsDisabled = xTransport.tlsDisableSessionTickets
333-
if !xTransport.tlsDisableSessionTickets {
334-
tlsClientConfig.ClientSessionCache = tls.NewLRUClientSessionCache(10)
335-
}
336-
if overrideCipherSuite {
337-
tlsClientConfig.PreferServerCipherSuites = false
338-
tlsClientConfig.CipherSuites = xTransport.tlsCipherSuite
339-
340-
// Go doesn't allow changing the cipher suite with TLS 1.3
341-
// So, check if the requested set of ciphers matches the TLS 1.3 suite.
342-
// If it doesn't, downgrade to TLS 1.2
343-
compatibleSuitesCount := 0
344-
for _, suite := range tls.CipherSuites() {
345-
if suite.Insecure {
346-
continue
347-
}
348-
for _, supportedVersion := range suite.SupportedVersions {
349-
if supportedVersion == tls.VersionTLS12 {
350-
for _, expectedSuiteID := range xTransport.tlsCipherSuite {
351-
if expectedSuiteID == suite.ID {
352-
compatibleSuitesCount += 1
353-
break
354-
}
355-
}
356-
}
357-
}
358-
}
359-
if compatibleSuitesCount != len(tls.CipherSuites()) {
360-
dlog.Notice("Explicit cipher suite configured - downgrading to TLS 1.2")
361-
tlsClientConfig.MaxVersion = tls.VersionTLS12
362-
}
363-
}
328+
if xTransport.tlsDisableSessionTickets {
329+
tlsClientConfig.SessionTicketsDisabled = true
364330
}
365331
transport.TLSClientConfig = &tlsClientConfig
366332
if http2Transport, _ := http2.ConfigureTransports(transport); http2Transport != nil {
@@ -761,13 +727,6 @@ func (xTransport *XTransport) Fetch(
761727
}
762728
if err != nil {
763729
dlog.Debugf("[%s]: [%s]", req.URL, err)
764-
if xTransport.tlsCipherSuite != nil && strings.Contains(err.Error(), "handshake failure") {
765-
dlog.Warnf(
766-
"TLS handshake failure - Try changing or deleting the tls_cipher_suite value in the configuration file",
767-
)
768-
xTransport.tlsCipherSuite = nil
769-
xTransport.rebuildTransport()
770-
}
771730
return nil, statusCode, nil, rtt, err
772731
}
773732
if xTransport.h3Transport != nil && !hasAltSupport {

0 commit comments

Comments
 (0)