Skip to content

Commit bd22a33

Browse files
committed
Advertise the optimized known host lookup in the README
1 parent 25510e4 commit bd22a33

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
@@ -507,6 +507,19 @@ pooling behaviour entirely by setting the idle_timeout to zero:
507507
SSHKit::Backend::Netssh.pool.idle_timeout = 0 # disabled
508508
```
509509

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

512525
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)