From 51465599485dc1532039534ef71cd45cfb19d455 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Wed, 27 Apr 2022 03:50:30 +0700 Subject: [PATCH] Fix typo in `akka.remote.dot-netty.ssl.certificate` --- src/core/Akka.Remote/Configuration/Remote.conf | 4 ++-- .../DotNetty/DotNettyTransportSettings.cs | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/core/Akka.Remote/Configuration/Remote.conf b/src/core/Akka.Remote/Configuration/Remote.conf index 9bc288644e3..3b593c2f75a 100644 --- a/src/core/Akka.Remote/Configuration/Remote.conf +++ b/src/core/Akka.Remote/Configuration/Remote.conf @@ -555,13 +555,13 @@ akka { # To use a Thumbprint instead of a file, set this to true # And specify a thumprint and it's storage location below - use-thumprint-over-file = false + use-thumbprint-over-file = false # Valid Thumprint required (if use-thumbprint-over-file is true) # A typical thumbprint is a format similar to: "45df32e258c92a7abf6c112e54912ab15bbb9eb0" # On Windows machines, The thumprint for an installed certificate can be located # By using certlm.msc and opening the certificate under the 'Details' tab. - thumpbrint = "" + thumbprint = "" # The Store name. Under windows The most common option is "My", which indicates the personal store. # See System.Security.Cryptography.X509Certificates.StoreName for other common values. diff --git a/src/core/Akka.Remote/Transport/DotNetty/DotNettyTransportSettings.cs b/src/core/Akka.Remote/Transport/DotNetty/DotNettyTransportSettings.cs index 5b28bad7e66..d680534a1b8 100644 --- a/src/core/Akka.Remote/Transport/DotNetty/DotNettyTransportSettings.cs +++ b/src/core/Akka.Remote/Transport/DotNetty/DotNettyTransportSettings.cs @@ -292,11 +292,17 @@ internal sealed class SslSettings public static SslSettings Create(Config config) { if (config.IsNullOrEmpty()) - throw new ConfigurationException($"Failed to create {typeof(DotNettyTransportSettings)}: DotNetty SSL HOCON config was not found (default path: `akka.remote.dot-netty.Ssl`)"); + throw new ConfigurationException($"Failed to create {typeof(DotNettyTransportSettings)}: DotNetty SSL HOCON config was not found (default path: `akka.remote.dot-netty.ssl`)"); - if (config.GetBoolean("certificate.use-thumprint-over-file", false)) + if (config.GetBoolean("certificate.use-thumprint-over-file", false) + || config.GetBoolean("certificate.use-thumbprint-over-file", false)) { - return new SslSettings(config.GetString("certificate.thumbprint", null), + var thumbprint = config.GetString("certificate.thumbprint", null) + ?? config.GetString("certificate.thumpbrint", null); + if (string.IsNullOrWhiteSpace(thumbprint)) + throw new Exception("`akka.remote.dot-netty.ssl.certificate.use-thumbprint-over-file` is set to true but `akka.remote.dot-netty.ssl.certificate.thumbprint` is null or empty"); + + return new SslSettings(thumbprint, config.GetString("certificate.store-name", null), ParseStoreLocationName(config.GetString("certificate.store-location", null)), config.GetBoolean("suppress-validation", false)); @@ -366,7 +372,7 @@ public SslSettings(string certificateThumbprint, string storeName, StoreLocation if (find.Count == 0) { throw new ArgumentException( - "Could not find Valid certificate for thumbprint (by default it can be found under `akka.remote.dot-netty.tcp.ssl.certificate.thumpbrint`. Also check akka.remote.dot-netty.tcp.ssl.certificate.store-name and akka.remote.dot-netty.tcp.ssl.certificate.store-location)"); + "Could not find Valid certificate for thumbprint (by default it can be found under `akka.remote.dot-netty.tcp.ssl.certificate.thumbprint`. Also check `akka.remote.dot-netty.tcp.ssl.certificate.store-name` and `akka.remote.dot-netty.tcp.ssl.certificate.store-location`)"); } Certificate = find[0];