Guichaguri / MinimalFTP

A lightweight, simple FTP server. Pure Java, no dependencies.
Apache License 2.0
160 stars 45 forks source link

Disabling PASV command & features #16

Closed stashymane closed 8 months ago

stashymane commented 11 months ago

I am currently trying to run a custom FTP implementation via Docker, and I am not able to expose all ports for PASV to work properly. Specifying a port range would more or less resolve this issue, however just disabling PASV would be a great solution as well.

Currently, I re-register the PASV command on each connection to return 502 not implemented as a workaround, however this still trips up many FTP clients and gets the connection stuck.

An alternative solution would be to allow us to unregister commands & features on the fly.

Guichaguri commented 8 months ago

The PASV command allocates a port from the ephemeral port range. You can expose the whole range if you want to keep the passive connections functionality.

I think an option to disable passive connections should be available from the FTPServer class, but unregistering commands and features is also a functionality nice to have 😄

Guichaguri commented 8 months ago

Added an server-wide option to disable the passive mode: e87869c7f4d205cda903e021204e766df9d3ccb5