[v1.5] Fix: Validate SSL certificate private key access at server startup #7848
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.
Backport to v1.5
This is a backport of #7847 to the v1.5 maintenance branch.
Problem
Akka.Remote server starts successfully even when the application lacks permissions to access the SSL certificate's private key. The server appears healthy but fails when clients attempt to connect, causing:
Solution
Certificate Validation at Startup
Added
ValidateCertificate()method toSslSettingsthat:Certificate.HasPrivateKeyGetRSAPrivateKey()andGetECDsaPrivateKey())ConfigurationExceptionwith clear error message on failureFail-Fast in Listen()
Call validation in
Listen()method before server socket binds to ensure fail-fast behavior at startup.Comprehensive Tests
Changes
Files Modified
Akka.Remote/Transport/DotNetty/DotNettyTransportSettings.cs- AddedValidateCertificate()methodAkka.Remote/Transport/DotNetty/DotNettyTransport.cs- Call validation before server bindAkka.Remote.Tests/Transport/DotNettyCertificateValidationSpec.cs- New test suiteAkka.Remote.Tests/Transport/DotNettyTlsHandshakeFailureSpec.cs- Updated for fail-fastImpact
Breaking Change (Expected)
Existing misconfigured deployments will now fail at startup instead of silently starting with broken TLS. This is correct behavior - fail-fast is better than silent failure.
Migration
If ActorSystem fails with:
Fix: Grant the application user read permissions to the certificate's private key:
Related
dev)Checklist