Documentation ¶
Overview ¶
Package ossh provides functionality for the SSH behaviours required by omnivore. These include both static and streaming ossh tasks, config generation, and similar abstractions of the https://github.com/discoriver/massh package.
Index ¶
- Variables
- func GetKnownHosts() (ssh.HostKeyCallback, error)
- func GetKnownHostsPath() (string, error)
- func GetSortedHostMapKeys(m map[string]struct{}) []string
- type OmniSSHConfig
- func (c *OmniSSHConfig) AddAgent() error
- func (c *OmniSSHConfig) AddBastionHost(b string)
- func (c *OmniSSHConfig) AddBastionHostConfig(s *ssh.ClientConfig)
- func (c *OmniSSHConfig) AddHostKeyCallback(callback ssh.HostKeyCallback)
- func (c *OmniSSHConfig) AddHosts(h []string)
- func (c *OmniSSHConfig) AddJob(j *massh.Job)
- func (c *OmniSSHConfig) AddPasswordAuth(user string, password string)
- func (c *OmniSSHConfig) AddPrivateKeyAuth(keyPath string, password string) (err error)
- func (c *OmniSSHConfig) AddSSHConfig(s *ssh.ClientConfig)
- func (c *OmniSSHConfig) AddWorkerPool(w int)
- func (c *OmniSSHConfig) Stream() (*StreamCycle, error)
- type StreamCycle
- func (s *StreamCycle) AddCompletedHost(host string) error
- func (s *StreamCycle) AddFailedHost(host string) error
- func (s *StreamCycle) AddSlowHost(host string) error
- func (s *StreamCycle) AddTodoHost(host string) error
- func (s *StreamCycle) Initialise()
- func (s *StreamCycle) TerminateSlowHosts() error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetKnownHosts ¶
func GetKnownHosts() (ssh.HostKeyCallback, error)
KnownHosts returns host key callback from a custom known hosts path.
func GetKnownHostsPath ¶
func GetSortedHostMapKeys ¶
Types ¶
type OmniSSHConfig ¶
func (*OmniSSHConfig) AddAgent ¶
func (c *OmniSSHConfig) AddAgent() error
AddAgent sets the SSH_AUTH_SOCK variable for auth in massh.Config.
func (*OmniSSHConfig) AddBastionHost ¶
func (c *OmniSSHConfig) AddBastionHost(b string)
AddBastionHosts adds bastion host to massh.Config
func (*OmniSSHConfig) AddBastionHostConfig ¶
func (c *OmniSSHConfig) AddBastionHostConfig(s *ssh.ClientConfig)
AddBastionHostConfig adds a custom ssh.ClientConfig for the bastion host.
func (*OmniSSHConfig) AddHostKeyCallback ¶
func (c *OmniSSHConfig) AddHostKeyCallback(callback ssh.HostKeyCallback)
func (*OmniSSHConfig) AddHosts ¶
func (c *OmniSSHConfig) AddHosts(h []string)
AddHosts populated OmniSSHConfig with target hosts.
func (*OmniSSHConfig) AddJob ¶
func (c *OmniSSHConfig) AddJob(j *massh.Job)
AddJob adds a massh.Job to the OmniSSHConfig
func (*OmniSSHConfig) AddPasswordAuth ¶
func (c *OmniSSHConfig) AddPasswordAuth(user string, password string)
AddPasswordAuth sets the user and password auth in massh.Config.
func (*OmniSSHConfig) AddPrivateKeyAuth ¶
func (c *OmniSSHConfig) AddPrivateKeyAuth(keyPath string, password string) (err error)
AddPrivateKeyAuth configures the private key for auth in massh.Config. Returns error on failure.
func (*OmniSSHConfig) AddSSHConfig ¶
func (c *OmniSSHConfig) AddSSHConfig(s *ssh.ClientConfig)
AddSSHConfig adds an ssh.ClientConfig to the OmniSSHConfig
func (*OmniSSHConfig) AddWorkerPool ¶
func (c *OmniSSHConfig) AddWorkerPool(w int)
AddWorkerPool adds number of concurrent workers to config.
func (*OmniSSHConfig) Stream ¶
func (c *OmniSSHConfig) Stream() (*StreamCycle, error)
Stream executes work contained in the massh.Config, and returns a StreamCycle for monitoring output and status.
type StreamCycle ¶
type StreamCycle struct { HostsResultChan chan *massh.Result NumHostsInit int Command string // Lifecycle begin TodoHosts map[string]struct{} // Termination CompletedHosts map[string]struct{} FailedHosts map[string]struct{} SlowHosts map[string]struct{} AllHosts []string // contains filtered or unexported fields }
StreamCycle contains values for the lifecycle of a stream job. Hosts should begin their life in the TodoHosts map, and must be moved to one of the termination maps when the massh.Result.DoneChannel is written to. Hosts must not be moved back into the TodoHosts map once moved.
func (*StreamCycle) AddCompletedHost ¶
func (s *StreamCycle) AddCompletedHost(host string) error
func (*StreamCycle) AddFailedHost ¶
func (s *StreamCycle) AddFailedHost(host string) error
func (*StreamCycle) AddSlowHost ¶
func (s *StreamCycle) AddSlowHost(host string) error
func (*StreamCycle) AddTodoHost ¶
func (s *StreamCycle) AddTodoHost(host string) error
func (*StreamCycle) Initialise ¶
func (s *StreamCycle) Initialise()
Initialise sets adds pending, completed, failed, and slow host pointers to a relevant map var for a specific StreamCycle.
func (*StreamCycle) TerminateSlowHosts ¶
func (s *StreamCycle) TerminateSlowHosts() error