ssh

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KnownHostsConfigMap = "known-hosts" // XXX: is this the name we want?
	KnownHostsEnvVar    = "FLEET_KNOWN_HOSTS"
)

Variables

This section is empty.

Functions

func CreateKnownHostsCallBack

func CreateKnownHostsCallBack(knownHosts []byte) (ssh.HostKeyCallback, error)

CreateKnownHostsCallBack creates a callback function for host key checks based on the provided knownHosts.

func Is

func Is(s string) bool

Is checks if the provided string s is a valid SSH URL, returning a boolean.

Types

type KnownHosts

type KnownHosts struct {
	EnforceHostKeyChecks bool
}

func (KnownHosts) Get

func (s KnownHosts) Get(ctx context.Context, c client.Client, ns string, secretName string) (string, error)

Get looks for SSH known hosts information in the following locations, in decreasing order of precedence: * secret referenced by secretName, in namespace ns * `gitcredential` secret, in namespace ns, if secretName is empty * config map in Fleet controller namespace It returns found known_hosts data, if any, and any error that may have happened in the process (eg. missing fallback, Fleet-wide known hosts config map) Possible returned errors include a failure to enforce strict host key checks, if those are enabled but no known_hosts data is found.

func (KnownHosts) GetWithSecret

func (s KnownHosts) GetWithSecret(ctx context.Context, c client.Client, secret *corev1.Secret) (string, error)

GetWithSecret looks for SSH known hosts information in the injected secret, then in a config map in the Fleet controller namespace, returning data from the first source it finds. It returns found known_hosts data, if any, and any error that may have happened in the process (eg. missing fallback, Fleet-wide known hosts config map) Possible returned errors include a failure to enforce strict host key checks, if those are enabled but no known_hosts data is found.

func (KnownHosts) IsStrict

func (s KnownHosts) IsStrict() bool

Jump to

Keyboard shortcuts

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