node-ftp
node-ftp copied to clipboard
FTPS on tls, using port 990
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 !
Were you able to get an answer to this or figure it out? I am having a similar issue.
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?
Ok, sorry found docs: https://nodejs.org/api/tls.html#tls_tls_connect_options_callback
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.
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.
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 }
});
Nice Gander7 it works for me, thanks.