Law & Order: File Transfer Protocol Divsion, dum dum!
Oh FTP. It's the protocol that just keeps giving. Today's story involves ports and firewall and routers. I was adding TLS support to paradise:
https://github.com/andrewarrow/paradise_ftp/commit/a376f5bb5784507fdd14462591eb229a5e000a03
Did you know that firewalls speak FTP? They can actually listen to the ftp commands going back and forth, read them, and do stuff based on the commands. For example, if the FTP server says I'm about to listen on port 50001, the firewall reads that and opens port 50001 just in the nick of time. Get it? Port 50001 is closed 99.999% of the time but for the 20 ms when it needs to be open right before an FTP client is going to connect to it, it opens it.
So, I didn't know this. I thought port 50001 was already open because everytime I tried to connect to it, it worked. Silly me. Â So when I added TLS support to FTP guess who could no longer read the encrypted message to open that port? Yup. It went something like this:
"OPEN PORT (|||50001|)" <--- oooo, I can read that and know what to do says firewall "KEJRHHEF&F^^E^EFGHEG@" <--- oooo, I have no idea what that encrypted text says
So, hours, HOURS spent debuging why I could not connect to that port THROUGH NORMAL TCP NOT EVEN TLS because once I sent the AUTH ftp command and turned on TLS, the next commands were now encrypted.
Okay but I also mentioned routers. I have a "ubee" wifi cable modem at home. It has a box checked for "FTP" that means you know, don't allow passive connections to work.Â
So this made this even more complicated I was doing this work 50% at home thru ubee and 50% remotely on a laptop with an LTE iphone connection that does NOT have that ubee ftp box thing. So even when I removed TLS support completey from the app I still saw that exact same behavior of not being able to connect to port 50001 for a totally different reason, but only sometimes.
I have since unchecked that box.













