sshhelper

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Overview

Package sshhelper is a toolkit for common ssh-related operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddKeyToAgent

func AddKeyToAgent(keyPath string, a agent.Agent, log logrus.FieldLogger) error

AddKeyToAgent adds a key to the internal ssh-key agent. If a public key can be found at the same path as the private key, it will first check the agent and return nil if the key is already present

func GetPasswordInput

func GetPasswordInput() (string, error)

GetPasswordInput retrieves input that doesn't echo back to the user as they type it

func GetSSHAgent

func GetSSHAgent() agent.Agent

GetSSHAgent creates a new ssh-agent, originally it would return one only if it was needed, but it's probably better to always use our own.

func LoadDefaultKey

func LoadDefaultKey(host string, a agent.Agent, log logrus.FieldLogger) (string, error)

LoadDefaultKey loads the default for an alias/host and puts it into the keyring if a default key is not found, the user is prompted to provide the path

Types

type ExistingSSHAgentCallback

type ExistingSSHAgentCallback struct {
	User     string
	Callback func() (signers []ssh.Signer, err error)
	gogitssh.HostKeyCallbackHelper
}

ExistingSSHAgentCallback is based on gogit's transport ssh public key callback, but allows for using an existing ssh-agent

func NewExistingSSHAgentCallback

func NewExistingSSHAgentCallback(a agent.Agent) *ExistingSSHAgentCallback

func (*ExistingSSHAgentCallback) ClientConfig

func (a *ExistingSSHAgentCallback) ClientConfig() (*ssh.ClientConfig, error)

func (*ExistingSSHAgentCallback) Name

func (a *ExistingSSHAgentCallback) Name() string

func (*ExistingSSHAgentCallback) String

func (a *ExistingSSHAgentCallback) String() string

Jump to

Keyboard shortcuts

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