pod.epiccastle.bbssh.host-key-repository

Creates and calls the various methods of a HostKeyRepository that exists on the pod heap.

add

(add host-key-repository host-key user-info)

Add the referenced host-key into the repository. If the key requires user interaction use the passed in user-info to do so.

check

(check host-key-repository host key)

Checks the repository for the presence of the passed in public key under the specified hostname. Returns :ok if the key is present and matches, :not-included if no matching key is found and :changed if there is a conflicting key of that type stored against the hostname.

get-host-key

(get-host-key host-key-repository)(get-host-key host-key-repository host type)

Get a vector of host-key references from the repository. If passed a host and type then only return keys matching these. Otherwise return all the keys.

get-known-hosts-repository-id

(get-known-hosts-repository-id host-key-repository)

Returns and identification string for this repository.

new

(new callbacks)

Create a new host-key-repository. Pass in a hashmap containing callbacks to be used for the methods of the repository. The hashmap keys are optional. If a value is not specified a default is used. The keys are as follows:

:check (fn [^String host ^bytes public-key] ...)

Check the repository for the presence of the passed in public key under the specified hostname. Hosts should be able to have multiple keys of different key types. Thus you should examine the key type and check that hosts keys for the same type. Your function should return :ok if the key is present and matches, :not-included if no matching key is found and :changed if there is a conflicting key of that type stored against the hostname.

:add (fn [^Keyword host-key ^Keyword user-info] ...)

Add the referenced host-key into the repository. If the key requires user interaction use the passed in user-info to do so.

:remove (fn
          ([^String host ^String type] ..)
          ([^String host ^String type ^bytes public-key] ..)

Remove the referenced public-key of type being stored for host. If public-key is not passed, remove all keys of type for host. type will be one of SSH public key prefix strings "ssh-rsa", "ssh-dss", "ecdsa-sha2-nistp256" or "ssh-ed25519". Other key types may be added with later releases.

:get-known-hosts-repository-id (fn [] ...)

Return a string to refer to the known hosts repository.

:get-host-key (fn
                ([] ...)
                ([^String host ^String type]))

When called with a host and type, return a vector of host-key references. When called with no args, return a vector of all host-key references.

remove

(remove host-key-repository host type)(remove host-key-repository host type public-key)

Remove the referenced public-key of type being stored for host. If public-key is not passed, remove all keys of type for host. type should be a SSH public key prefix string. public-key should be a byte-array of raw data.