blade icon indicating copy to clipboard operation
blade copied to clipboard

How to specify ssh key to use when connecting to a host?

Open vendion opened this issue 8 years ago • 1 comments

I was playing around with bladerunner and I think I ran into an issue related with having multiple ssh keys in my ~/.ssh directory.

hostname.blade.toml

[Required]
  Commands = [
    "hostname"
  ]
  Hosts = ["165.227.192.60"]

In my .ssh/config file I have the following

Host 165.227.192.60
    Hostname 165.227.192.60
    Port 22
    User root
    IdentityFile /home/vendion/.ssh/some_ssh_key

Trying to run my hostname command results in a panic

bladerunner run ceph-test hostname --verbose
2017/09/14 19:22:31 Starting recipe: ceph-test.hostname
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x6118d2]

goroutine 6 [running]:
github.com/deckarep/blade/vendor/golang.org/x/crypto/ssh.(*connection).clientAuthenticate(0xc4200c2300, 0xc4200c8180, 0x0, 0xa)
	/home/vendion/gocode/src/github.com/deckarep/blade/vendor/golang.org/x/crypto/ssh/client_auth.go:54 +0x312
github.com/deckarep/blade/vendor/golang.org/x/crypto/ssh.(*connection).clientHandshake(0xc4200c2300, 0xc4200187c0, 0x11, 0xc4200c8180, 0x0, 0x0)
	/home/vendion/gocode/src/github.com/deckarep/blade/vendor/golang.org/x/crypto/ssh/client.go:112 +0x2d9
github.com/deckarep/blade/vendor/golang.org/x/crypto/ssh.NewClientConn(0x86fce0, 0xc42000e0d0, 0xc4200187c0, 0x11, 0xc4200c8000, 0x86fce0, 0xc42000e0d0, 0x0, 0x0, 0xc420030528, ...)
	/home/vendion/gocode/src/github.com/deckarep/blade/vendor/golang.org/x/crypto/ssh/client.go:82 +0xfd
github.com/deckarep/blade/vendor/golang.org/x/crypto/ssh.Dial(0x6fe513, 0x3, 0xc4200187c0, 0x11, 0xc4200c8000, 0xa587ebce15ee000, 0x59bb0f37, 0xc420030580)
	/home/vendion/gocode/src/github.com/deckarep/blade/vendor/golang.org/x/crypto/ssh/client.go:176 +0xb3
github.com/deckarep/blade/lib/ssh.startSSHSession(0xc4200c8000, 0xc4200187c0, 0x11, 0xc420044920, 0x1, 0x1, 0x0, 0x0)
	/home/vendion/gocode/src/github.com/deckarep/blade/lib/ssh/session.go:129 +0xe0
github.com/deckarep/blade/lib/ssh.executeSession.func1(0xc42000d300, 0xc42000d300)
	/home/vendion/gocode/src/github.com/deckarep/blade/lib/ssh/session.go:112 +0x57
github.com/deckarep/blade/vendor/github.com/cenkalti/backoff.RetryNotify(0xc42005e840, 0x86c180, 0xc42000d300, 0x70f990, 0x0, 0x663d19)
	/home/vendion/gocode/src/github.com/deckarep/blade/vendor/github.com/cenkalti/backoff/retry.go:37 +0x88
github.com/deckarep/blade/lib/ssh.executeSession(0xc4200c8000, 0xc4200187c0, 0x11, 0xc420044920, 0x1, 0x1)
	/home/vendion/gocode/src/github.com/deckarep/blade/lib/ssh/session.go:111 +0x132
github.com/deckarep/blade/lib/ssh.consumeAndLimitConcurrency.func1(0xc4200c8000, 0xc420044920, 0x1, 0x1, 0xc4200187c0, 0x11)
	/home/vendion/gocode/src/github.com/deckarep/blade/lib/ssh/utils.go:75 +0x7d
created by github.com/deckarep/blade/lib/ssh.consumeAndLimitConcurrency
	/home/vendion/gocode/src/github.com/deckarep/blade/lib/ssh/utils.go:70 +0xe3

vendion avatar Sep 14 '17 23:09 vendion

@vendion - sorry for the way, way late response...but yes this is something that needs to be addressed and I haven't had a chance for the past 5-6 months to address it.

Good news is I'm actively working through a solution but I don't have any ETA on when it will be ready unfortunately. I would consider this tool very early stages alpha and barely usable at this point.

Thanks!

deckarep avatar Feb 08 '18 05:02 deckarep