-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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: improve error message on missing AuthMethod #33210
Comments
I don't understand the request. You're specifying nil as input and you get a nil-pointer error; this seems like it's working as indended? |
If using But in this case the thing is even that it's not always leading to a panic. Only when connecting to an SSH server that doesn't have As I mentioned in my initial comment: Why not return an error with a message like "The server sent this list of allowed auth methods: public key, keyboard interactive. But you didn't pass any"? |
I think it is OK for panic to occur if you are using the library outside of spec. See e.g. https://play.golang.org/p/h93s6C-N5gy |
But there's the difference I mentioned: But this lead me to try out something I didn't try yet: Instead of using This "discovery" makes me think this might be fine. |
if the remote end doesn't need authentication, there is no need to inspect the auth methods at all. |
shall we close this bug then? |
The issue can be closed because with But I still have the feeling that you don't understand my point and even if an unset |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Above mentioned version is currently the latest release.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
ssh.ClientConfig
withnil
asssh.AuthMethod
ssh.Dial()
to an SSH server that requires either public key or keyboard interactive authenticationSee https://play.golang.org/p/GYyQK6uhS3Q
What did you expect to see?
I expected
ssh.Dial()
to return an error with a useful message, like "The server sent this list of allowed auth methods: public key, keyboard interactive. But you didn't pass any".Passing
nil
here isn't a problem by itself. It works fine when connecting to an SSH server that usesnone
as auth method. See https://play.golang.org/p/Gpro3QgsyFJ.What did you see instead?
Workaround
Workaround for others who come across this issue: If you don't know which auth methods are supported by the SSH server you're trying to connect to, use the verbose flag:
ssh -v your.server.com
. The output then contains for example these lines:I'm sure there's also a way to do this programmatically in Go, but I didn't check yet.
The text was updated successfully, but these errors were encountered: