Uploaded image for project: 'YADE - Managed File Transfer'
  1. YADE - Managed File Transfer
  2. YADE-667

FTPS - Reuse TLS session for data connections

    XMLWordPrintable

Details

    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.
        • 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.
        • 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.
      • 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
        • 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.

      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.
      • 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

      Attachments

        Activity

          People

            re Robert Ehrlich
            re Robert Ehrlich
            Rajdeep Singh Thakur Rajdeep Singh Thakur
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: