state

package
v3.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientStateTypeV2 = "client-state/2"
	ClientStateTypeV3 = "client-state/3"
	ClientStateType   = ClientStateTypeV3

	// DefaultVendorSubdir is the name of the subdirectory we create in various common locations (f.e. /var, /etc) to store our data
	// note: if you change this name, you also have to modify the reference in the windows installer wix main xml file
	DefaultVendorSubdir string = "immune-guard"
)

Variables

View Source
var (
	ErrNotExist = errors.New("non existent")
	ErrInvalid  = errors.New("invalid data")
	ErrNoPerm   = errors.New("no permissions")
)

Functions

func DefaultStateDirs

func DefaultStateDirs() []string

DefaultStateDir returns all candidates for the config data dir in order of writing.

Types

type DeviceKey

type DeviceKey DeviceKeyV3

type DeviceKeyV3

type DeviceKeyV3 struct {
	Public     api.PublicKey `json:"public"`
	Private    api.Buffer    `json:"private"`
	Auth       string        `json:"auth"`
	Credential string        `json:"credential"`
}

type RootKeyV3

type RootKeyV3 struct {
	Auth string   `json:"auth"`
	Name api.Name `json:"name"`
}

type State

type State StateV3

Current "head" state struct definition

func LoadState

func LoadState(dir string) (*State, error)

func NewState

func NewState() *State

func (*State) EnsureFresh

func (s *State) EnsureFresh(cl *api.Client) (bool, error)

func (*State) IsEnrolled

func (s *State) IsEnrolled() bool

func (*State) Store

func (st *State) Store(keysPath string) error

type StateTpmKey

type StateTpmKey struct {
	Public      api.PublicKey `json:"public"`
	Private     api.Buffer    `json:"private"`
	Auth        string        `json:"auth"`
	Certificate string        `json:"certificate"`
}

type StateV2

type StateV2 struct {
	Ty                     string           `json:"type"`
	EndorsementKey         api.PublicKey    `json:"ek"`
	EndorsementCertificate *api.Certificate `json:"ek-certificate"`
	RootKeyAuth            string           `json:"root-key-auth"`
	QuoteKey               StateTpmKey      `json:"quote-key"`
}

Mutable run time data.

type StateV3

type StateV3 struct {
	Ty string `json:"type"`

	// v3.1 (deprecated)
	StubSeed api.Buffer `json:"stub-seed,omitempty"`
	// v3.2
	StubState *StubState `json:"stub-state,omitempty"`

	// /v2/enroll
	Keys                   map[string]DeviceKeyV3 `json:"keys"`
	Root                   RootKeyV3              `json:"root"`
	EndorsementKey         api.PublicKey          `json:"ek"`
	EndorsementCertificate *api.Certificate       `json:"ek-certificate"`

	// /v2/configuration
	LastUpdate time.Time         `json:"last_update,string"`
	Config     api.Configuration `json:"config"`
}

func (*StateV3) EnsureFresh

func (s *StateV3) EnsureFresh(cl *api.Client) (bool, error)

returns true if a new config was fetched

func (*StateV3) IsEnrolled

func (s *StateV3) IsEnrolled() bool

type StubState

type StubState struct {
	Type           string
	RootKey        api.Buffer `json:"root"`
	EndorsementKey api.Buffer `json:"ek"`
}

Jump to

Keyboard shortcuts

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