Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PASV TLS TimeoutError - connectionHandler never called #192

Closed
danielmahon opened this issue Jan 22, 2020 · 6 comments
Closed

PASV TLS TimeoutError - connectionHandler never called #192

danielmahon opened this issue Jan 22, 2020 · 6 comments
Labels
bug A defect or bug that affects the original indended use of the application

Comments

@danielmahon
Copy link

danielmahon commented Jan 22, 2020

When using TLS and PASV, the LIST command fails and times out on waitForConnection. It seems as though the connectionHandler for tls.createServer() is never called. Non-TLS works fine and connectionHandler for net.createServer() is called. Not sure why but this prevents me from connecting to ftp-srv with TLS. Thoughts?

https://github.com/trs/ftp-srv/blob/0b9167e1e44f41306925879a234f3d914a8b13f7/src/connector/passive.js#L63

https://github.com/trs/ftp-srv/blob/0b9167e1e44f41306925879a234f3d914a8b13f7/src/connector/passive.js#L38

Error:

{"name":"xxxxx","hostname":"xxxxxxxxxx","pid":28,"id":"12ae7069-7fb9-4d58-a503-02ab22e04e37","directive":"LIST","level":50,"err":{"message":"operation timed out","name":"TimeoutError","stack":"TimeoutError: operation timed out\n    at afterTimeout (/usr/src/app/node_modules/bluebird/js/release/timers.js:46:19)\n    at Timeout.timeoutTimeout [as _onTimeout] (/usr/src/app/node_modules/bluebird/js/release/timers.js:76:13)\n    at listOnTimeout (internal/timers.js:531:17)\n    at processTimers (internal/timers.js:475:7)"},"msg":"operation timed out","time":"2020-01-22T16:43:01.417Z","v":0}
@trs trs added the bug A defect or bug that affects the original indended use of the application label Jul 20, 2020
@mbartisan
Copy link

@danielmahon I was having this same issue on non-TLS while using the cli approach. It seams that the [url] cli argument isn't being passed to the PASV config.

I was able to bypass the issue by instantiating FtpSrv through code rather than the cli. Also ensuring that the root directory is a valid path (if on windows, using a forward slash (/) as a path separator has generally worked better too). For PASV I've found you can't use 0.0.0.0 either, and you need to specify a routable address (i.e. external ip).

@trs
Copy link
Contributor

trs commented Aug 10, 2020

Passive connections cannot be made without specifying the pasv_url. This is the hostname that a client will use to connect to when attempting a passive connection.

It looks like the docs were incorrect in saying that pasv_url defaults to url. It does not in-fact have a default.

@trs
Copy link
Contributor

trs commented Aug 10, 2020

With the CLI you can specify the passive hostname using --pasv_url <hostname>

@trs
Copy link
Contributor

trs commented Aug 10, 2020

@danielmahon Are you using implicit (ftps://) or explicit (ftp://) TLS connections?

@matt-forster
Copy link
Contributor

Closed because this seems stale, and it was most likely a docs issue.

@ldm314
Copy link

ldm314 commented Dec 17, 2020

This appears to be the same issue that my comment on #96 refers to. For me LIST is working but RETR and STOR never have this connection. Using Explicit TLS. My comment from the other issue:

I'm seeing this issue on STOR and RETR with the latest code and passive mode. Strangely enough LIST is working fine. If I copy the logic from the registered commands of LIST into RETR, without TLS on I get a text file with the directory listing as expected and with TLS I see the timeout.

List has PASV before it, makes a new listening connection, has TLS succeed, and sends the directory list across. STOR and RETR have waitForConnection time out in passive.js. With TLS off, no issue. I've tried various node versions: 8,x, 12.x, 15.x with the same result. Wireshark show the client making a connection successfully but TLS negotiation doesn't happen, and eventually waitForConnection times out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A defect or bug that affects the original indended use of the application
Projects
None yet
Development

No branches or pull requests

5 participants