mgmt: Index | Files

package remote

import ""

Package remote provides the remoting facilities for agentless execution. This set of structs and methods are for running mgmt remotely over SSH. This gives us the architectural robustness of our current design, combined with the ability to run it with an "agent-less" approach for bootstrapping, and in environments with more restrictive installation requirements. In general the following sequence is run:

1) connect to remote host
2) make temporary directory
3) copy over the mgmt binary and graph definition
4) tunnel tcp connections for etcd
5) run it!
6) finish and quit
7) close tunnels
8) clean up
9) disconnect

The main advantage of this agent-less approach, is while multiple of these remote mgmt transient agents are running, they can still exchange data and converge together without directly connecting, since they all tunnel through the etcd server running on the initiator.


Package Files


type Flags Uses

type Flags struct {
    Program string
    Debug   bool

Flags are constants required by the remote lib.

type Remotes Uses

type Remotes struct {
    // contains filtered or unexported fields

The Remotes struct manages a set of SSH connections. TODO: rename this to something more logical

func NewRemotes Uses

func NewRemotes(clientURLs, remoteURLs []string, noop bool, remotes []string, fileWatch chan string, cConns uint16, interactive bool, sshPrivIDRsa string, caching bool, depth uint16, prefix string, converger cv.Converger, convergerCb func(func(map[string]bool) error) (func(), error), flags Flags) *Remotes

NewRemotes builds a Remotes struct.

func (*Remotes) Exit Uses

func (obj *Remotes) Exit() error

Exit causes as much of the Remotes struct to shutdown as quickly and as cleanly as possible. It only returns once everything is shutdown.

func (*Remotes) NewSSH Uses

func (obj *Remotes) NewSSH(file string) (*SSH, error)

NewSSH is a helper function that does the initial parsing into an SSH obj. It takes as input the path to a graph definition file.

func (*Remotes) Ready Uses

func (obj *Remotes) Ready() <-chan struct{}

Ready closes its returned channel when the Run method is up and ready. It is useful to know when ready, since we often execute Run in a go routine.

func (*Remotes) Run Uses

func (obj *Remotes) Run()

Run kicks it all off. It is usually run from a go routine.

type SSH Uses

type SSH struct {
    // contains filtered or unexported fields

The SSH struct is the unit building block for a single remote SSH connection.

func (*SSH) Close Uses

func (obj *SSH) Close() error

Close cleans up after the main SSH connection.

func (*SSH) Connect Uses

func (obj *SSH) Connect() error

Connect kicks off the SSH connection.

func (*SSH) Exec Uses

func (obj *SSH) Exec() error

Exec runs the binary on the remote server.

func (*SSH) ExecExit Uses

func (obj *SSH) ExecExit() error

ExecExit sends a SIGINT (^C) signal to the remote process, and waits for the process to exit.

func (*SSH) Go Uses

func (obj *SSH) Go() error

Go kicks off the entire sequence of one SSH connection.

func (*SSH) Sftp Uses

func (obj *SSH) Sftp() error

Sftp is a function for the sftp protocol to create a remote dir and copy over the binary to run. On error the string represents the path to the remote dir.

func (*SSH) SftpClean Uses

func (obj *SSH) SftpClean() error

SftpClean cleans up the mess and closes the connection from the sftp work.

func (*SSH) SftpCopy Uses

func (obj *SSH) SftpCopy(src, dst string) (int64, error)

SftpCopy is a simple helper function that runs a local -> remote sftp copy.

func (*SSH) SftpGraphCopy Uses

func (obj *SSH) SftpGraphCopy() (int64, error)

SftpGraphCopy is a helper function used for re-copying the graph definition.

func (*SSH) SftpHash Uses

func (obj *SSH) SftpHash(local, remote string) (bool, error)

SftpHash hashes a local file, and compares that hash to the result of a remote hashing command run on the second file path.

func (*SSH) Stop Uses

func (obj *SSH) Stop() error

Stop shuts down any SSH in progress as safely and quickly as possible.

func (*SSH) Tunnel Uses

func (obj *SSH) Tunnel() error

Tunnel initiates the reverse SSH tunnel. You can .Wait() on the returned sync WaitGroup to know when the tunnels have closed completely.

func (*SSH) TunnelClose Uses

func (obj *SSH) TunnelClose() error

TunnelClose causes any currently connected Tunnel to shutdown.

Package remote imports 27 packages (graph) and is imported by 2 packages. Updated 2017-09-19. Refresh now. Tools for package owners.