Skip to content

bifroest key import host

Validates and merges normal known_hosts entries from a file, stdin, or an SSH server. Incoming @revoked, @cert-authority, and certificate entries are rejected. A fingerprint mismatch leaves the destination unchanged.

Syntax

--address can contact an SSH server to obtain a host key. The imported trust file is local to the CLI machine.

Arguments

None.

Flags

Includes all general flags.

--knownHostsFile

OpenSSH known_hosts file to update.

--input

File containing entries to import. - or omission reads from stdin. This cannot be combined with address. Input is limited to 4 MiB.

--address

string

SSH server from which one negotiated host key is retrieved. Port 22 can be omitted.

--expectedFingerprint

string

Expected OpenSSH SHA256 fingerprint, or unknown. It is required with address; omission for file or stdin input implies unknown.

Warning

--expectedFingerprint unknown with --address explicitly trusts a key obtained from an unverified network peer and can expose the connection to an on-path attack. The command also emits a warning to stderr.

Output

A local known_hosts file containing the successfully imported entries. Invalid entries and fingerprint mismatches leave the destination unchanged.

Examples

Import trusted entries exported by the server

  1. Obtain the server's key export host output through an independently trusted provisioning channel. It can contain several host keys.
  2. Import those already trusted entries on the workstation:

    1
    2
    3
    bifroest key import host \
      --knownHostsFile ~/.ssh/known_hosts \
      --input /srv/ssh-trust/bifroest-known-hosts
    

    The importing user needs write access to the destination's parent directory. For a single imported key, --expectedFingerprint can additionally check its independently retained fingerprint; one fingerprint cannot match several different keys. The SSH-environment configuration and Bifröst delegation example show complete trust exchanges. Use Remote access to configure a management alias after provisioning host trust.

Availability

linux darwin windows
/ / /

Invocation modes

Local CLI @target Direct SSH