ArxOne / FTP

Simple FTP client
MIT License
37 stars 15 forks source link

FTPS with TLS not working #39

Closed kris-g closed 7 years ago

kris-g commented 7 years ago

Hi, I have a server which I can connect to from FileZilla using "Require explicit FTP over TLS" mode only. The following code fails...

var ftpClient = new FtpClient(FtpProtocol.FtpES, ftpHost, 21, new NetworkCredential(ftpUser, ftpPassword), new FtpClientParameters { SslProtocols = System.Security.Authentication.SslProtocols.Tls }); var list = ftpClient.ListEntries("/");

Is there anything more with needs to be done to make the client work around certificates or something?

The error is...

IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

picrap commented 7 years ago

I'm no FileZilla expert, so my first question would be: are you sure you're not confusing FTPES with FTPS? Also, we have a problem with some servers, and in some case the SSL negociation just fails, and until here we could not find why (see issue #32).

kris-g commented 7 years ago

I don't even know the difference between FTPES/FTPS, I thought they both mean SSL/TLS connection, versus SFTP which is an SSH based FTP connection.

Luckily your link led me to the solution to my problem, I noticed the extra available SslProtocols in that post and it turns out Tls12 works with my server.

Thanks. :)

picrap commented 7 years ago

FTPES is an explicit SSL, which means that the connection starts on a clear command channel, and then, after a specific command, switches to SSL. FTPS requires the channel to be open using SSL from the beginning. Anyway, good to know you solved your problem :)

kris-g commented 7 years ago

Thanks for the explanation and the quick responses.