Is there any way to connect to a FTP over TLS ?
So I could get a little bit further thanks to this issue https://github.com/mgrenier/remote-ftp/issues/7
my .ftpconfig file:
{
"protocol": "ftp",
"host": "server_example.com",
"port": 21,
"user": "username",
"pass": "password",
"remote": "/",
"secure": true,
"secureOptions": null,
"connTimeout": 10000,
"pasvTimeout": 10000,
"keepalive": 10000
}
but I get Remote FTP: Error: self signed certificate
Hello,
I have the same problem : my connection is refused because "Remote FTP: Error: self signed certificate".
It seems we need to add a secureOptions : i've found a page describing these options (https://nodejs.org/api/tls.html#tls_tls_connect_options_callback, found via https://discuss.atom.io/t/remote-ftp-ftps-package/10821/5)
An option catch my attention :
"rejectUnauthorized: If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails; err.code contains the OpenSSL error code. Default: true."
So I tried to edit my .ftpconfig file with :
"secureOptions": "rejectUnauthorized:false",
but it doesn't change anything, I still got the same error "Remote FTP: Error: self signed certificate".
I found on issue #7 the following :
"secureOptions": null, // object - Additional options to be passed to tls.connect(). Default: (null) see http://nodejs.org/api/tls.html#tls_tls_connect_options_callback
other options in the config file are of type string, or integer, we have here a type object.
How can I pass a "object" type with this json config file ?
I'm almost sure that I need to set rejectUnauthorized to false in tls.connect()... but I don't know how to do it :(
Now it works !
I used this configuration for FTPS (explicit TLS, self-signed certificate) :
{
"protocol": "ftp",
"host": "domain.com",
"port": 21,
"user": "myUser",
"pass": mySecretPassword",
"remote": "/",
"secure": true,
"secureOptions": {"rejectUnauthorized":false},
"connTimeout": 10000,
"pasvTimeout": 10000,
"keepalive": 10000
}
{"rejectUnauthorized":false}
this needs to be on the Wiki / readme! it helped me!
Most helpful comment
Now it works !
I used this configuration for FTPS (explicit TLS, self-signed certificate) :
{
"protocol": "ftp",
"host": "domain.com",
"port": 21,
"user": "myUser",
"pass": mySecretPassword",
"remote": "/",
"secure": true,
"secureOptions": {"rejectUnauthorized":false},
"connTimeout": 10000,
"pasvTimeout": 10000,
"keepalive": 10000
}