How to connect to a implicit FTPS server with nodeJS?

2.3k views Asked by At

For a project I have to connect to a FTPS server over a implicit connection. I tried with node-ftp, because it seems that this is the only library, that supports the implicit connection.

I connect using the following code:

var ftpC = new FTPClient();
  ftpC.on('ready', function () {
    console.log('Connection successful!');
  });

  ftpC.on('error', function (err) {
    console.log(err);
  });

  console.log('Try to connect to FTP Server...');
  ftpC.connect({
    host: HOST_TO_CONNECT,
    port: 990,
    secure: 'implicit',
    user: '***',
    password: '***',
    secureOptions: {
      rejectUnauthorized: false
      // secureProtocol: 'SSLv23_method',
      // ciphers: 'ECDHE-RSA-AES128-GCM-SHA256'
    }
  })

This code gives me everytime a timeout error. If I raise the timeout, the error comes later. I tried in secureOptions to add the params rejectUnauthorized, secureProtocol and ciphers, as you can see. None of them is working. Everytime I get this timeout error.

In FileZilla I have no problem to connect. Everything is working fine.

Do someone have a solution for this behavior? Or is there another plugin for nodejs to connect to a implicit FTPS server?

1

There are 1 answers

0
Kelly On

This appears to be a bug in node-ftp. I've created a PR for it and will update this as soon as it's been fixed.