kubernetes-ftp icon indicating copy to clipboard operation
kubernetes-ftp copied to clipboard

Data port(s)?

Open jnazander opened this issue 6 years ago • 3 comments

Does this example actually work? I've just tried this myself on minikube, and whenever I connect with an FTP client to my node's IP address on port 30080, it connects and starts the session successfully, but the "Reading remote directory" command times out.

I assume this is because the FTP protocol requires opening a connection on a second port (the data port). In your example config, it's chosen by vsftpd randomly from the 21100-21110 range. But your NodePort service only forwards the command port (21), not the data port, so there is no way this example could work.

Even if you would configure vsftpd to use a static data port and NodePort to forward it, there's also the problem of NodePort forwarding each new TCP connection to a different pod, so your data connection may arrive at a different pod than your control connection, and will be promptly rejected. In fact, FTP starts a new TCP connection on the data port for every file transferred!

This example doesn't resolve ANY of the above issues.

jnazander avatar Jan 02 '19 12:01 jnazander

Without passive mode the connection will be used by the 21 port.

loic-lopez avatar Mar 20 '19 14:03 loic-lopez

And how to enable passive mode ? Because when I using comand line always OK. But when I use FileZilla I have problem Cannot get directory listing I can not view the directory '/'.

Inv0k-er avatar Oct 18 '19 07:10 Inv0k-er

Mode is a setting of client apps https://support.tigertech.net/filezilla-passive

MariaPaypoint avatar Nov 13 '23 16:11 MariaPaypoint

I "think" that in reality, this won't work often as FTP clients usually are behind a firewall which shouldn't allow dynamically opened ports being accessible from the internet. So PASV mode seems to be the only reliable option if FTP needs to be offered to large parties with unknown network setups. And that is not covered with this solution.

mcs avatar Oct 24 '24 10:10 mcs