icetee / node-ftp

An FTP client module for node.js
MIT License
25 stars 16 forks source link

FTPS - Implicit over TLS #7

Closed MilanThomas closed 6 years ago

MilanThomas commented 6 years ago

Hey, I'm trying to connect to a FTP using implicit over TLS and this is my config :

"ftp": {
    ...,
    "port": 990,
    "secure": "implicit",
    "secureOptions": {
        "rejectUnauthorized": false
    }
}

@icetee I've seen you answer over at the original repo about the error : "Unable to make data connection( Error: connect ECONNREFUSED 127.0.0.1:40099)" and I tried your solution :

"ftp": {
    ...,
    "port": 21,
    "secure": true,
    "secureOptions": {
        "rejectUnauthorized": false
    }
}

It does not work because the FTP I'm trying to connect to does not support FTPES. The connection is working until I start transfering data. I can get the greetings and ready events to work but as soon as I try to list or get I receive this error.

Is there any way to make this work or to diagnose where the issue is coming from so that we can try to find a solution ?

Thanks

icetee commented 6 years ago

Do you hate to test on the development branch? https://github.com/icetee/node-ftp/blob/develop/test/payload/index.js

Firewall ok? I try Proftpd my server, and works.

{
    "host": "****",
    "port": 21,
    "user": "****",
    "password": "****",
    "secure": true,
    "secureOptions": {
        "rejectUnauthorized": false
    },
    "forcePasv": true,
    "connTimeout": 10000,
    "pasvTimeout": 10000,
    "keepalive": 10000
}
MilanThomas commented 6 years ago

Thanks for your quick answer.

I can't make it to work even when using the develop branch. I get timed out or an error like "Data connections must be encrypted". When I use another FTP, everything works fine, it's just this one that causes troubles...

It looks like the implicit mode is really tricky to work with. And since the FTP I'm working with does not allow connections on port 21, I'm stuck.

MilanThomas commented 6 years ago

Actually, I just saw @simy307 PR, tried it locally and it solves my problem. I can now connect and interact with an implicit FTPS using this config :

"ftps": {
    "host": "***",
    "port": 990,
    "user": "***",
    "password": "***",
    "secure": "implicit_secure",
    "secureOptions": {
        "rejectUnauthorized": false
    }
}