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

problem when using several ssh keys via hop #37

Open
rrepen opened this issue Aug 14, 2013 · 0 comments
Open

problem when using several ssh keys via hop #37

rrepen opened this issue Aug 14, 2013 · 0 comments

Comments

@rrepen
Copy link

rrepen commented Aug 14, 2013

In the following example I am just running a simple command on hostB via hostA.
The SSH keys are already in place and this works fine from the bash prompt, but when I use Rye and setup the gw and the box without the password it fails and Rye asks for the pasword.

This is due to the fact that the ssh keys from localhost to hostA is different from the ssh key hostA to hostB. In the last example I copy over the ssh key hostA->hostB back to localhost in the private_key and add this key to the key list and then it works fine.

Is there some configuration I miss in Rye to do that?

I think Rye should be able to manage that and avoid the user to copy over the ssh key. In case of several hop this could be a real nigthmare.


user1:~> ssh hostA ssh hostB "uname -a"
Linux hostB 2.6.32.45-0.3.2_1 #1 SMP Wed Feb 8 05:03:48 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

irb(main):001:0> require 'rye'
=> true
irb(main):002:0> gw=Rye::Hop.new("hostA")
=> #<Rye::Hop:hostA name=hostA cwd= umask= env="" via="" opts={:port=>nil, :keys=>["/home/user1/.ssh/id_dsa"]} keys=["/home/user1/.ssh/id_dsa"]>
irb(main):003:0> box=Rye::Box.new("hostB",:via=>gw)
=> #<Rye::Box:hostB name=hostB cwd= umask= env="" safe=true opts={:port=>nil, :keys=>["/home/user1/.ssh/id_dsa"], :paranoid=>true} keys=["/home/user1/.ssh/id_dsa"]>
irb(main):004:0> r=box.send("uname","-a")
Password:
...

user1:> mkdir private_keys
user1:
> scp hostA:.ssh/id_dsa* ./private_keys

irb(main):001:0> require 'rye'
=> true
irb(main):002:0> gw=Rye::Hop.new("hostA")
=> #<Rye::Hop:hostA name=hostA cwd= umask= env="" via="" opts={:port=>nil, :keys=>["/home/user1/.ssh/id_dsa"]} keys=["/home/user1/.ssh/id_dsa"]>
irb(main):003:0> box=Rye::Box.new("hostB",:via=>gw)
=> #<Rye::Box:hostB name=hostB cwd= umask= env="" safe=true opts={:port=>nil, :keys=>["/home/user1/.ssh/id_dsa"], :paranoid=>true} keys=["/home/user1/.ssh/id_dsa"]>
irb(main):004:0> box.add_key("./private_keys/id_dsa")
=> #<Rye::Box:hostB name=hostB cwd= umask= env="" safe=true opts={:port=>nil, :keys=>["/home/user1/.ssh/id_dsa", "./private_keys/id_dsa"], :paranoid=>true} keys=["/home/user1/.ssh/id_dsa"]>
irb(main):009:0> r=box.send("uname","-a")
=> [Linux hostB 2.6.32.45-0.3.2_1 #1 SMP Wed Feb 8 05:03:48 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux, , 0, ]
irb(main):010:0>

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

1 participant