-
Notifications
You must be signed in to change notification settings - Fork 134
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
Authentication failiure using ssh-agent #26
Comments
can you try to check first with: |
That returns true. I think I have found the problem though, the upstream package I have linked the example code I tried in the comment I lelft in that issue. @melbahja Do you know any way to work around this? I can't change the server configuration |
I'm unable to reproduce the bug? I think you can use the IP instead of |
The issue will only happen on new SSH servers with RSA SHA-2 host key.
What server version are you trying this with?
|
Updated underlying |
Hey, I'm unable to reproduce the bug on my device. maybe this relevant to your issue: |
Hey @melbahja, Upgraded to
Resulting an error:
In Any thoughts? |
Hey, is the agent working with the |
Yep, it's working as expected. I can able to |
I tried on my end and it works, is there anyway for me to reproduce it ? |
I really don't know what the problem is. I think something is wrong with this function: ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers), Error is throwing from here: ssh.Dial(proto, net.JoinHostPort(c.Addr, fmt.Sprint(c.Port)), &ssh.ClientConfig{
User: c.User,
Auth: c.Auth,
Timeout: c.Timeout,
HostKeyCallback: c.Callback,
BannerCallback: c.BannerCallback,
}) My
What other information should I provide here? What I'm missing? 🤔 |
Maybe could be: golang/go#54027 or golang/go#39885? Both
Minimal reproducible code snippet adopted from: https://cs.opensource.google/go/x/crypto/+/master:ssh/agent/example_test.go;drc=ac88ee75c92c889b97e05591e9a39b6480c538b3 // Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"log"
"net"
"os"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/agent"
)
func main() {
// ssh-agent(1) provides a UNIX socket at $SSH_AUTH_SOCK.
socket := os.Getenv("SSH_AUTH_SOCK")
conn, err := net.Dial("unix", socket)
if err != nil {
log.Fatalf("Failed to open SSH_AUTH_SOCK: %v", err)
}
agentClient := agent.NewClient(conn)
config := &ssh.ClientConfig{
User: "USER",
Auth: []ssh.AuthMethod{
// Use a callback rather than PublicKeys so we only consult the
// agent once the remote server wants it.
ssh.PublicKeysCallback(agentClient.Signers),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}
sshc, err := ssh.Dial("tcp", "IP:22", config)
if err != nil {
log.Fatal(err)
}
// Use sshc...
sshc.Close()
} Resulting with error:
EDIT: I think this is not related with Dropped a comment here: golang/go#54027 (comment) |
OK. Finally found the issue after bunch of debugging, and filed an enhancement proposal. PTAL when possible: #57 |
I'm trying to connect to server using code from the examples, but the authentication fails without further information:
As you can see the agent authenticates without problems when using plain ssh. Is there any way to figure out why this is failing?
The text was updated successfully, but these errors were encountered: