sshex v2.2.0 SSHEx.ConfigurableClientKeys

Provides public key behavior for SSH clients.

valid options:

  • key: IO.device providing the ssh key (required)
  • known_hosts: IO.device providing the known hosts list (required)
  • accept_hosts: boolean silently accept and add new hosts to the known hosts. By default only known hosts will be accepted. SSHEx.connect( ip: to_charlist(hostname), user: to_charlist(username), key_cb: {SSHEx.ConfigurableClientKeys, [ key: <IO.device>, known_hosts: <IO.device> ]} ) A convenience method is provided that can take filenames instead of IO devices

cb_module = SSHEx.ConfigurableClientKeys.get_cb_module(key_file: "path/to/keyfile", known_hosts_file: "path_to_known_hostsFile", accept_hosts: false) SSHEx.connect( ip: to_charlist(hostname), user: to_charlist(username), key_cb: cb_module )

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

Functions

add_host_key(hostname, key, opts)
add_host_key(hostname :: charlist, key :: :public_key.public_key, opts :: list) ::
  :ok |
  {:error, term}

Callback implementation for c::ssh_client_key_api.add_host_key/3.

get_cb_module(opts)
get_cb_module(opts :: list) :: {atom, list}
is_host_key(key, hostname, alg, opts)
is_host_key(key :: :public_key.public_key, hostname :: charlist, alg :: :ssh_client_key_api.algorithm, opts :: list) :: boolean

Callback implementation for c::ssh_client_key_api.is_host_key/4.

user_key(alg, opts)
user_key(alg :: :ssh_client_key_api.algorithm, opts :: list) ::
  {:error, term} |
  {:ok, :public_key.private_key}

Callback implementation for c::ssh_client_key_api.user_key/2.