class
SSH2::KnownHosts
- SSH2::KnownHosts
- Reference
- Object
Overview
Manages a session's collection of known hosts, mirroring an OpenSSH
known_hosts file: add and check host keys, and read/write the file.
Included Modules
- Enumerable(SSH2::KnownHosts::Host)
Defined in:
known_hosts.crConstructors
Instance Method Summary
-
#add(host, salt, key, comment, typemask : LibSSH2::TypeMask)
Add
hostwith itskeyandtypemaskto the collection. -
#check(host, port, key, typemask : LibSSH2::TypeMask)
Check
host/portandkeyagainst the collection. -
#delete_if(&)
Delete every known host for which the block returns a truthy value.
-
#each(&)
Yield each known host as a
Host. - #finalize
-
#read_file(filename)
Populate the collection from an OpenSSH
known_hostsfile atfilename. -
#read_line(line)
Add a single host from one OpenSSH
known_hostsline. - #to_unsafe : Pointer(Void)
-
#write_file(filename)
Write the collection to an OpenSSH
known_hostsfile atfilename.
Constructor Detail
Instance Method Detail
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.
Check host/port and key against the collection. Returns a
LibSSH2::KnownHostCheck (MATCH, MISMATCH, NOTFOUND or FAILURE).