Documentation ¶
Overview ¶
Package hostkey implements a callback for the ssh.ClientConfig.HostKeyCallback
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // 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") // ErrCheckHostKey is returned when the callback could not be created ErrCheckHostKey = errors.New("check hostkey") // InsecureIgnoreHostKeyCallback is an insecure HostKeyCallback that accepts any host key. InsecureIgnoreHostKeyCallback = ssh.InsecureIgnoreHostKey() //nolint:gosec // DefaultKnownHostsPath is the default path to the known_hosts file - make sure to homedir-expand it DefaultKnownHostsPath = "~/.ssh/known_hosts" )
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, permissive, hash bool) (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.