Documentation ¶
Index ¶
Constants ¶
const (
DefaultKnownHostsFile = "~/.fleetctl/known_hosts"
)
Variables ¶
Functions ¶
func Execute ¶
func Execute(client *SSHForwardingClient, cmd string) (error, int)
Execute runs the given command on the given client with stdin/stdout/stderr connected to the controlling terminal. It returns any error encountered in the SSH session, and the exit status of the remote command.
func SSHAgentClient ¶ added in v0.2.0
func SSHAgentClient() (gosshagent.Agent, error)
SSHAgentClient returns an Agent that talks to the local ssh-agent
func Shell ¶
func Shell(client *SSHForwardingClient) error
Shell launches an interactive shell on the given client. It returns any error encountered in setting up the SSH session.
Types ¶
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
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
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