node-ftp icon indicating copy to clipboard operation
node-ftp copied to clipboard

FTPS on tls, using port 990

Open mybeez opened this issue 8 years ago • 7 comments

Hello,

I'm trying to connect using the implicit secure option with port 990. Here my configuration:

_connectionProperties.secure = true;

 _connectionProperties.secureOptions = {

    'rejectUnauthorized': false

 };

I've tried with with option 'implicit' but it don't works. Nothing happens. Is-it possible to use implicit over TLS with node-ftp ?

Thanks !

mybeez avatar Jun 28 '16 15:06 mybeez

Were you able to get an answer to this or figure it out? I am having a similar issue.

tinydogio-joshua avatar Aug 22 '16 18:08 tinydogio-joshua

True - same issues here. I also haven't found any docs on the secureOptions object we can set - or is there docs that I haven't found yet?

aredfox avatar Jan 31 '17 07:01 aredfox

Ok, sorry found docs: https://nodejs.org/api/tls.html#tls_tls_connect_options_callback

aredfox avatar Jan 31 '17 08:01 aredfox

EDIT: Still an issue in master, fixed in next comment

Anyone find a solution? If I use secure:true, it will finish the onconnect function, do nothing for a few minutes, emit end, and then emit close(had_err = false). It will never emit ready. Function reentry which emits ready is never run. If I use secure: implicit, then I get a timeout while connecting to server.

Gander7 avatar May 09 '17 17:05 Gander7

I used the connection.js file from kellym's fork (as suggested on reedit here) and it was able to emit a ready state with an error.

Gander7 avatar May 09 '17 18:05 Gander7

My issue was port 990 and using secure: implicit (implicit FTP over TLS). You can change it and use FTPES(explicit FTP over TLS) without reconfiguration of your ftp server. The trick is to use port 21 for FTPES with secure: true and options below. secure: true cannot work with port 990 at this point in time. secure: implicit with port 990 does not work and even kellym's fork throws a protection level error for me.

Working Code:

var Client = require('ftp')
var fs = require('fs')

var c = new Client();
let file = fs.createReadStream(path + filename)
c.on('ready', () => {
  c.put(path + filename,
        '/destination/' + filename, (err) => {
          if (err) throw err;
          c.end()
        })
  })
})

c.connect({
  host: '999.999.999.999',
  user: 'user',
  port: 21,
  password: 'pass',
  secure: true,
  secureOptions: { rejectUnauthorized: false }
});

Gander7 avatar May 10 '17 11:05 Gander7

Nice Gander7 it works for me, thanks.

diegodubon avatar Sep 22 '17 18:09 diegodubon