sshkit icon indicating copy to clipboard operation
sshkit copied to clipboard

Support project-local SSH options.

Open leehambley opened this issue 13 years ago • 5 comments

This can probably be done with the :config option for Net::SSH.start.

From their documentation:

:config => set to true to load the default OpenSSH config files (~/.ssh/config, /etc/ssh_config), or to false to not load them, or to a file-name (or array of file-names) to load those specific configuration files. Defaults to true.

That sounds like we should override that to always be Net::SSH::Config.default_files + [__dir_+"/config/ssh"]. (Or something.)

leehambley avatar Jun 13 '13 18:06 leehambley

/cc @seenmyfate might be that we get support for this into Cap accidentally in the next week or so

leehambley avatar Jun 13 '13 18:06 leehambley

It looks like a non-issue, because I was able to use project-local option by means of passing ssh_config option into capistrano server dsl method, like

server 'staging-box', ssh_options: { config: 'config/ssh_config' }

This worked, too:

SSHKit::Backend::Netssh.config.ssh_options = { config: 'config/ssh_config' }

Looks like you guys have fixed this a while ago.

0rca avatar Aug 13 '13 22:08 0rca

Actually @0rca the use case was to be able to do something like:

$ mkdir 
$ vagrant ssh-info one > ./.ssh/config
$ vagrant ssh-info two >> ./.ssh/config
$ vagrant ssh-info three >> ./.ssh/config

(vagrant info dumps ports, usernames, and other mappings for accessing vagrant over the ssh tunnel)

This means you could do:

on $w{one two three} do
 execute "uptime"
end

And they'd be connected, and called over the localhost:222X tunnel using all the vagrant ssh information (which definitely doesn't belong in the main system configuration!)

leehambley avatar Aug 13 '13 22:08 leehambley

yeah, I have just added vagrant config to config/ssh_config (which is project-local), so it looked like this:

...

Host development-local
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile "/Users/orca/.vagrant.d/insecure_private_key"
  IdentitiesOnly yes
  LogLevel FATAL

and your uptime snippet worked

0rca avatar Aug 13 '13 22:08 0rca

It's a super easy fix with Net::SSH to prepend Dir.pwd to the ssh config search path, so I think I'll leave this open, because I like the idea of checking in a local ssh config, just like checking in the Vagrant file, they should work together.

leehambley avatar Aug 13 '13 23:08 leehambley