diff --git a/netwerk/base/security-prefs.js b/netwerk/base/security-prefs.js index f22a49444b..d0adccd879 100644 --- a/netwerk/base/security-prefs.js +++ b/netwerk/base/security-prefs.js @@ -118,6 +118,15 @@ pref("security.ssl.enable_ocsp_must_staple", true); // Restart required. pref("security.ssl.enable_tls13_compat_mode", false); +// Enable TLS 1.3 hello downgrade sentinel? +// One of the key protections offered by TLS 1.3 is preventing protocol downgrades +// as part of the initial handshake. +// Some domains, middleware and transparent routers may try to downgrade connections +// this way (which is a bad thing!). To allow users to connect anyway this +// check can be disabled here. Default is for the sentinel to be enabled, preventing +// bad downgrades of the protocol version. +pref("security.tls.hello_downgrade_check", true); + // If a request is mixed-content, send an HSTS priming request to attempt to // see if it is available over HTTPS. pref("security.mixed_content.send_hsts_priming", true); diff --git a/security/manager/ssl/nsNSSComponent.cpp b/security/manager/ssl/nsNSSComponent.cpp index 57041d0f26..03a7fd7d46 100644 --- a/security/manager/ssl/nsNSSComponent.cpp +++ b/security/manager/ssl/nsNSSComponent.cpp @@ -1444,6 +1444,7 @@ static const bool NPN_ENABLED_DEFAULT = true; static const bool ALPN_ENABLED_DEFAULT = false; static const bool ENABLED_0RTT_DATA_DEFAULT = false; static const bool TLS13_COMPAT_MODE_DEFAULT = false; +static const bool HELLO_DOWNGRADE_CHECK_DEFAULT = true; static void ConfigureTLSSessionIdentifiers() @@ -1857,7 +1858,7 @@ nsNSSComponent::InitializeNSS() SSL_OptionSetDefault(SSL_ENABLE_RENEGOTIATION, SSL_RENEGOTIATE_REQUIRES_XTN); SSL_OptionSetDefault(SSL_ENABLE_EXTENDED_MASTER_SECRET, true); - + SSL_OptionSetDefault(SSL_ENABLE_FALSE_START, Preferences::GetBool("security.ssl.enable_false_start", FALSE_START_ENABLED_DEFAULT)); @@ -1881,6 +1882,13 @@ nsNSSComponent::InitializeNSS() SSL_OptionSetDefault(SSL_ENABLE_TLS13_COMPAT_MODE, Preferences::GetBool("security.ssl.enable_tls13_compat_mode", TLS13_COMPAT_MODE_DEFAULT)); + + // Set TLS 1.3 hello downgrade sentinel? + bool enableDowngradeCheck = + Preferences::GetBool("security.tls.hello_downgrade_check", + HELLO_DOWNGRADE_CHECK_DEFAULT); + SSL_OptionSetDefault(SSL_ENABLE_HELLO_DOWNGRADE_CHECK, enableDowngradeCheck); + if (NS_FAILED(InitializeCipherSuite())) { @@ -2044,6 +2052,11 @@ nsNSSComponent::Observe(nsISupports* aSubject, const char* aTopic, if (prefName.EqualsLiteral("security.tls.version.min") || prefName.EqualsLiteral("security.tls.version.max")) { (void) setEnabledTLSVersions(); + } else if (prefName.EqualsLiteral("security.tls.hello_downgrade_check")) { + bool enableDowngradeCheck = + Preferences::GetBool("security.tls.hello_downgrade_check", + HELLO_DOWNGRADE_CHECK_DEFAULT); + SSL_OptionSetDefault(SSL_ENABLE_HELLO_DOWNGRADE_CHECK, enableDowngradeCheck); } else if (prefName.EqualsLiteral("security.ssl.require_safe_negotiation")) { bool requireSafeNegotiation = Preferences::GetBool("security.ssl.require_safe_negotiation",