Unverified Commit ef5af00d authored by Björn Lundström's avatar Björn Lundström Committed by GitHub

bring up to the config the CheckCertificateRevocation of SslStream.AuthenticateAsClient (#1234)

Co-authored-by: 's avatarBjörn Lundström <V912736@users.noreply.github.com>
parent 8b028166
...@@ -86,6 +86,7 @@ The `ConfigurationOptions` object has a wide range of properties, all of which a ...@@ -86,6 +86,7 @@ The `ConfigurationOptions` object has a wide range of properties, all of which a
| tiebreaker={string} | `TieBreaker` | `__Booksleeve_TieBreak` | Key to use for selecting a server in an ambiguous master scenario | | tiebreaker={string} | `TieBreaker` | `__Booksleeve_TieBreak` | Key to use for selecting a server in an ambiguous master scenario |
| version={string} | `DefaultVersion` | (`3.0` in Azure, else `2.0`) | Redis version level (useful when the server does not make this available) | | version={string} | `DefaultVersion` | (`3.0` in Azure, else `2.0`) | Redis version level (useful when the server does not make this available) |
| writeBuffer={int} | `WriteBuffer` | `4096` | Size of the output buffer | | writeBuffer={int} | `WriteBuffer` | `4096` | Size of the output buffer |
| | `CheckCertificateRevocation` | `true` | A Boolean value that specifies whether the certificate revocation list is checked during authentication. |
Additional code-only options: Additional code-only options:
- ReconnectRetryPolicy (`IReconnectRetryPolicy`) - Default: `ReconnectRetryPolicy = LinearRetry(ConnectTimeout);` - ReconnectRetryPolicy (`IReconnectRetryPolicy`) - Default: `ReconnectRetryPolicy = LinearRetry(ConnectTimeout);`
......
...@@ -128,7 +128,7 @@ public static string TryNormalize(string value) ...@@ -128,7 +128,7 @@ public static string TryNormalize(string value)
} }
} }
private bool? allowAdmin, abortOnConnectFail, highPrioritySocketThreads, resolveDns, ssl; private bool? allowAdmin, abortOnConnectFail, highPrioritySocketThreads, resolveDns, ssl, checkCertificateRevocation;
private string tieBreaker, sslHost, configChannel; private string tieBreaker, sslHost, configChannel;
...@@ -184,6 +184,11 @@ public static string TryNormalize(string value) ...@@ -184,6 +184,11 @@ public static string TryNormalize(string value)
/// </summary> /// </summary>
public RedisChannel ChannelPrefix { get; set; } public RedisChannel ChannelPrefix { get; set; }
/// <summary>
/// A Boolean value that specifies whether the certificate revocation list is checked during authentication.
/// </summary>
public bool CheckCertificateRevocation {get { return checkCertificateRevocation ?? true; } set { checkCertificateRevocation = value; }}
/// <summary> /// <summary>
/// Create a certificate validation check that checks against the supplied issuer even if not known by the machine /// Create a certificate validation check that checks against the supplied issuer even if not known by the machine
/// </summary> /// </summary>
......
...@@ -148,7 +148,7 @@ public static string[] ToStringArray(this RedisValue[] values) ...@@ -148,7 +148,7 @@ public static string[] ToStringArray(this RedisValue[] values)
return Array.ConvertAll(values, x => (string)x); return Array.ConvertAll(values, x => (string)x);
} }
internal static void AuthenticateAsClient(this SslStream ssl, string host, SslProtocols? allowedProtocols) internal static void AuthenticateAsClient(this SslStream ssl, string host, SslProtocols? allowedProtocols, bool checkCertificateRevocation)
{ {
if (!allowedProtocols.HasValue) if (!allowedProtocols.HasValue)
{ {
...@@ -158,8 +158,7 @@ internal static void AuthenticateAsClient(this SslStream ssl, string host, SslPr ...@@ -158,8 +158,7 @@ internal static void AuthenticateAsClient(this SslStream ssl, string host, SslPr
} }
var certificateCollection = new X509CertificateCollection(); var certificateCollection = new X509CertificateCollection();
const bool checkCertRevocation = true; ssl.AuthenticateAsClient(host, certificateCollection, allowedProtocols.Value, checkCertificateRevocation);
ssl.AuthenticateAsClient(host, certificateCollection, allowedProtocols.Value, checkCertRevocation);
} }
private static void AuthenticateAsClientUsingDefaultProtocols(SslStream ssl, string host) private static void AuthenticateAsClientUsingDefaultProtocols(SslStream ssl, string host)
......
...@@ -1307,7 +1307,7 @@ internal async ValueTask<bool> ConnectedAsync(Socket socket, LogProxy log, Socke ...@@ -1307,7 +1307,7 @@ internal async ValueTask<bool> ConnectedAsync(Socket socket, LogProxy log, Socke
{ {
try try
{ {
ssl.AuthenticateAsClient(host, config.SslProtocols); ssl.AuthenticateAsClient(host, config.SslProtocols, config.CheckCertificateRevocation);
} }
catch (Exception ex) catch (Exception ex)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment