View Source trooper_keys (trooper v0.5.0)

Trooper keys implements the ssh_client_key_api behavior 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.

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 different 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 and ecdsa algorithms.

Summary

Functions

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

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

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

Types

algorithm_phrases/0

-type algorithm_phrases() :: rsa_pass_phrase | ecdsa_pass_phrase.

algorithms/0

-type algorithms() :: id_rsa | id_ecdsa.

reason/0

-type reason() :: atom() | string().

Functions

add_host_key(HostNames, Key, ConnectOptions)

-spec add_host_key(string(), public_key:public_key(), [proplists:property()]) -> ok.

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

is_host_key(Key, Host, Algorithm, ConnectOptions)

-spec is_host_key(public_key:public_key(), Host :: string(), ssh:pubkey_alg(), [proplists:property()]) ->
                     false.

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

user_key(Algorithm, ConnectOptions)

-spec user_key(ssh:pubkey_alg(), proplists:proplist()) ->
                  {ok, public_key:private_key()} | {error, term()}.

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