agent

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Code in this file has been adapted from https://github.com/FiloSottile/yubikey-agent/blob/v0.1.6/main.go#L77 released under the above license

Index

Constants

View Source
const (
	// SessionExtension is the Session Extension type for the Paw Agent
	SessionExtension = "session@paw"

	// SessionIDPrefix is the prefix of the Paw Session ID
	SessionIDPrefix = "PAW-SID-"
)
View Source
const (
	SessionActionLock uint8 = iota
	SessionActionUnlock
	SessionActionKey
	SessionActionList
)
View Source
const (

	// TypeExtension is the Type Extension type for the Paw Agent
	TypeExtension = "type@paw"
)

Variables

View Source
var ErrOperationUnsupported = errors.New("operation unsupported")

Functions

func Run

func Run(a *Agent, socketPath string)

Types

type Agent

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

func NewCLI

func NewCLI() *Agent

func NewGUI

func NewGUI() *Agent

func (*Agent) Add

func (a *Agent) Add(key sshagent.AddedKey) error

Add implements agent.ExtendedAgent

func (*Agent) AddSSHKey

func (a *Agent) AddSSHKey(key crypto.PrivateKey, comment string) error

func (*Agent) Close

func (a *Agent) Close() error

func (*Agent) Extension

func (a *Agent) Extension(extensionType string, contents []byte) ([]byte, error)

func (*Agent) List

func (a *Agent) List() ([]*sshagent.Key, error)

List implements agent.ExtendedAgent

func (*Agent) Lock

func (a *Agent) Lock(passphrase []byte) error

Lock implements agent.ExtendedAgent

func (*Agent) Remove

func (a *Agent) Remove(key ssh.PublicKey) error

Remove implements agent.ExtendedAgent

func (*Agent) RemoveAll

func (a *Agent) RemoveAll() error

RemoveAll implements agent.ExtendedAgent

func (*Agent) Sign

func (a *Agent) Sign(key ssh.PublicKey, data []byte) (*ssh.Signature, error)

Sign implements agent.ExtendedAgent

func (*Agent) SignWithFlags

func (a *Agent) SignWithFlags(key ssh.PublicKey, data []byte, flags sshagent.SignatureFlags) (*ssh.Signature, error)

func (*Agent) Signers

func (a *Agent) Signers() ([]ssh.Signer, error)

Signers implements agent.ExtendedAgent

func (*Agent) Unlock

func (a *Agent) Unlock(passphrase []byte) error

Unlock implements agent.ExtendedAgent

type PawAgent

func NewClient

func NewClient(socketPath string) (PawAgent, error)

NewClient returns a Paw agent client to manage sessions and SSH keys The communication with agent is done using the SSH agent protocol.

type PawSessionExtendedAgent

type PawSessionExtendedAgent interface {
	Key(vaultName string, sessionID string) (*paw.Key, error)
	Lock(vaultName string) error
	Sessions() ([]Session, error)
	Unlock(vaultName string, key *paw.Key, lifetime time.Duration) (string, error)
}

PawSessionExtendedAgent wraps the method for the Paw agent client to handle sessions

type PawTypeExtendedAgent

type PawTypeExtendedAgent interface {
	Type() (Type, error)
}

PawSessionExtendedAgent wraps the method for the Paw agent client to handle sessions

type SSHAgent

type SSHAgent interface {
	AddSSHKey(key crypto.PrivateKey, comment string) error
	RemoveSSHKey(key ssh.PublicKey) error
}

SSHAgent wraps the method for the Paw agent client to handle SSH keys

type Session

type Session struct {
	ID       string
	Lifetime time.Duration
	Key      *paw.Key
	Vault    string
}

Session is the payload used to perform agent's requests

type Type

type Type string

Type represents the agent type

const (
	// CLI represents the agent started in CLI mode
	CLI Type = "CLI"
	// GUI represents the agent started in GUI mode
	GUI = "GUI"
)

Jump to

Keyboard shortcuts

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