agent

package
Version: v0.0.0-...-936f95c Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: Apache-2.0, Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const CertExpirationFuzzWindow = 20

CertExpirationFuzzWindow is the time, in seconds that we ask for a new cert in before the current cert expires.

View Source
const DefaultTimeout = time.Second * 30

DefaultTimeout is the default timeout for http calls to the CA

View Source
const TokenSizeLimit = 4094

TokenSizeLimit is the Authentication token size limit

Variables

This section is empty.

Functions

func IsAgentStopped

func IsAgentStopped(err error) bool

IsAgentStopped lets you test if an error indicates that the agent has been stopped

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent represents our agent

func Start

func Start(caClient *caclient.Client, options ...Option) (*Agent, error)

Start creates and starts an SSH Agent

func (*Agent) AgentSocketPath

func (a *Agent) AgentSocketPath() string

AgentSocketPath returns the path for the SSH_AUTH_SOCKET

func (*Agent) Close

func (a *Agent) Close()

Close stops the agent and cleansup after it

func (*Agent) ControlSocketPath

func (a *Agent) ControlSocketPath() string

ControlSocketPath returns the path for the SSH_AUTH_SOCKET

func (*Agent) RequestCertificate

func (a *Agent) RequestCertificate(ctx context.Context, token string) error

RequestCertificate tries to convert a `{token, pubkey}` into a certificate

func (*Agent) Running

func (a *Agent) Running() bool

Running reports on whether the current agent is healthy

func (*Agent) UseCredential

func (a *Agent) UseCredential(c Credential) error

UseCredential the credentials on the agemnt

type Credential

type Credential struct {
	PrivateKey  sshcert.RawPrivateKey
	Certificate sshcert.RawCertificate
}

Credential contains the private key and certificate in pem form

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option configures the agent

func WithAgentSocketPath

func WithAgentSocketPath(path string) Option

WithAgentSocketPath specifies the SSH_AUTH_SOCK path to create

func WithContext

func WithContext(ctx context.Context) Option

WithContext specifies a context.Context that agent will use and which can be cancelled, triggering the agent to stop. This context will also be used for outgoing requests to the CA

func WithControlSocketPath

func WithControlSocketPath(path string) Option

WithControlSocketPath specifies the control socket (API) for the agent

func WithHooks

func WithHooks(hooks map[string]string) Option

WithHooks registers the named hooks on the agent

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto