Skip to main content

parse_host_key_error

Function parse_host_key_error 

Source
pub fn parse_host_key_error(stderr: &str) -> Option<(String, String)>
Expand description

Parse host key verification error from SSH stderr output. Returns (hostname, known_hosts_path) if the error is a changed host key.

Uses two detection strategies:

  1. English string matching for hostname and known_hosts path extraction.
  2. Locale-independent fallback: the @@@@@ warning banner is always present regardless of locale, combined with a known_hosts path from “Offending” line. When the English hostname line is missing, falls back to extracting the hostname from the known_hosts file path.