mscdex / node-ftp

An FTP client module for node.js
MIT License
1.13k stars 243 forks source link

Implicit FTPS over TLS: Remote FTP: Error: Unable to make data connection #198

Open pmiddlet72 opened 7 years ago

pmiddlet72 commented 7 years ago

Similar to another issues on implicit FTPS over TLS: #153

Connection seems successful, but that's as far as I get (connection under similar conditions works in filezilla). I'm finding the following error after a successful connection:

(Remote FTP: Error: Unable to make data connection. Error: connect ECONNREFUSED 127.0.0.1:50392)

Here's the initial log of events from the console upon connection:

< 200 OK
helpers.js:96 < 220 Welcome to the xxxxFTP Server.
helpers.js:96 > USER sauser
helpers.js:96 < 331 Password required for sanuser
helpers.js:96 > PASS ******
helpers.js:96 < 230 Logged on
helpers.js:96 > FEAT
helpers.js:96 < 211-Features:\r\n MDTM\r\n REST STREAM\r\n SIZE\r\n MLST type*;size*;modify*;\r\n MLSD\r\n AUTH SSL\r\n AUTH TLS\r\n PROT\r\n PBSZ\r\n UTF8\r\n CLNT\r\n MFMT\r\n EPSV\r\n EPRT\r\n211 End
helpers.js:96 > OPTS UTF8 ON
helpers.js:96 < 202 UTF8 mode is always enabled. No need to send this command.
helpers.js:96 > TYPE I
helpers.js:96 < 200 Type set to I
helpers.js:96 > EPSV
helpers.js:96 < 229 Entering Extended Passive Mode (|||50986|)
helpers.js:96 > EPSV
helpers.js:96 < 229 Entering Extended Passive Mode (|||50854|)
helpers.js:96 > ABOR
helpers.js:96 < 226 ABOR command successful

I get the additional notification of the data connection error, which doesn't show up in the console (why not?)

In bizarre fashion, if I do nothing, the following will occur:

< 200 OK
helpers.js:96 < 421 No-transfer-time exceeded. Closing control connection.
helpers.js:96 < 220 Welcome to the American Statistical Association FTP Server.
helpers.js:96 > USER sanantonioch
helpers.js:96 < 331 Password required for sanantonioch
helpers.js:96 > PASS ******
helpers.js:96 < 230 Logged on
helpers.js:96 > FEAT
helpers.js:96 < 211-Features:\r\n MDTM\r\n REST STREAM\r\n SIZE\r\n MLST type*;size*;modify*;\r\n MLSD\r\n AUTH SSL\r\n AUTH TLS\r\n PROT\r\n PBSZ\r\n UTF8\r\n CLNT\r\n MFMT\r\n EPSV\r\n EPRT\r\n211 End
helpers.js:96 > OPTS UTF8 ON
helpers.js:96 < 202 UTF8 mode is always enabled. No need to send this command.
helpers.js:96 > TYPE I
helpers.js:96 < 200 Type set to I
helpers.js:96 > EPSV
helpers.js:96 < 229 Entering Extended Passive Mode (|||50942|)
helpers.js:96 > EPSV
helpers.js:96 < 229 Entering Extended Passive Mode (|||50196|)
helpers.js:96 > ABOR
helpers.js:96 < 226 ABOR command successful

Of course ends in Error: Unable to make data connection. Error: connect ECONNREFUSED 127.0.0.1:50392 again.

Overall, It's as if there's a connection, but a connection refusal error occurs when attempting to view the remote root folder. I can't tell if the problem is on the connection side or further remote requests issued to the server.

It doesn't seem the connection is being closed until it completely times out. I'm afraid if I decreased any of the connection or keepalive parameters in .ftpconfig (below), that it would try to reconnect ad nauseum until I killed Atom (or the american stat association site killed me 😏 ).

Here's my .ftpconfig:

{
    "protocol": "ftp",
    "host": "ftp.exampleftp.org",
    "port": 990,
    "user": "sauser",
    "pass": "sapass",
    "promptForPass": false,
    "remote": "/",
    "local": "",
    "secure": "implicit",
    "secureOptions": {"rejectUnauthorized":false},
    "connTimeout": 10000,
    "pasvTimeout": 10000,
    "keepalive": 10000,
    "watch": [],
    "watchTimeout": 500
}

Why are 2 EPSV events followed by ABOR being issued. Something I need to check in node-ftp ?

icetee commented 7 years ago

Remote-FTP check valid features list. For multiple servers, it was a bad thing to have returned the feature list and included it. But he did not endorse it. That's why it checks. That is why the PASV is 2x.

Try 21 port? https://github.com/mscdex/node-ftp/issues/153#issuecomment-300454955

f1ss1on commented 5 years ago

I have been over each one of the posts and this still seems to be an open bug. Any fixes for this?

tonyh-fff commented 2 years ago

Is there any fixes for this?