Implicit FTPS with Alpakka FTP

44 Views Asked by At

I use Alpakka FTP 3.0.3 that uses internally Apache Commons Net 3.8. I want to upload a file with FTPS inluding implicit SSL. For FTPS without implicit SSL I use the following code:

FtpCredentials ftpCredentials = FtpCredentials.create(user, password)
FtpsSettings.create(inetAddress)
  .withPort(port)
  .withPassiveMode(true)
  .withBinary(true)
  .withCredentials(ftpCredentials)
  .withConfigureConnectionConsumer((FTPSClient ftpsClient) -> {
    ...
  }))

But there is no option to set implicit ssl. Please note, there is the option to modify the FTPSClient but the flag isImplicit inside FTPSClient is final.

For direct usage of Apache Commons Net I could use

new FTPSClient(true)

But in Alpakka the object is already created internally. On the command line with lftp I can use ftp:ssl-force true.

Therefore, I tried that inside withConfigureConnectionConsumer()

ftpsClient.sendCommand("ftp:ssl-force", "true");

But that has no effect. I failed with the initial connect timeout.

IO operation was stopped unexpectedly after 0 bytes because of java.io.IOException: Timed out waiting for initial connect reply

0

There are 0 best solutions below