-
Couldn't load subscription status.
- Fork 1.5k
Description
As the title states, ConfigurationOptions.CheckCertificateRevocation is ignored unless ConfigurationOptions.SslProtocols is specified, and the resulting behavior is that the revocation check is always skipped. This seems like unexpected behavior, especially given that the default value for ConfigurationOptions.CheckCertificateRevocation is true. At the very least it is inconsistent behavior that can cause surprising bugs to occur when the an application changes to specifying the TLS version.
The fault lies in this block of code:
StackExchange.Redis/src/StackExchange.Redis/ExtensionMethods.cs
Lines 151 to 167 in 40595ca
| internal static void AuthenticateAsClient(this SslStream ssl, string host, SslProtocols? allowedProtocols, bool checkCertificateRevocation) | |
| { | |
| if (!allowedProtocols.HasValue) | |
| { | |
| //Default to the sslProtocols defined by the .NET Framework | |
| AuthenticateAsClientUsingDefaultProtocols(ssl, host); | |
| return; | |
| } | |
| var certificateCollection = new X509CertificateCollection(); | |
| ssl.AuthenticateAsClient(host, certificateCollection, allowedProtocols.Value, checkCertificateRevocation); | |
| } | |
| private static void AuthenticateAsClientUsingDefaultProtocols(SslStream ssl, string host) | |
| { | |
| ssl.AuthenticateAsClient(host); | |
| } |
In line 166 the overload used does not actually check for certificate revocation. Unfortunately the next best overload does not exist pre 4.7, and the default for SslProtocols changed between 4.6 and 4.7. That makes this not a straightforward change, otherwise this would be a pull request rather than an issue.