mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
#30877 We need to send `platform_like` during orbit enrollment for proper setup experience for Linux If some of the following don't apply, delete the relevant line. - [X] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. ## Testing - [X] Added/updated automated tests - [X] QA'd all new/changed functionality manually ## fleetd/orbit/Fleet Desktop - [X] Verified compatibility with the latest released version of Fleet (see [Must rule](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/workflows/fleetd-development-and-release-strategy.md)) - [ ] Verified that fleetd runs on macOS, Linux and Windows - [x] Verified auto-update works from the released version of component to the new version (see [tools/tuf/test](../tools/tuf/test/README.md))
113 lines
3.9 KiB
Go
113 lines
3.9 KiB
Go
// Automatically generated by mockimpl. DO NOT EDIT!
|
|
|
|
package mock
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"sync"
|
|
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
|
)
|
|
|
|
var _ fleet.OsqueryService = (*TLSService)(nil)
|
|
|
|
type EnrollOsqueryFunc func(ctx context.Context, enrollSecret string, hostIdentifier string, hostDetails map[string](map[string]string)) (nodeKey string, err error)
|
|
|
|
type AuthenticateHostFunc func(ctx context.Context, nodeKey string) (host *fleet.Host, debug bool, err error)
|
|
|
|
type GetClientConfigFunc func(ctx context.Context) (config map[string]interface{}, err error)
|
|
|
|
type GetDistributedQueriesFunc func(ctx context.Context) (queries map[string]string, discovery map[string]string, accelerate uint, err error)
|
|
|
|
type SubmitDistributedQueryResultsFunc func(ctx context.Context, results fleet.OsqueryDistributedQueryResults, statuses map[string]fleet.OsqueryStatus, messages map[string]string, stats map[string]*fleet.Stats) (err error)
|
|
|
|
type SubmitStatusLogsFunc func(ctx context.Context, logs []json.RawMessage) (err error)
|
|
|
|
type SubmitResultLogsFunc func(ctx context.Context, logs []json.RawMessage) (err error)
|
|
|
|
type YaraRuleByNameFunc func(ctx context.Context, name string) (*fleet.YaraRule, error)
|
|
|
|
type TLSService struct {
|
|
EnrollOsqueryFunc EnrollOsqueryFunc
|
|
EnrollOsqueryFuncInvoked bool
|
|
|
|
AuthenticateHostFunc AuthenticateHostFunc
|
|
AuthenticateHostFuncInvoked bool
|
|
|
|
GetClientConfigFunc GetClientConfigFunc
|
|
GetClientConfigFuncInvoked bool
|
|
|
|
GetDistributedQueriesFunc GetDistributedQueriesFunc
|
|
GetDistributedQueriesFuncInvoked bool
|
|
|
|
SubmitDistributedQueryResultsFunc SubmitDistributedQueryResultsFunc
|
|
SubmitDistributedQueryResultsFuncInvoked bool
|
|
|
|
SubmitStatusLogsFunc SubmitStatusLogsFunc
|
|
SubmitStatusLogsFuncInvoked bool
|
|
|
|
SubmitResultLogsFunc SubmitResultLogsFunc
|
|
SubmitResultLogsFuncInvoked bool
|
|
|
|
YaraRuleByNameFunc YaraRuleByNameFunc
|
|
YaraRuleByNameFuncInvoked bool
|
|
|
|
mu sync.Mutex
|
|
}
|
|
|
|
func (s *TLSService) EnrollOsquery(ctx context.Context, enrollSecret string, hostIdentifier string, hostDetails map[string](map[string]string)) (nodeKey string, err error) {
|
|
s.mu.Lock()
|
|
s.EnrollOsqueryFuncInvoked = true
|
|
s.mu.Unlock()
|
|
return s.EnrollOsqueryFunc(ctx, enrollSecret, hostIdentifier, hostDetails)
|
|
}
|
|
|
|
func (s *TLSService) AuthenticateHost(ctx context.Context, nodeKey string) (host *fleet.Host, debug bool, err error) {
|
|
s.mu.Lock()
|
|
s.AuthenticateHostFuncInvoked = true
|
|
s.mu.Unlock()
|
|
return s.AuthenticateHostFunc(ctx, nodeKey)
|
|
}
|
|
|
|
func (s *TLSService) GetClientConfig(ctx context.Context) (config map[string]interface{}, err error) {
|
|
s.mu.Lock()
|
|
s.GetClientConfigFuncInvoked = true
|
|
s.mu.Unlock()
|
|
return s.GetClientConfigFunc(ctx)
|
|
}
|
|
|
|
func (s *TLSService) GetDistributedQueries(ctx context.Context) (queries map[string]string, discovery map[string]string, accelerate uint, err error) {
|
|
s.mu.Lock()
|
|
s.GetDistributedQueriesFuncInvoked = true
|
|
s.mu.Unlock()
|
|
return s.GetDistributedQueriesFunc(ctx)
|
|
}
|
|
|
|
func (s *TLSService) SubmitDistributedQueryResults(ctx context.Context, results fleet.OsqueryDistributedQueryResults, statuses map[string]fleet.OsqueryStatus, messages map[string]string, stats map[string]*fleet.Stats) (err error) {
|
|
s.mu.Lock()
|
|
s.SubmitDistributedQueryResultsFuncInvoked = true
|
|
s.mu.Unlock()
|
|
return s.SubmitDistributedQueryResultsFunc(ctx, results, statuses, messages, stats)
|
|
}
|
|
|
|
func (s *TLSService) SubmitStatusLogs(ctx context.Context, logs []json.RawMessage) (err error) {
|
|
s.mu.Lock()
|
|
s.SubmitStatusLogsFuncInvoked = true
|
|
s.mu.Unlock()
|
|
return s.SubmitStatusLogsFunc(ctx, logs)
|
|
}
|
|
|
|
func (s *TLSService) SubmitResultLogs(ctx context.Context, logs []json.RawMessage) (err error) {
|
|
s.mu.Lock()
|
|
s.SubmitResultLogsFuncInvoked = true
|
|
s.mu.Unlock()
|
|
return s.SubmitResultLogsFunc(ctx, logs)
|
|
}
|
|
|
|
func (s *TLSService) YaraRuleByName(ctx context.Context, name string) (*fleet.YaraRule, error) {
|
|
s.mu.Lock()
|
|
s.YaraRuleByNameFuncInvoked = true
|
|
s.mu.Unlock()
|
|
return s.YaraRuleByNameFunc(ctx, name)
|
|
}
|