Details
-
Feature
-
Status: Released (View Workflow)
-
Minor
-
Resolution: Fixed
-
2.0.0
-
None
Description
Current Situation
- FTPS uses two separate connections:
- Control connection - used for establishing the connection, authentication, and exchanging FTP commands and server responses.
- Client -> Server
- ftp_server:21 (example default control-port)
- TLS session A
- It is encrypted using TLS after AUTH TLS.
- Client -> Server
- Data connection - used for transferring directory listings and file data.
- Client -> Server
- ftp_server:<passive-port>
- TLS session B
- TLS encryption is enabled by sending PROT P on the control connection.
- Client -> Server
- Both connections are encrypted with TLS, but without session reuse they establish separate TLS sessions.
- This means the data connection is not cryptographically tied to the already authenticated control connection and could therefore be treated as an independent connection by the server.
- Control connection - used for establishing the connection, authentication, and exchanging FTP commands and server responses.
- Some FTPS servers require the TLS session established on the control connection to be reused for the data connection.
- This ensures that the data connection is associated with the authenticated control connection.
- If the session cannot be resumed, the server rejects the data connection, for example with:
425 Unable to build data connection: TLS session of data connection not resumed
Desired Behaviour
- Reuse the TLS session established on the control connection for the data connection.
- The TCP connection must still use the passive port, while the TLS connection uses the control connection's hostname and port for session identification:
- Control connection
- Client -> Server
- ftp_server:21
- TLS session A
- Client -> Server
- Data connection
- Client -> Server
- ftp_server:<passive-port> TCP connection
- TLS session A reused TLS session
- The TLS session established on the control connection is reused for the data connection.
- No separate TLS session is created for the data connection, while the TCP connection still uses the server-assigned passive port.
- Client -> Server
- Control connection
Maintainer Note
- TLS session reuse is implemented, but interoperability cannot be guaranteed for every server implementation.
- The behavior depends on the interaction between Java's JSSE implementation and the server's TLS handshake, session management, and session-reuse validation.
- The negotiated TLS parameters and the way both sides handle session resumption determine whether the FTPS data connection can successfully reuse the control connection's TLS session.
- TLS 1.2 and TLS 1.3 use different session-resumption mechanisms, which can contribute to compatibility issues.
- However, the problem is not limited to TLS 1.3:
- Session reuse may also fail with TLS 1.2, depending on the Java implementation, the negotiated parameters, and the server's behavior.
- Some servers work with both TLS 1.2 and TLS 1.3, while others require a fallback to TLS 1.2.
- In certain cases, an additional JVM option may be required (TLS 1.2):
- -Djdk.tls.client.enableSessionTicketExtension=false
- This option changes the client's TLS session-ticket behavior and can resolve compatibility issues with TLS 1.2 session reuse.
- It does not disable session reuse itself.
- -Djdk.tls.client.enableSessionTicketExtension=false
- Conclusion:
- FTPS TLS session reuse is supported, but successful interoperability depends on both client and server behavior.
- Depending on the environment, a TLS 1.2 fallback (YADE's default protocol) or an additional JVM option may be necessary.
Test Instructions
- Test explicit and implicit FTPS using the default Docker FTPS containers that do not require TLS session reuse.
- Test against an FTPS server that requires TLS session reuse, e.g. FileZilla Server (e.g.: 1.12.x).
- Expected result:
- All tests succeed in all configurations:
- Explicit FTPS
- Implicit FTPS
- FTPS servers without TLS session reuse requirements
- FTPS servers requiring TLS session reuse
- All tests succeed in all configurations: