ssh

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2014 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultKnownHostsFile = "~/.fleetctl/known_hosts"
)

Variables

View Source
var (
	ErrUnparsableKey   = errors.New("unparsable key bytes")
	ErrUnsetTrustFunc  = errors.New("unset trustHost function")
	ErrUntrustHost     = errors.New("unauthorized host")
	ErrUnmatchKey      = errors.New("host key mismatch")
	ErrUnfoundHostAddr = errors.New("cannot find out host address")
)

Functions

func SSHAgentClient added in v0.2.0

func SSHAgentClient() (gosshagent.Agent, error)

func Shell

func Shell(client *SSHForwardingClient) error

Types

type Channel added in v0.2.0

type Channel struct {
	Stdout *bufio.Reader
	Stderr *bufio.Reader
	Exit   chan error
}

func Execute

func Execute(client *SSHForwardingClient, cmd string) (*Channel, error)

type HostKeyChecker added in v0.2.0

type HostKeyChecker struct {
	// contains filtered or unexported fields
}

HostKeyChecker implements gossh.HostKeyChecker interface It is used for validation during the cryptographic handshake

func NewHostKeyChecker added in v0.2.0

func NewHostKeyChecker(m HostKeyManager, trustHost func(addr, algo, fingerprint string) bool, errWriter io.Writer) *HostKeyChecker

NewHostKeyChecker returns new HostKeyChecker m manages existing host keys, trustHost tells whether or not to trust new host, errWriter indicates the place to write error msg

func (*HostKeyChecker) Check added in v0.2.0

func (kc *HostKeyChecker) Check(addr string, remote net.Addr, key gossh.PublicKey) error

Check is called during the handshake to check server's public key for unexpected changes. The hostKey argument is in SSH wire format. It can be parsed using ssh.ParsePublicKey. The address before DNS resolution is passed in the addr argument, so the key can also be checked against the hostname.

func (*HostKeyChecker) SetTrustHost added in v0.2.0

func (kc *HostKeyChecker) SetTrustHost(trustHost func(addr, algo, fingerprint string) bool)

SetTrustHost sets trustHost field

type HostKeyFile added in v0.2.0

type HostKeyFile struct {
	// contains filtered or unexported fields
}

HostKeyFile is an implementation of HostKeyManager interface Host keys are saved and loaded from file

func NewHostKeyFile added in v0.2.0

func NewHostKeyFile(path string) *HostKeyFile

NewHostKeyFile returns new HostKeyFile using file path

func (*HostKeyFile) GetHostKeys added in v0.2.0

func (f *HostKeyFile) GetHostKeys() (map[string]gossh.PublicKey, error)

func (*HostKeyFile) PutHostKey added in v0.2.0

func (f *HostKeyFile) PutHostKey(addr string, hostKey gossh.PublicKey) error

func (*HostKeyFile) String added in v0.2.0

func (f *HostKeyFile) String() string

type HostKeyManager added in v0.2.0

type HostKeyManager interface {
	String() string
	// get all host keys
	GetHostKeys() (map[string]gossh.PublicKey, error)
	// put new host key under management
	PutHostKey(addr string, hostKey gossh.PublicKey) error
}

HostKeyManager gives the interface to manage host keys

type SSHForwardingClient added in v0.2.0

type SSHForwardingClient struct {
	*gossh.Client
	// contains filtered or unexported fields
}

func NewSSHClient

func NewSSHClient(user, addr string, checker *HostKeyChecker, agentForwarding bool) (*SSHForwardingClient, error)

func NewTunnelledSSHClient added in v0.1.1

func NewTunnelledSSHClient(user, tunaddr, tgtaddr string, checker *HostKeyChecker, agentForwarding bool) (*SSHForwardingClient, error)

func (*SSHForwardingClient) ForwardAgentAuthentication added in v0.2.0

func (s *SSHForwardingClient) ForwardAgentAuthentication(session *gossh.Session) error

Jump to

Keyboard shortcuts

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