bentonstark / starksoft-aspen

.net / mono security and cryptography library that provides client support for ftps, gnupg, smartcard, and socks / http proxies
108 stars 49 forks source link

FTPS incompatible with recent FileZilla Servers for Passive over IPv4 #28

Closed Sappharad closed 7 years ago

Sappharad commented 7 years ago

Hello,

While testing this library against a bunch of FTP servers, I discovered that it seems to be unusable with the most recent version of FileZilla server in IPv4 mode. I initially thought this was because I was testing on my local machine and it was using IPv6 because it was local, but then tested a remote FTP over a network that doesn't even support IPv6 and I wasn't able to connect.

After doing further research, I realized that when you call FEAT on the FileZilla server, it doesn't even return PASV as a supported command, only EPSV. What I did to fix this was a small change in the method that determines which Passive method to use. If you're using the library in IPv4 mode, but the server you're connected to says it supports EPSV and doesn't say it supports PASV, use EPSV instead. This completely fixes the problem for all of the FileZilla servers that I tested against.

I've created a fork with the changes I'll be using.

The changes are in this commit: https://github.com/Sappharad/starksoft-aspen/commit/15e2b4be4e4f92b9aa3fad566765d71d08200602

Would you like a pull request for it, or are you not happy with this solution and would rather see it done a different way?

Thanks, Paul

bentonstark commented 7 years ago

Paul, again thanks for the work! I will incorporate it into the next release. FileZilla is also my test server as well so I will upgrade to the latest and get the changes in.

Benton

bentonstark commented 7 years ago

Added additional logic for EPSV with IPv4 connections if the server supports it. https://github.com/bentonstark/starksoft-aspen/commit/d220aa05f487c8e57d87d9c12ea94361b411f67a#diff-720d5d7753be67b3598f24a892cfd73aL2486