class

SSH2::KnownHosts

Inherits Enumerable / Reference / Object

Manages a session's collection of known hosts, mirroring an OpenSSH known_hosts file: add and check host keys, and read/write the file.

Constructors

new(session : Session)
Source

Instance methods

add(host, salt, key, comment, typemask : LibSSH2::TypeMask)

Add host with its key and typemask to the collection. salt is used for hashed hostnames (empty for a plain name). Returns the stored entry.

Source
check(host, port, key, typemask : LibSSH2::TypeMask)

Check host/port and key against the collection. Returns a LibSSH2::KnownHostCheck (MATCH, MISMATCH, NOTFOUND or FAILURE).

Source
delete_if

Delete every known host for which the block returns a truthy value.

Source
each

Yield each known host as a Host.

Source
finalize
Source
read_file(filename)

Populate the collection from an OpenSSH known_hosts file at filename.

Source
read_line(line)

Add a single host from one OpenSSH known_hosts line.

Source
to_unsafe
Source
write_file(filename)

Write the collection to an OpenSSH known_hosts file at filename.

Source

Nested types