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

x/crypto/ssh: panic: handshake failed: ssh: host key mismatch #21166

Closed
dgrr opened this issue Jul 25, 2017 · 3 comments
Closed

x/crypto/ssh: panic: handshake failed: ssh: host key mismatch #21166

dgrr opened this issue Jul 25, 2017 · 3 comments
Milestone

Comments

@dgrr
Copy link

@dgrr dgrr commented Jul 25, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8.3 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mester/.go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build052168145=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

I'm trying to connect to my server using ssh client created in Golang.
Here is the code: https://play.golang.org/p/0y6hzwg7Lz

What did you expect to see?

The terminal of my server

What did you see instead?

I see a panic lol

@ianlancetaylor ianlancetaylor changed the title panic: ssh: handshake failed: ssh: host key mismatch x/crypto/ssh: panic: handshake failed: ssh: host key mismatch Jul 25, 2017
@gopherbot gopherbot added this to the Unreleased milestone Jul 25, 2017
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jul 25, 2017

Please show us the complete panic output.

@dgrr
Copy link
Author

@dgrr dgrr commented Jul 25, 2017

Solved. I create another function with the callback:
func check(hostname string, remote net.Addr, key ssh.PublicKey) error {
return nil
}

func HostKeyCallback(key ssh.PublicKey) ssh.HostKeyCallback {
return check
}

And it works.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jul 25, 2017

Closing.

@golang golang locked and limited conversation to collaborators Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.