rce

package module
v0.0.0-...-2dcb400 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2017 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

RCE Agent

Build Status Go Report Card GoDoc

gRPC-based Remote Command Execution Agent

This project is still under development and should not be used for anything in production yet. We are not seeking external contributors at this time

License

Apache 2.0

Documentation

Overview

Package rce provides a gRPC-based Remote Code Execution client and server. The server (or "agent") runs on a remote host and executes a whitelist of shell commands specified in a config file. The client calls the server to execute whitelist commands. Commands from different clients run concurrently; there are no safeguards against conflicting or incompatible commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Connect to a remote agent.
	Open(host, port string) error

	// Close connection to a remote agent.
	Close() error

	// Return hostname and port of remote agent, if connected.
	AgentAddr() (string, string)

	// Start a command on the remote agent. Must be connected first by calling
	// Connect. This call is non-blocking. It returns the ID of the command or
	// an error.
	Start(cmdName string, args []string) (id string, err error)

	// Wait for a command on the remote agent. This call blocks until the command
	// completes. It returns the final statue of the command or an error.
	Wait(id string) (*pb.Status, error)

	// Get the status of a running command. This is safe to call by multiple
	// goroutines. ErrNotFound is returned if Wait or Stop has already been
	// called.
	GetStatus(id string) (*pb.Status, error)

	// Stop a running command. ErrNotFound is returne if Wait or Stop has already
	// been called.
	Stop(id string) (*pb.Status, error)

	// Return a list of all running command IDs.
	Running() ([]string, error)
}

A Client calls a remote agent (server) to execute commands.

func NewClient

func NewClient(tlsConfig *tls.Config) Client

NewClient makes a new Client.

type Server

type Server interface {
	// Start the gRPC server, non-blocking.
	StartServer() error

	// Stop the gRPC server gracefully.
	StopServer() error

	pb.RCEAgentServer
}

A Server executes a whitelist of commands when called by clients.

func NewServer

func NewServer(laddr string, tlsConfig *tls.Config, whitelist cmd.Runnable) Server

NewServer makes a new Server that listens on laddr and runs the whitelist of commands. If tlsConfig is nil, the sever is insecure.

type TLSFiles

type TLSFiles struct {
	RootCert   string
	ClientCert string
	ClientKey  string
}

TLSFiles represents the TLS files necessary to create a tls.Config.

func (TLSFiles) TLSConfig

func (f TLSFiles) TLSConfig() (*tls.Config, error)

TLSConfig returns a new tls.Config.

Directories

Path Synopsis
Package cmd provides command file specs and structures used by an rce.Server.
Package cmd provides command file specs and structures used by an rce.Server.
Package rce is a generated protocol buffer package.
Package rce is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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