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
x/crypto/ssh: Session.Run() returns error EOF #16194
Comments
There is a debugMux variable that you could set which will print what goes over the wire. That might explain in more detail what is going on. WIthout further info, I'd assume the remote device is picky about how the command is formatted, and closes the connection on any problem. |
@hanwen Thank you for answering. I do know that whenever I exit, the server returns status code -1. Could that be causing the problem?
|
Our library is waiting for the exit-status or exit-signal message, which isn't coming. According to RFC 4254, those are optional, so we should probably do something intelligent in case the remote end doesn't send a status message. |
I'm happy you found the possible solution, do you know how long it will take before this gets fixed? |
I'd need to set aside some time, which I am short of. I may be able to get to it next week. If you like challenges, you could try to setup a server inside the unittests that mimicks this failure mode. That would make it easier to see how to fix it. (I think we should return a special error that signals that the exit code wasn't returned). |
You can actually download the real OS and run it in VMWare/KVM. |
I mean: we'll need a unittest written in Go that demonstrates the problematic behavior before we attempt a fix. The debug log is enough information to write such a test. |
I have made a CL that handles lack of exit-status more specifically, see https://go-review.googlesource.com/#/c/24727/1 However, this isn't the real problem (turns out we had a test for this all along.) The real problem is here: 2016/06/28 19:44:50 decoding(1): 97 &ssh.channelCloseMsg{PeersId:0x1} - 5 bytes after receiving the channel close message, we send a close message too. At this point, channel ID 0x01 is unused. However, the remote side then sends windowAdjustMsg erroneously, to a non-existent channel 0x01, which I would expect to trigger this error path https://github.com/golang/crypto/blob/master/ssh/mux.go#L243 I don't understand why you see EOF though. If you could insert some debug prints and see which error path triggers it, that would be helpful. |
I'm not sure how to debug this? How do I find the function that returns this error? |
see https://play.golang.org/p/GBpKnBRL2N you'd change all error returns to use withLN. |
Your solution didn't work, but I used grep to find any line containing EOF in the library and found where the EOF error gets returned. It's in channel.go at line 591. |
oh. your device's SSH is screwed up. 2016/06/28 19:44:50 send(1): ssh.channelRequestMsg{PeersId:0x11c0b511, Request:"exec", WantReply:true, RequestSpecificData:[]uint8{0x0, 0x0, 0x0, 0xb, 0x73, 0x68, 0x6f, 0x77, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65}} it's asking for a reply to the "exec" message, which never comes. I think your best bet is to reimplement 'exec' support from session.go for this device, but changing WantReply to false. |
Hi,
I'm trying to run commands on a router through SSH. The program works fine if I run it against an OpenSSH server, but against the router with its own proprietary implementation of ssh, Session.Run() returns the error EOF. I'm running Go 1.6.2 and tried executing this program on Linux amd64, Windows amd64, Windows i386. Is this a bug and is there a work around?
The program returns the following:
Unable to run command: EOF.
The text was updated successfully, but these errors were encountered: