hostkey

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL