Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
84 lines (53 sloc) 2.95 KB

Module trooper_keys

Trooper keys implements the ssh_client_key_api behaviour to give a solution to handle the keys without files and ensuring all of the connections are validated instead of create a known hosts file.

Behaviours: ssh_client_key_api.

Description

Using the connection options is in charge to ensure the user is using a certificate passed in those options and even the password to access to that key.

We can configure this in diferent ways:

       % config for inline certificate (without password)
       {id_rsa, <<"-----BEGIN RSA PRIVATE KEY-----\nMIIE..."},
       % or from a file
       {id_rsa, {file, "id_rsa"}},
       % and adding a password:
       {rsa_pass_phrase, <<"mypass">>},

You can do that with rsa, dsa and ecdsa algorithms. Keep in mind the ecdsa algorithm uses the dsa_pass_phrase configuration for the password.

Function Index

add_host_key/3adds a trusted host key.
is_host_key/4Is a trusted host key? The answer is always no (false) to force to the system to use add_host_key/3.
user_key/2fetch the user public key.

Function Details

add_host_key/3


add_host_key(HostNames::string(), Key::ssh_client_key_api:public_key(), ConnectOptions::[proplists:property()]) -> ok

adds a trusted host key. In this implementation the addition is not done because all of the hosts are intented to be accepted.

is_host_key/4


is_host_key(Key::ssh_client_key_api:public_key(), Host::string(), Algorithm::ssh_client_key_api:public_key_algorithm(), ConnectOptions::[proplists:property()]) -> true

Is a trusted host key? The answer is always no (false) to force to the system to use add_host_key/3.

user_key/2


user_key(Algorithm::ssh_client_key_api:public_key_algorithm(), ConnectOptions::[proplists:property()]) -> {ok, ssh_client_key_api:private_key()}

fetch the user public key. It's retrieved from the options.

You can’t perform that action at this time.