delano / rye

Safe, parallel access to Unix shells from Ruby
http://delano.github.com/rye
MIT License
234 stars 32 forks source link

Rye should respect ssh_config_options better #68

Open rickhull opened 8 years ago

rickhull commented 8 years ago

My use case for rye is to automate things that I'm doing "manually" via SSH. I have an extensive SSH config (~/.ssh/config) that specifies which keys and users to use for which hosts. I am finding that Rye::Box is not respecting my ssh config. Rye::Box is unaware of the various keys in ~/.ssh and it (obviously) doesn't try to use them when connecting to hosts that specify those keys in ~/.ssh/config.

I did some source diving, and it looks like the only ssh config option that is respected is :port, and to some extent :user. I say "to some extent" because I found in some cases that the user from ~/.ssh/config was not being used, though I see in the source that it should be, via @rye_user. I haven't gotten to the bottom of this yet.

I also use ssh-agent extensively to hold my decrypted private keys in memory. I'm not sure if Rye will use this, and looking at Rye.sshagent_info and @@agent_env -- do these do anything? I see that @@agent_env is initialized to an empty hash -- and then never updated again anywhere.

I really like this project, and I'm eager to use it, but I'm having trouble understanding some of these design decisions. I'd be happy to collaborate and discuss more extensively.

rickhull commented 8 years ago

I figured out the issue with username. Rye::Box works as expected, but Rye::Set does not:

https://gist.github.com/rickhull/9c9c056f040afd11329d

delano commented 8 years ago

Hi Rick, thanks for reporting these. I haven't had much time lately to spend on Rye. I'm happy to pull in a patch that pass all tests but unfortunately can't be much in debugging.

rickhull commented 8 years ago

Honestly, I probably won't tease this apart either. But it seems clear to me that the Set does not reliably approximate a "set" of boxes. The abstraction leaks.