Add SSL client authentication options configuration for legacy RSA FTPS servers
This PR adds a configuration hook that allows users to customize SslClientAuthenticationOptions before the TLS handshake, enabling support for Linux for legacy FTPS servers that only negotiate RSA key-exchange ciphers.
The problem:
On Linux, .NET’s SslStream does not offer RSA key-exchange cipher suites by default. As a result, FluentFTP cannot complete the TLS handshake on these servers unless it exposes SslClientAuthenticationOptions and allows custom CipherSuitesPolicy.
Microsoft documents this behavior here.
The commits added:
- Added
ConfigureSslClientAuthenticationOptionsproperty toFtpConfigthat allows users to customizeSslClientAuthenticationOptionsbefore authentication - Updated TLS handshake code to use
SslClientAuthenticationOptionspattern in both synchronous and async methods - Added example file demonstrating how to configure FluentFTP for legacy RSA-only servers
I've created a repository with instructions on how to reproduce the handshake error. The repository, including instructions on how to setup the environment, can be found here.
UPDATE:
As per PR feedback, the PR now adds an event handler that allows users to customize SslClientAuthenticationOptions before the TLS handshake, enabling support for legacy FTPS servers
Changes:
-
Added
FtpSslClientAuthenticationOptionsevent delegate and event args class - Infrastructure for the event -
Added
ConfigureSslClientAuthenticationOptionsevent toBaseFtpClient- Event handler that allows customization of SSL options -
Added
OnConfigureSslClientAuthenticationOptionshelper method - Internal method to fire the event (following the same pattern asValidateCertificate) -
Added example file -
ConnectFTPSLegacyRSA.csdemonstrating how to configure FluentFTP for legacy RSA-only servers
Thanks, good work. Event handlers should be added to the ftp client classes and not the config. Config is only for simple properties.
@robinrodricks, thank you for the feedback. I have updated the implementation.