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

SSH public key authentication broken in commander 2.4.0 on CentOS 8.4.2105 #176

Open
3 tasks done
stdevel opened this issue Oct 6, 2021 · 1 comment
Open
3 tasks done

Comments

@stdevel
Copy link

stdevel commented Oct 6, 2021

Prerequisites

  • Can you reproduce the problem?
  • Are you running the latest version?
  • Did you perform a cursory search?

Description

When using SSH public key authentication, commander crashes:

# commander test test.yml --verbose
Starting test file test.yml...

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x79ea53]

goroutine 23 [running]:
golang.org/x/crypto/ssh.publicKeyCallback.auth(0xc00030a960, 0xc000024240, 0x20, 0x20, 0x0, 0x0, 0xa80aa0, 0xc00034c000, 0xa76980, 0xc0000721b0, ...)
	/home/travis/gopath/pkg/mod/golang.org/x/[email protected]/ssh/client_auth.go:204 +0xd3
golang.org/x/crypto/ssh.(*connection).clientAuthenticate(0xc000340080, 0xc00033e000, 0x0, 0xa)
	/home/travis/gopath/pkg/mod/golang.org/x/[email protected]/ssh/client_auth.go:44 +0x332
golang.org/x/crypto/ssh.(*connection).clientHandshake(0xc000340080, 0xc0002c8d58, 0x8, 0xc00033e000, 0x0, 0x0)
	/home/travis/gopath/pkg/mod/golang.org/x/[email protected]/ssh/client.go:113 +0x2b6
golang.org/x/crypto/ssh.NewClientConn(0xa865a0, 0xc00000e010, 0xc0002c8d58, 0x8, 0xc000140968, 0xa865a0, 0xc00000e010, 0x0, 0x0, 0xc00030a980, ...)
	/home/travis/gopath/pkg/mod/golang.org/x/[email protected]/ssh/client.go:83 +0xf8
golang.org/x/crypto/ssh.Dial(0x9b9aeb, 0x3, 0xc0002c8d58, 0x8, 0xc000140968, 0xc00030a980, 0x1, 0x2)
	/home/travis/gopath/pkg/mod/golang.org/x/[email protected]/ssh/client.go:177 +0xb3
github.com/commander-cli/commander/pkg/runtime.SSHExecutor.Execute(0xc0002c8d58, 0x8, 0x0, 0x0, 0x0, 0x0, 0xc000308620, 0x15, 0xc0002c8db0, 0xf, ...)
	/home/travis/gopath/src/github.com/commander-cli/commander/pkg/runtime/ssh_executor.go:76 +0x1d0
github.com/commander-cli/commander/pkg/runtime.(*Runner).Run.func2(0xc0002c8f40, 0xc00030a8c0, 0xc00006eae0, 0xc00006ea80)
	/home/travis/gopath/src/github.com/commander-cli/commander/pkg/runtime/runner.go:49 +0x231
created by github.com/commander-cli/commander/pkg/runtime.(*Runner).Run
	/home/travis/gopath/src/github.com/commander-cli/commander/pkg/runtime/runner.go:30 +0x113

Using plain username/password authentication works.

Steps to Reproduce

  1. Create a YML document as seen below
  2. Run commander test test.yml
  3. Watch the beautiful stacktrace :)
nodes:
  node1:
    type: ssh
    addr: node1:22
    identity-file: /root/.ssh/id_rsa.pub
    #user: root
    #pass: trustno1

config:
  nodes:
    - node1

tests:
  check kurt user:
    command: id kurt
    stdout:
      contains:
        - kurt
      not-contains:
        - no such user
    exit-code: 0

Expected behavior: [What you expected to happen]

SSH login succeeds and test is executed.

Actual behavior: [What actually happened]

Application crashes.

Specifications

  • Version: v2.4.0
  • Platform: CentOS Linux 8.4.2105 (x86_64)
  • Subsystem: ?

You can get the version information from executing commander --version.

@SimonBaeumer
Copy link
Member

Thanks @stdevel for the submission.
Looked into it and was able to reproduce it.
It will be fixed in #181

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants