posture

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// TotpAttemptDelta defines how far in advance of expiration the cache proactively requests
	// new TOTP tokens, ensuring tokens remain valid during authentication flows.
	TotpAttemptDelta = 5 * time.Minute

	// TotpPostureCheckNoTimeout indicates that a TOTP posture check does not expire and
	// does not require periodic token refresh.
	TotpPostureCheckNoTimeout = int64(-1)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveServiceProvider added in v1.2.9

type ActiveServiceProvider interface {
	GetActiveDialServices() []*rest_model.ServiceDetail
	GetActiveBindServices() []*rest_model.ServiceDetail
}

ActiveServiceProvider supplies information about services currently in use by the client, enabling the cache to determine which posture checks are relevant.

type ActiveServiceProviderFunc added in v1.2.9

type ActiveServiceProviderFunc func() []*rest_model.ServiceDetail

ActiveServiceProviderFunc is a function adapter that implements ActiveServiceProvider for both dial and bind service queries.

func (ActiveServiceProviderFunc) GetActiveDialServices added in v1.2.9

func (f ActiveServiceProviderFunc) GetActiveDialServices() []*rest_model.ServiceDetail

type ApiSessionProvider added in v1.2.9

type ApiSessionProvider interface {
	GetCurrentApiSession() edge_apis.ApiSession
}

ApiSessionProvider supplies the current API session, enabling submitters to determine the appropriate destination for posture responses based on authentication type.

type Cache

type Cache struct {
	DomainProvider    DomainProvider
	MacProvider       MacProvider
	OsProvider        OsProvider
	ProcessProvider   ProcessProvider
	TotpTokenProvider edge_apis.TotpTokenProvider
	// contains filtered or unexported fields
}

Cache manages device posture data collection, tracking changes over time and coordinating submission of posture responses when device state changes or policies require updates.

func NewCache

func NewCache(activeServiceProvider ActiveServiceProvider, submitter Submitter, totpTokenProvider edge_apis.TotpTokenProvider, closeNotify <-chan struct{}) *Cache

NewCache creates a posture cache that monitors device state and coordinates posture response submission. The cache uses the provided service provider to determine which posture checks are active, the submitter to send responses, and the token provider for TOTP authentication.

func (*Cache) Evaluate added in v0.15.46

func (cache *Cache) Evaluate()

Evaluate refreshes all posture data and determines if new posture responses should be sent out

func (*Cache) GetAllResponses added in v1.2.9

func (cache *Cache) GetAllResponses() []rest_model.PostureResponseCreate

func (*Cache) GetChangedResponses added in v0.15.46

func (cache *Cache) GetChangedResponses(currentData, candidateData *CacheData, activeQueryTypes map[string]string) []rest_model.PostureResponseCreate

GetChangedResponses determines if posture responses should be sent out.

func (*Cache) InitializePostureOnEdgeRouter added in v1.2.9

func (cache *Cache) InitializePostureOnEdgeRouter(conn edge.RouterConn) error

func (*Cache) OnUnlock added in v1.2.9

func (cache *Cache) OnUnlock(event UnlockEvent)

func (*Cache) SendResponses added in v0.15.46

func (cache *Cache) SendResponses(responses []rest_model.PostureResponseCreate) []error

func (*Cache) SetDomainProviderFunc added in v1.2.9

func (cache *Cache) SetDomainProviderFunc(f func() string)

func (*Cache) SetMacProviderFunc added in v1.2.9

func (cache *Cache) SetMacProviderFunc(f func() []string)

func (*Cache) SetOsProviderFunc added in v1.2.9

func (cache *Cache) SetOsProviderFunc(f func() OsInfo)

func (*Cache) SetProcessProviderFunc added in v1.2.9

func (cache *Cache) SetProcessProviderFunc(f func(string) ProcessInfo)

func (*Cache) SetTotpProviderFunc added in v1.2.9

func (cache *Cache) SetTotpProviderFunc(f func() <-chan edge_apis.TotpTokenResult)

func (*Cache) SetTotpToken added in v1.2.9

func (cache *Cache) SetTotpToken(token *rest_model.TotpToken)

func (*Cache) SimulateUnlock added in v1.2.9

func (cache *Cache) SimulateUnlock()

func (*Cache) SimulateWake added in v1.2.9

func (cache *Cache) SimulateWake()

type CacheData added in v0.15.46

type CacheData struct {
	Processes    cmap.ConcurrentMap[string, ProcessInfo] // map[processPath]ProcessInfo
	MacAddresses []string
	Os           OsInfo
	Domain       string
	TotpToken    edge_apis.TotpTokenResult
	OnWake       WakeEvent
	OnUnlock     UnlockEvent
	Index        uint64
	Responses    []rest_model.PostureResponseCreate
}

CacheData holds the current snapshot of device posture information including running processes, network configuration, operating system details, and authentication state.

func NewCacheData added in v0.15.46

func NewCacheData() *CacheData

NewCacheData creates an empty posture cache snapshot with initialized collections.

type DefaultMacProvider added in v1.2.9

type DefaultMacProvider struct{}

DefaultMacProvider queries the system's network interfaces to collect MAC addresses.

func (*DefaultMacProvider) GetMacAddresses added in v1.2.9

func (p *DefaultMacProvider) GetMacAddresses() []string

type DefaultOsProvider added in v1.2.9

type DefaultOsProvider struct{}

DefaultOsProvider queries platform information to determine OS type and version.

func (DefaultOsProvider) GetOsInfo added in v1.2.9

func (provider DefaultOsProvider) GetOsInfo() OsInfo

type DefaultProcessProvider added in v1.2.9

type DefaultProcessProvider struct{}

func (*DefaultProcessProvider) GetProcessInfo added in v1.2.9

func (p *DefaultProcessProvider) GetProcessInfo(providedPath string) ProcessInfo

type DomainProvider added in v1.2.9

type DomainProvider interface {
	GetDomain() string
}

DomainProvider supplies the Windows domain name that the device is joined to, used for domain membership posture checks.

func DomainFuncAsProvider added in v1.2.9

func DomainFuncAsProvider(f func() string) DomainProvider

DomainFuncAsProvider converts a simple domain-returning function into a DomainProvider.

func NewDomainProvider added in v1.2.9

func NewDomainProvider() DomainProvider

type DomainProviderFunc added in v1.2.9

type DomainProviderFunc func() string

DomainProviderFunc is a function adapter that implements DomainProvider.

func (DomainProviderFunc) GetDomain added in v1.2.9

func (f DomainProviderFunc) GetDomain() string

type EmptyDomainProvider added in v1.2.9

type EmptyDomainProvider struct{}

func (*EmptyDomainProvider) GetDomain added in v1.2.9

func (p *EmptyDomainProvider) GetDomain() string

type EventState added in v1.2.9

type EventState interface {
	// ListenForWake registers a callback for system wake events, returning a function
	// to stop listening.
	ListenForWake(func(WakeEvent)) (stop func(), err error)

	// ListenForUnlock registers a callback for device unlock events, returning a function
	// to stop listening.
	ListenForUnlock(func(event UnlockEvent)) (stop func(), err error)
}

EventState provides platform-specific monitoring of system events that may affect posture compliance, such as waking from sleep or unlocking the device.

func NewEventState added in v1.2.9

func NewEventState() EventState

NewEventState is a stand-in for actual non-Windows event watching

type MacProvider added in v1.2.9

type MacProvider interface {
	GetMacAddresses() []string
}

MacProvider supplies the list of MAC addresses for network interfaces on the device, used for MAC address posture checks.

func NewMacProvider added in v1.2.9

func NewMacProvider() MacProvider

NewMacProvider creates the default MAC address provider that queries system network interfaces.

type MacProviderFunc added in v1.2.9

type MacProviderFunc func() []string

MacProviderFunc is a function adapter that implements MacProvider.

func (MacProviderFunc) GetMacAddresses added in v1.2.9

func (f MacProviderFunc) GetMacAddresses() []string

type MultiDestinationError added in v1.2.9

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

MultiDestinationError aggregates errors from posture response submission attempts to multiple destinations (controller and routers), providing detailed failure information.

func (*MultiDestinationError) Error added in v1.2.9

func (e *MultiDestinationError) Error() string

Error formats all submission failures into a comprehensive error message identifying which destinations failed and why.

func (*MultiDestinationError) HasErrors added in v1.2.9

func (e *MultiDestinationError) HasErrors() bool

HasErrors returns true if any submission attempts failed, either to the controller or to any routers.

type MultiSubmitter added in v1.2.9

type MultiSubmitter struct {
	ApiSessionProvider       ApiSessionProvider
	LegacySubmitter          Submitter
	RouterConnectionProvider RouterConnectionProvider
}

MultiSubmitter routes posture responses to appropriate destinations based on session type and router capabilities. Legacy sessions always submit to the controller, while OIDC sessions submit to routers that support posture checks and fall back to the controller for older routers.

func NewMultiSubmitter added in v1.2.9

func NewMultiSubmitter(apiSessionProvider ApiSessionProvider, legacySubmitter Submitter, routerConnectionProvider RouterConnectionProvider) *MultiSubmitter

NewMultiSubmitter creates a submitter that intelligently routes posture responses based on session authentication method and router capabilities.

func (*MultiSubmitter) SendPostureResponse added in v1.2.9

func (m *MultiSubmitter) SendPostureResponse(response rest_model.PostureResponseCreate) error

func (*MultiSubmitter) SendPostureResponseBulk added in v1.2.9

func (m *MultiSubmitter) SendPostureResponseBulk(responses []rest_model.PostureResponseCreate) error

type NoOpEventState added in v1.2.9

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

NoOpEventState is a placeholder implementation that stores callbacks without actually monitoring system events. Platform-specific implementations should be used for production deployments.

func (*NoOpEventState) ListenForUnlock added in v1.2.9

func (n *NoOpEventState) ListenForUnlock(f func(event UnlockEvent)) (stop func(), err error)

func (*NoOpEventState) ListenForWake added in v1.2.9

func (n *NoOpEventState) ListenForWake(f func(WakeEvent)) (stop func(), err error)

type OsInfo

type OsInfo struct {
	Type    string
	Version string
}

OsInfo contains the operating system type and semantic version.

type OsProvider added in v1.2.9

type OsProvider interface {
	GetOsInfo() OsInfo
}

OsProvider supplies operating system type and version information for OS posture checks.

func NewOsProvider added in v1.2.9

func NewOsProvider() OsProvider

NewOsProvider creates the default OS information provider that queries system details.

type OsProviderFunc added in v1.2.9

type OsProviderFunc func() OsInfo

OsProviderFunc is a function adapter that implements OsProvider.

func (OsProviderFunc) GetOsInfo added in v1.2.9

func (f OsProviderFunc) GetOsInfo() OsInfo

type ProcessInfo

type ProcessInfo struct {
	IsRunning          bool
	Hash               string
	SignerFingerprints []string
	QueryId            string
}

ProcessInfo contains details about a specific process including whether it's running, its binary hash, and code signing fingerprints.

type ProcessInfoFunc added in v1.2.9

type ProcessInfoFunc func(path string) ProcessInfo

ProcessInfoFunc is a function adapter that implements ProcessProvider.

func (ProcessInfoFunc) GetProcessInfo added in v1.2.9

func (f ProcessInfoFunc) GetProcessInfo(path string) ProcessInfo

type ProcessProvider added in v1.2.9

type ProcessProvider interface {
	GetProcessInfo(path string) ProcessInfo
}

ProcessProvider supplies information about specific processes running on the device, including execution state, binary hash, and code signing details for process posture checks.

func NewProcessProvider added in v1.2.9

func NewProcessProvider() ProcessProvider

type RouterConnectionProvider added in v1.2.9

type RouterConnectionProvider interface {
	GetRouterConnections() []edge.RouterConn
}

RouterConnectionProvider supplies active router connections for submitting posture data directly to edge routers in high-availability deployments.

type Submitter added in v0.19.0

type Submitter interface {
	SendPostureResponse(response rest_model.PostureResponseCreate) error
	SendPostureResponseBulk(responses []rest_model.PostureResponseCreate) error
}

Submitter handles transmission of posture response data to authentication and policy enforcement endpoints.

type UnlockEvent added in v1.2.9

type UnlockEvent struct {
	At time.Time
}

UnlockEvent represents a device unlock event after screen lock, used to trigger posture re-evaluation when user authentication state changes.

type WakeEvent added in v1.2.9

type WakeEvent struct {
	At time.Time
}

WakeEvent represents a device wake event from sleep or hibernation, used to trigger posture re-evaluation when the system resumes from a suspended state.

Jump to

Keyboard shortcuts

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