ssh_client_key_api v0.2.1 SSHClientKeyAPI View Source
Simple wrapper for the Erlang :ssh_client_key_api behavior, to
make it easier to specify SSH keys and known_hosts files independently of
any particular user’s home directory
It is meant to primarily be used via the convenience function with_options:
key = File.open!("path/to/keyfile")
known_hosts = File.open!("path/to/known_hosts")
cb = SSHClientKeyAPI.with_options(identity: key, known_hosts: known_hosts, silently_accept_hosts: true)
The result can be passed as an option when creating an SSHKit.SSH.Connection:
SSHKit.SSH.connect("example.com", key_cb: cb)
identity:IO.deviceproviding the ssh key (required)known_hosts:IO.deviceproviding the known hosts list. If providing a File IO, it should have been opened in:writemode (required)silently_accept_hosts:booleansilently accept and add new hosts to the known hosts. By default only known hosts will be accepted.
Link to this section Summary
Functions
Callback implementation for c::ssh_client_key_api.add_host_key/3
Callback implementation for c::ssh_client_key_api.is_host_key/4
Callback implementation for c::ssh_client_key_api.user_key/2
returns a tuple suitable for passing the SSHKit.SSH.Connect as the key_cb option
Link to this section Functions
Callback implementation for c::ssh_client_key_api.add_host_key/3.
Callback implementation for c::ssh_client_key_api.is_host_key/4.
Callback implementation for c::ssh_client_key_api.user_key/2.
with_options(opts :: list) :: {atom, list}
returns a tuple suitable for passing the SSHKit.SSH.Connect as the key_cb option.
### Options
identity:IO.deviceproviding the ssh key (required)known_hosts:IO.deviceproviding the known hosts list. If providing a File IO, it should have been opened in:writemode (required)silently_accept_hosts:booleansilently accept and add new hosts to the known hosts. By default only known hosts will be accepted.passphrase:binarypassphrase if your key is protected (optional)by default it will use the the files found in
System.user_home!### Example
key = File.open!("path/to/keyfile")
known_hosts = File.open!("path/to/known_hosts")
cb = SSHClientKeyAPI.with_options(identity: key, known_hosts: known_hosts)
SSHKit.SSH.connect("example.com", key_cb: cb)