Documentation
¶
Overview ¶
Package hostkey implements a callback for the ssh.ClientConfig.HostKeyCallback
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // InsecureIgnoreHostKeyCallback is an insecure HostKeyCallback that accepts any host key. InsecureIgnoreHostKeyCallback = ssh.InsecureIgnoreHostKey() //nolint:gosec // ErrHostKeyMismatch is returned when the host key does not match the host key or a key in known_hosts file ErrHostKeyMismatch = errors.New("host key mismatch") // ErrInvalidPath is returned for unusable file paths ErrInvalidPath = errors.New("invalid path") // DefaultKnownHostsPath is the default path to the known_hosts file - make sure to homedir-expand it DefaultKnownHostsPath = "~/.ssh/known_hosts2" )
View Source
var KnownHostsPathFromEnv = func() (string, bool) { return os.LookupEnv("SSH_KNOWN_HOSTS") }
KnownHostsPathFromEnv returns the path to a known_hosts file from the environment variable SSH_KNOWN_HOSTS
Functions ¶
func KnownHostsFileCallback ¶
func KnownHostsFileCallback(path string) (ssh.HostKeyCallback, error)
KnownHostsFileCallback returns a HostKeyCallback that uses a known hosts file to verify host keys
func StaticKeyCallback ¶
func StaticKeyCallback(trustedKey string) ssh.HostKeyCallback
StaticKeyCallback returns a HostKeyCallback that checks the host key against a given host key
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.