agent

package
v8.6.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: MIT Imports: 25 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SIGSTRING = map[syscall.Signal]string{
	syscall.SIGABRT: "ABRT",
	syscall.SIGALRM: "ALRM",
	syscall.SIGFPE:  "FPE",
	syscall.SIGHUP:  "HUP",
	syscall.SIGILL:  "ILL",
	syscall.SIGINT:  "INT",
	syscall.SIGKILL: "KILL",
	syscall.SIGPIPE: "PIPE",
	syscall.SIGQUIT: "QUIT",
	syscall.SIGSEGV: "SEGV",
	syscall.SIGTERM: "TERM",
	syscall.SIGUSR1: "USR1",
	syscall.SIGUSR2: "USR2",
}

Based on what's handled in https://github.com/golang/crypto/blob/master/ssh/session.go#L21

Functions

func ConfigureSSHServer

func ConfigureSSHServer(key ssh.Signer, authorizedKeys []ssh.PublicKey, macs []string) (*ssh.ServerConfig, error)

func GeneratePrivateKey

func GeneratePrivateKey() (ssh.Signer, error)

func LoadAuthorizedKeysFromBytes

func LoadAuthorizedKeysFromBytes(b []byte) ([]ssh.PublicKey, error)

func LoadAuthorizedKeysFromFile

func LoadAuthorizedKeysFromFile(path string) ([]ssh.PublicKey, error)

func LoadPrivateKeyFromBytes

func LoadPrivateKeyFromBytes(b []byte) (ssh.Signer, error)

func LoadPrivateKeyFromFile

func LoadPrivateKeyFromFile(path string) (ssh.Signer, error)

Types

type Agent

type Agent struct {
	PluginPaths []string

	Listen net.Listener

	Name    string
	Version string
	Port    int

	Registration struct {
		URL          string
		Interval     int
		ShieldCACert string
		SkipVerify   bool
	}
	// contains filtered or unexported fields
}

func NewAgent

func NewAgent() *Agent

func (*Agent) Execute

func (agent *Agent) Execute(c *Command, out chan string) error

func (*Agent) Ping

func (agent *Agent) Ping()

func (*Agent) ReadConfig

func (agent *Agent) ReadConfig(path string) error

func (*Agent) ResolveBinary

func (agent *Agent) ResolveBinary(name string) (string, error)

func (*Agent) ResolvePathsIn

func (agent *Agent) ResolvePathsIn(c *Command) error

func (*Agent) Run

func (agent *Agent) Run()

func (*Agent) ServeOne

func (agent *Agent) ServeOne(l net.Listener, async bool)

type Command

type Command struct {
	Op             string `json:"operation"`
	TargetPlugin   string `json:"target_plugin,omitempty"`
	TargetEndpoint string `json:"target_endpoint,omitempty"`
	StorePlugin    string `json:"store_plugin,omitempty"`
	StoreEndpoint  string `json:"store_endpoint,omitempty"`
	RestoreKey     string `json:"restore_key,omitempty"`
	EncryptType    string `json:"encrypt_type,omitempty"`
	EncryptKey     string `json:"encrypt_key,omitempty"`
	EncryptIV      string `json:"encrypt_iv,omitempty"`
	Compression    string `json:"compression,omitempty"`
}

func ParseCommand

func ParseCommand(b []byte) (*Command, error)

func ParseCommandFromSSHRequest

func ParseCommandFromSSHRequest(r *ssh.Request) (*Command, error)

func (*Command) Details

func (c *Command) Details() string

type Config

type Config struct {
	Name               string   `yaml:"name"                 env:"SHIELD_AGENT_NAME"`
	AuthorizedKeysFile string   `yaml:"authorized_keys_file" env:"SHIELD_AGENT_AUTHORIZED_KEYS_FILE"`
	AuthorizedKey      string   `yaml:"authorized_key"       env:"SHIELD_AGENT_AUTHORIZED_KEY"`
	HostKeyFile        string   `yaml:"host_key_file"        env:"SHIELD_AGENT_HOST_KEY_FILE"`
	HostKey            string   `yaml:"host_key"             env:"SHIELD_AGENT_HOST_KEY"`
	MACs               []string `yaml:"macs"`
	ListenAddress      string   `yaml:"listen_address"       env:"SHIELD_AGENT_LISTEN_ADDRESS"`
	PluginPaths        []string `yaml:"plugin_paths"`
	PluginPathsEnv     string   `yaml:"-"                    env:"SHIELD_AGENT_PLUGIN_PATHS"`
	Registration       struct {
		URL          string `yaml:"url"             env:"SHIELD_AGENT_REGISTRATION_URL"`
		Interval     int    `yaml:"interval"        env:"SHIELD_AGENT_REGISTRATION_INTERVAL"`
		ShieldCACert string `yaml:"shield_ca_cert"  env:"SHIELD_AGENT_REGISTRATION_SHIELD_CA_CERT"`
		SkipVerify   bool   `yaml:"skip_verify"     env:"SHIELD_AGENT_REGISTRATION_SKIP_VERIFY"`
	} `yaml:"registration"`
}

Jump to

Keyboard shortcuts

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