Skip to content

An Elixir implementation of the Erlang `ssh_client_key_api` behavior.

License

Notifications You must be signed in to change notification settings

labzero/ssh_client_key_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SSHClientKeyAPI

Module Version Hex Docs Total Download License Last 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.

Installation

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

def deps do
  [
    {: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/keyfile.pem")
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 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

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 6