Add ftpes scheme support (as equivalent of current ftps implementation) #1509
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
There's a bit of confusion regarding FTP over TLS implementation in django-storages, and I'd like to propose a way to fix it here.
Context
So, there are 2 different ways of adding TLS to the FTP protocol (wikipedia ref) :
This is similar to what is done for HTTPS ; the client connects to a different port (990 by default), establishes a TLS connection, then establishes a normal FTP session inside the TLS tunnel.
This is what the
ftps
URL scheme represents.This way of implementing TLS in FTP was never really standardized, and is nowadays considered deprecated
This method of implementation was specified in RFC 4217, and is the preferred method for securing FTP.
Here, the client initiates a plaintext FTP connexion to the normal port (21), and issues a command to upgrade the connection to TLS. Well-behaved clients would do this before sending anything else (especially sending the password), and secure servers would refuse any command before upgrading the connection.
As this method is part of the FTP protocol, and on the same port as plaintext FTP, no URL scheme is standardized.
It's however common for FTP clients and servers to accept the non-standard
ftpes
scheme to convey the idea that despite the connection being originally established in plaintext, upgrading to a secure connection is mandatory.Problem
Django-storages implements the second method, and yet uses the
ftps
scheme associated with the first one for enabling this behavior.This is confusing.
Proposed solution
ftpes
scheme, with the same behavior as already existing (done in this PR)ftps
scheme (I can add it in this PR if it's fine with you)ftps
scheme at the next major version updateI'm of course open to discussion regarding the points 2 and 3, as one could argue that it's not worth making a breaking change, warning just might be enough ?
Also, documenting this is probably a good idea as well.