Skip to content

Repository files navigation

SSHClientKeyAPI

Module VersionHex DocsTotal DownloadLicenseLast Updated

Simple Elixir implementation 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.

By itself, :ssh_client_key_api does not provide SSH functionality, it only adds a way to send private key information to an SSH connection. It is meant to be used alongside an SSH library such as :ssh, SSHex, SSHKit, or the like.

Note: Upgrade to ssh_client_key_api 0.3.0 or higher for use with Erlang/OTP 25

Supported Key Types

  • rsa - with or without passphrase
  • ed25519 - only supported without a passphrase
  • ecdsa - only supported without a passphrase
  • dsa - with or without passphrase (but DSA keys are not recommended)
    • OpenSSH 7.0 and higher no longer accept DSA keys by default
    • Note tested on OTP 25+, but still expected to work

Installation

The package can be installed by adding :ssh_client_key_api to your list of dependencies in mix.exs:

defdepsdo[{:ssh_client_key_api,"~> 0.2.0"}]end

Using SSHClientKeyAPI

SSHClientKeyAPI is meant to primarily be used via the convenience function with_options/1. See with_options/1 for full list of available options.

key=File.open!("path/to/id_rsa")# Other key types supported as wellknown_hosts=File.open!("path/to/known_hosts",[:read,:write])cb=SSHClientKeyAPI.with_options(identity: key,known_hosts: known_hosts,silently_accept_hosts: true)

The result can then be passed as an option when creating an SSH connection.

Using SSHKit.SSH.connect/2:

connection=SSHKit.SSH.connect("example.com",key_cb: cb)

Or through SSHKit.context/2:

context=SSHKit.context("example.com",key_cb: cb)

License

Copyright (c) 2017 Lab Zero Innovations Inc.

This library is MIT licensed. See the LICENSE for details.

About

An Elixir implementation of the Erlang `ssh_client_key_api` behavior.

Resources

Stars

16 stars

Watchers

6 watching

Forks

Releases

Packages

Contributors

Languages