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
Server Terminates Connection #1977
Comments
Forgot to mention the exception is "\phpseclib3\Exception\ConnectionClosedException" with the message "No data from server" |
First, I apologize for the delayed response - I was vacationing in Norway and Iceland (I live in Texas so those countries are a good ways away) for two weeks and just got back. Anyway,
Correct. It's been doing that since 95d189c because of #1454. As noted in the comments for that commit, that change makes phpseclib's behavior in-line with how PuTTY works. Case in point: here's a PuTTY log transcript from a login I just did: https://pastebin.com/MwVLXkZA Here's the most relevant snippet from the full log:
Now, in your case the server is responding by saying that it supports both password and publickey auth. I suppose one possibility is that it's trying to do 2FA in a specific order. Like maybe you need to login with a publickey first and then a password later. Or maybe the server is lying and it doesn't really support password auth even tho it says it does. The AWS logs might yield more insight. Also, maybe try connecting with PuTTY, since PuTTY is logging in in the exact same way it seems likely that PuTTY would fail too. I mean, sure, in your case, your server only supports password auth whereas in my example, it supports both publickey and password auth, but still. I'd try it myself on AWS Transfer Family but it's kinda a PITA. AWS Transfer Family isn't free and as such, to minimize my costs, when I've done it in the past, I've created it, from scratch, and then deleted it afterwards. Keeping it up 24/7 so that I'm not having to constantly reconfigure it every time someone has an issue with it would cost me, if memory serves, like $6 / day or about $200 / month, and given I'm not selling phpseclib, paying $200 / month is quite repulsive to me. Maybe you could give me SFTP access? If so you could email the info to terrafrost@php.net. edit: https://aws.amazon.com/blogs/opensource/aws-promotional-credits-open-source-projects/ might be an option for me but it sounds like a bit of a PITA. Like I gather the credit is only valid for a year? Travis CI used to be free for FOSS projects but then they started issuing credits that needed to be periodically renewed and it was a sufficient PITA that I just spent a few days migrating to GitHub Actions rather then deal with it. AWS Promotional Credits look to be similar. |
Hi @terrafrost , Thanks so much for the reply. Unfortunately I can't give access to the SFTP because it's a third-party source that I don't control. I was trying to troubleshoot with them and they don't see anything relevant in their logs. I am however able to connect to this SFTP directly from the command line. One possible thing we came up with is the behavior seems similar to what would happen if you just try to SSH into the server. It doesn't support a command shell so the connection is immediately terminated. Is phpseclib trying to open a terminal or similar when it logs in? Another weird thing is the code seems to work if I run the PHP from the command line instead of it being triggered from a browser. |
Does https://github.com/terrafrost/phpseclib/pull/new/3.0-stream-set-timeout still fix the issue for you? I changed up your approach a little bit: |
Yes, it works good. Thanks for your help. Are you going to make a new release for this change, or a way I can get it through composer? |
First, I need to figure out why this change is causing the unit tests on Ubuntu to fail: https://github.com/terrafrost/phpseclib/actions/runs/7808725371/job/21299406562 I had no issues on Windows. If I can't reproduce the issue on a local instance of Ubuntu then I'll have to debug it on GitHub Actions, which is prob going to take many hours. Second, if I can figure that out, I'm willing to add it to the 2.0 / 3.0 / master branches BUT I am less then enthusiastic on making a new release so soon because:
|
The issue on GitHub Actions has been fixed and the code change is in the 2.0 / 3.0 and master branches: Like I said, tho, I wanna sit on it for a while before releasing a new version. Thanks! |
Hi,
I'm having trouble logging into an SFTP server. It worked fine before, then the SFTP server domain changed and now I'm now longer able to connect. I'm assuming they also upgraded the SFTP server somehow with the domain change and that is causing the issue, but I'm not able to see the receiving end. I can connect manually to the SFTP through a shell. It is just username/password authentication. Here is the log file:
Almost seems like it doesn't try the password on the first auth attempt, then the server doesn't respond to the second auth attempt.
Any help is greatly appreciated.
The text was updated successfully, but these errors were encountered: