-
Notifications
You must be signed in to change notification settings - Fork 22
Add SSL TLS configuration settings changes from Akka v1.5.52 and v1.5.53 #675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Aaronontheweb
merged 4 commits into
akkadotnet:dev
from
Arkatufus:feature/ssl-tls-152-153-settings
Oct 14, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2a463af
feat(Remote.Hosting): Add SSL/TLS configuration options from Akka.NET…
Arkatufus 19c44cb
chore: Upgrade Akka.NET to v1.5.53 and enable new SSL/TLS constructor
Arkatufus a97f5aa
Update API Approval list
Arkatufus fa4cfdd
harden unit tests
Arkatufus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,12 +104,24 @@ internal void Build(AkkaConfigurationBuilder builder) | |
|
|
||
| if (sb.Length > 0) | ||
| builder.AddHocon(sb.ToString(), HoconAddMode.Prepend); | ||
| if (EnableSsl is false || Ssl.X509Certificate == null) | ||
|
|
||
| if (EnableSsl is false || Ssl.X509Certificate == null) | ||
| return; | ||
|
|
||
| var suppressValidation = Ssl.SuppressValidation ?? false; | ||
| builder.AddSetup(new DotNettySslSetup(Ssl.X509Certificate, suppressValidation)); | ||
| var requireMutualAuth = Ssl.RequireMutualAuthentication ?? true; // Default to true as per v1.5.52 | ||
| var validateHostname = Ssl.ValidateCertificateHostname ?? false; // Default to false as per v1.5.53 | ||
|
|
||
| // Use the 4-parameter constructor if any of the new settings are provided, otherwise use the legacy constructor for backward compatibility | ||
| if (Ssl.RequireMutualAuthentication.HasValue || Ssl.ValidateCertificateHostname.HasValue) | ||
| { | ||
| builder.AddSetup(new DotNettySslSetup(Ssl.X509Certificate, suppressValidation, requireMutualAuth, validateHostname)); | ||
| } | ||
| else | ||
| { | ||
| // Use legacy constructor for backward compatibility when new settings are not specified | ||
| builder.AddSetup(new DotNettySslSetup(Ssl.X509Certificate, suppressValidation)); | ||
| } | ||
| } | ||
|
|
||
| private void Build(StringBuilder builder) | ||
|
|
@@ -197,18 +209,55 @@ public sealed class SslOptions | |
| public X509Certificate2? X509Certificate { get; set; } | ||
| public SslCertificateOptions CertificateOptions { get; set; } = new (); | ||
|
|
||
| /// <summary> | ||
| /// <para> | ||
| /// When set to true, enables mutual TLS (mTLS) authentication where both client and server | ||
| /// must present valid certificates with accessible private keys during the TLS handshake. | ||
| /// </para> | ||
| /// <para> | ||
| /// This provides defense-in-depth security by ensuring bidirectional authentication and | ||
| /// preventing asymmetric connectivity issues in peer-to-peer Akka.Remote connections. | ||
| /// </para> | ||
| /// <b>Default:</b> true (as of Akka.NET v1.5.52) | ||
| /// </summary> | ||
| public bool? RequireMutualAuthentication { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// <para> | ||
| /// Controls whether certificate hostname validation is performed during TLS handshake. | ||
| /// </para> | ||
| /// <para> | ||
| /// When enabled (true): Traditional TLS hostname validation is performed - certificate CN/SAN must match the target hostname. | ||
| /// When disabled (false): Only validates certificate chain against CA, ignores hostname mismatches. | ||
| /// </para> | ||
| /// <para> | ||
| /// Disabling hostname validation may be necessary for: | ||
| /// - Mutual TLS with per-node certificates in P2P clusters | ||
| /// - IP-based connections where certificates use DNS names | ||
| /// - Service discovery with dynamic addresses | ||
| /// </para> | ||
| /// <b>Default:</b> false (as of Akka.NET v1.5.53) | ||
| /// </summary> | ||
| public bool? ValidateCertificateHostname { get; set; } | ||
|
|
||
| internal void Build(StringBuilder builder) | ||
| { | ||
| var sb = new StringBuilder(); | ||
|
|
||
| if (SuppressValidation is not null) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we supposed to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we do, in line 118 |
||
| sb.AppendLine($"suppress-validation = {SuppressValidation.ToHocon()}"); | ||
|
|
||
|
|
||
| if (RequireMutualAuthentication is not null) | ||
| sb.AppendLine($"require-mutual-authentication = {RequireMutualAuthentication.ToHocon()}"); | ||
|
|
||
| if (ValidateCertificateHostname is not null) | ||
| sb.AppendLine($"validate-certificate-hostname = {ValidateCertificateHostname.ToHocon()}"); | ||
|
|
||
| CertificateOptions.Build(sb); | ||
|
|
||
| if(sb.Length == 0) | ||
| return; | ||
|
|
||
| sb.Insert(0, "ssl {"); | ||
| sb.AppendLine("}"); | ||
| builder.Append(sb); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM