Skip to content

Commit 9714a2b

Browse files
committed
Advertise the optimized known host lookup in the README
1 parent 5539060 commit 9714a2b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,19 @@ pooling behaviour entirely by setting the idle_timeout to zero:
508508
SSHKit::Backend::Netssh.pool.idle_timeout = 0 # disabled
509509
```
510510

511+
## Known hosts caching
512+
513+
If you connect to many hosts with the `Netssh` backend, looking up `~/.ssh/known_hosts` can significantly impact performances.
514+
You can mitigate this by using SSHKit's lookup caching like this:
515+
516+
```ruby
517+
SSHKit::Backend::Netssh.configure do |ssh|
518+
ssh.ssh_options = {
519+
known_hosts: SSHKit::Backend::Netssh::KnownHosts.new,
520+
}
521+
end
522+
```
523+
511524
## Tunneling and other related SSH themes
512525

513526
In order to do special gymnasitcs with SSH, tunneling, aliasing, complex options, etc with SSHKit it is possible to use [the underlying Net::SSH API](https://github.com/capistrano/sshkit/blob/master/EXAMPLES.md#setting-global-ssh-options) however in many cases it is preferred to use the system SSH configuration file at [`~/.ssh/config`](http://man.cx/ssh_config). This allows you to have personal configuration tied to your machine that does not have to be committed with the repository. If this is not suitable (everyone on the team needs a proxy command, or some special aliasing) a file in the same format can be placed in the project directory at `~/yourproject/.ssh/config`, this will be merged with the system settings in `~/.ssh/config`, and with any configuration specified in [`SSHKit::Backend::Netssh.config.ssh_options`](https://github.com/capistrano/sshkit/blob/master/lib/sshkit/backends/netssh.rb#L133).

0 commit comments

Comments
 (0)