FluentFTP: 39.0.1 - Authentication failed because the remote party sent a TLS alert: 'ProtocolVersion'.
FTP OS: QNAP NAS
FTP Server: ProFTPD
Computer OS: Windows 10 / Visual Studio 2022
FluentFTP Version: 39.0.1
Framework: .NET6.0
Here my code to connect to our customer:
_''' <summary>
''' Herstellen einer Verbindung zu einem FTP-Server
''' </summary>
''' <param name="FtpServer"></param>
Public Sub Connect(FtpServer As FtpServer)
Try
If FTPSClnt Is Nothing Then
FTPSClnt = New FtpClient
With FTPSClnt
.Host = FtpServer.ServerAdress
.Credentials = New Net.NetworkCredential(FtpServer.UserName, FtpServer.Password)
.EncryptionMode = FtpEncryptionMode.Explicit
.SslProtocols = .SslProtocols Or Security.Authentication.SslProtocols.Tls13 Or Security.Authentication.SslProtocols.Tls12 Or
Security.Authentication.SslProtocols.Tls11 Or Security.Authentication.SslProtocols.Tls
.Port = FtpServer.Port
.DataConnectionEncryption = True
.DownloadDataType = FtpDataType.Binary
.ValidateAnyCertificate = True
.EnableThreadSafeDataConnections = True
.SocketKeepAlive = True
.DataConnectionType = FtpDataConnectionType.EPSV
.SslBuffering = FtpsBuffering.Off
End With
End If
If FTPSClnt.IsConnected = False Then
Me.FTPLOG_ENABLE = "C:\tmp\Fluent.log"
FTPSClnt.Connect()
End If
Catch ex As Exception
NLOGLOGGER.Fatal("Connection is abnormal ending")
NLOGLOGGER.Fatal(ex.Message)
End Try
End Sub_
When I try to connect, then I have the error:
One or more errors occurred. (Authentication failed because the remote party sent a TLS alert: 'ProtocolVersion'.)
Logs :
Here the logs from Fluent
# Connect() Status: Connecting to*...*:21 Response: 220 NASFTPD Turbo station 1.3.6 Server (ProFTPD) [::ffff:10.1.10.6] Status: Detected FTP server: ProFTPD Command: AUTH TLS Response: 234 AUTH TLS successful
If i connect with Filezilla, then I have following Log
2022-08-05 15:40:48 6284 1 Status: Auflösen der IP-Adresse für ftp.xxxx.de 2022-08-05 15:40:48 6284 1 Status: Verbinde mit ...:21… 2022-08-05 15:40:48 6284 1 Status: Verbindung hergestellt, warte auf Willkommensnachricht… 2022-08-05 15:40:48 6284 1 Antwort: 220 NASFTPD Turbo station 1.3.6 Server (ProFTPD) [::ffff:10.1.10.6] 2022-08-05 15:40:48 6284 1 Befehl: AUTH TLS 2022-08-05 15:40:49 6284 1 Antwort: 234 AUTH TLS successful 2022-08-05 15:40:49 6284 1 Status: Initialisiere TLS… 2022-08-05 15:40:51 6284 1 Status: TLS-Verbindung hergestellt. 2022-08-05 15:40:51 6284 1 Befehl: USER *** 2022-08-05 15:40:51 6284 1 Antwort: 331 Password required for *** 2022-08-05 15:40:51 6284 1 Befehl: PASS ********** 2022-08-05 15:40:51 6284 1 Antwort: 230 User *** logged in 2022-08-05 15:40:51 6284 1 Befehl: SYST 2022-08-05 15:40:51 6284 1 Antwort: 215 UNIX Type: L8 2022-08-05 15:40:51 6284 1 Befehl: FEAT 2022-08-05 15:40:51 6284 1 Antwort: 211-Features: 2022-08-05 15:40:51 6284 1 Antwort: AUTH TLS 2022-08-05 15:40:51 6284 1 Antwort: CCC 2022-08-05 15:40:51 6284 1 Antwort: CLNT 2022-08-05 15:40:51 6284 1 Antwort: EPRT 2022-08-05 15:40:51 6284 1 Antwort: EPSV 2022-08-05 15:40:51 6284 1 Antwort: HOST 2022-08-05 15:40:51 6284 1 Antwort: LANG en-US* 2022-08-05 15:40:51 6284 1 Antwort: MDTM 2022-08-05 15:40:51 6284 1 Antwort: MFF modify;UNIX.group;UNIX.mode; 2022-08-05 15:40:51 6284 1 Antwort: MFMT 2022-08-05 15:40:51 6284 1 Antwort: MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*; 2022-08-05 15:40:51 6284 1 Antwort: PBSZ 2022-08-05 15:40:51 6284 1 Antwort: PROT 2022-08-05 15:40:51 6284 1 Antwort: REST STREAM 2022-08-05 15:40:51 6284 1 Antwort: SIZE 2022-08-05 15:40:51 6284 1 Antwort: SSCN 2022-08-05 15:40:51 6284 1 Antwort: TVFS 2022-08-05 15:40:51 6284 1 Antwort: 211 End 2022-08-05 15:40:51 6284 1 Status: Der Server unterstützt keine Nicht-ASCII-Zeichen. 2022-08-05 15:40:51 6284 1 Befehl: PBSZ 0 2022-08-05 15:40:51 6284 1 Antwort: 200 PBSZ 0 successful 2022-08-05 15:40:51 6284 1 Befehl: PROT P 2022-08-05 15:40:51 6284 1 Antwort: 200 Protection set to Private 2022-08-05 15:40:51 6284 1 Status: Angemeldet 2022-08-05 15:40:51 6284 1 Status: Empfange Verzeichnisinhalt… 2022-08-05 15:40:51 6284 1 Befehl: PWD 2022-08-05 15:40:51 6284 1 Antwort: 257 “/” is the current directory 2022-08-05 15:40:51 6284 1 Befehl: TYPE I 2022-08-05 15:40:51 6284 1 Antwort: 200 Type set to I 2022-08-05 15:40:51 6284 1 Befehl: PASV 2022-08-05 15:40:51 6284 1 Antwort: 227 Entering Passive Mode (10,1,10,6,217,252). 2022-08-05 15:40:51 6284 1 Status: Vom Server gesendete Adresse für den Passiv-Modus ist nicht routingfähig. Benutze stattdessen die Serveradresse. 2022-08-05 15:40:51 6284 1 Befehl: MLSD 2022-08-05 15:40:51 6284 1 Antwort: 150 Opening BINARY mode data connection for MLSD 2022-08-05 15:40:51 6284 1 Antwort: 226 Transfer complete 2022-08-05 15:40:51 6284 1 Status: Anzeigen des Verzeichnisinhalts für “/” abgeschlossen
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 83 (32 by maintainers)
Following code is missing in my function:
.Config.ValidateAnyCertificate = True
Now it works fine
My developer machine is Windows 10 - and on this machine is it not working. So my information to you, that I use Windows 10 is right. In the beginning i didn´t know that it is important, that I will it use on Window 2012. I didn´t understand the parts that you use to connect via TLS1.3. But in the meantime i investigate and understand how all works together.
Sorry for this missunderstanding
@JosHuybrighs I have testet the SSH.NET - but they didn´t work. Only FTPS is allowed
@robinrodricks I find this actual project in github https://github.com/whSwitching/TLSHandler - is it possible to implement it in your FluentFTP Project? So i can imagine that you are not OS depend was TLS 1.3
@robinrodricks I did some further TLS1.3 tests against my Synology FTP server, added the master GitHub version of the FluentFTP project to my Visual Studio solution, and observed the following:
m_stream.ActivateEncryptionreturns, there is still 86 bytes of unread data inm_stream.Execute("USER " + userName)then fails with ‘Stale Data’.I took a look at the stream data of the session negotation using Wireshark, and see there that the FTP server responds with 4 application data records, immediately followed by 1 other application data record. I am not sure, but what I understand from TLS 1.3 is that the first 4 records are used for the session negotiation. I debugged the code for checking stale data and what I see is that the unread data corresponds with the 5th application data record as I see it in Wireshark.
When I configure
_ftpClient.StaleDataCheck = false, the connection is successfull and further data transfer (list folders, etc.) is OK. So it looks like the data is required and I assume it will, after the session activation, be consumed by sslstream (sChannel). So, my question: is the check for ‘Stale Data’ correct in FluentFTP when using TLS 1.3? The reason why I ask is because I saw this code in ConnectModule.cs:I am using .NET6
Here is my application Configuration
The exexption will come up in
\Streams\FtpSocketStream.csin line 1128:m_sslStream.AuthenticateAsClientAsync(targethost, clientCerts, sslProtocols, Client.ValidateCertificateRevocation).Wait();Win32Exception: Die angeforderte Funktion wird nicht unterstützt.Die angeforderte Funktion wird nicht unterstützt.And they come from
DirectCast(ex, FluentFTP.FtpInvalidCertificateException).InnerException.InnerException.MessageI have a similar problem with the FTPS server on my Synology NAS after I updated the NAS to DSM 7.0. I don’t know which FTP deamon is being used there, but it supports TLS1.3 and TLS1.2. Same error in the log when I let FluentFTP negotiate TLS:
Status: There is stale data on the socket, maybe our connection timed out or you did not call GetReply(). Re-connecting...Important: FluentFTP is then not reacting correctly because it seems to invoke connect() itself in a loop. There is no way to get out of this loop except by counting the attempts in the callback for the host key and then not accepting the key.
I can get rid of the error (and connect successfully) by setting the following:
_ftpClient.StaleDataCheck = false;That works but doesn’t give me a comfortable feeling. I also don’t know whether the connection is now TLS1.3. I can’t see anything in FluentFTP that informs me about the negotiated protocol. But maybe I overlooked something.I can also get rid of the error by forcing TLS1.2, but that is not what people want to do.
I can only again stress the importance of having full TLS1.3 support in FluentFTP. Is it still true that this is something that is not correct in .NET? That seems so strange. Can someone point me to where it is stated that there is an issue in .NET?
I am using FluentFTP 39.2.1.
Sorry - i cann´t give you a reply now. Our customers FTP-Server is down till Tuesday. On Wednesday i can try again. Then I will send you the result
Thanks for your work. Here is the log of your new BETA1-Version
_ AutoConnect()
AutoDetect(True, False)
Connect() Status: Connecting to x.x.x.x:21 Response: 220 NASFTPD Turbo station 1.3.6 Server (ProFTPD) [::ffff:10.1.10.6] Status: Detected FTP server: ProFTPD Command: AUTH TLS Response: 234 AUTH TLS successful Status: There is stale data on the socket, maybe our connection timed out or you did not call GetReply(). Re-connecting… Status: Disposing FtpSocketStream… Status: Not sending QUIT because the connection has already been closed. Status: Disposing FtpSocketStream…
Connect() Status: Connecting to x.x.x.x:990 Status: Disposing FtpSocketStream…_