service

package
v0.11.25 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 30 Imported by: 1

Documentation

Overview

Package service defines the interface used by the launcher to communicate with the Kolide server. It currently only uses the gRPC transport, but could be extended to use others.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialGRPC

func DialGRPC(
	serverURL string,
	insecureTLS bool,
	insecureTransport bool,
	certPins [][]byte,
	rootPool *x509.CertPool,
	logger log.Logger,
	opts ...grpc.DialOption,
) (*grpc.ClientConn, error)

dialGRPC creates a grpc client connection.

func MakeCheckHealthEndpoint

func MakeCheckHealthEndpoint(svc KolideService) endpoint.Endpoint

func MakePublishLogsEndpoint

func MakePublishLogsEndpoint(svc KolideService) endpoint.Endpoint

func MakePublishResultsEndpoint

func MakePublishResultsEndpoint(svc KolideService) endpoint.Endpoint

func MakeRequestConfigEndpoint

func MakeRequestConfigEndpoint(svc KolideService) endpoint.Endpoint

func MakeRequestEnrollmentEndpoint

func MakeRequestEnrollmentEndpoint(svc KolideService) endpoint.Endpoint

func MakeRequestQueriesEndpoint

func MakeRequestQueriesEndpoint(svc KolideService) endpoint.Endpoint

func NewGRPCServer

func NewGRPCServer(endpoints Endpoints, logger log.Logger, options ...grpctransport.ServerOption) pb.ApiServer

func NewJSONRPCServer added in v0.11.12

func NewJSONRPCServer(endpoints Endpoints, logger log.Logger, options ...jsonrpc.ServerOption) *jsonrpc.Server

func RegisterGRPCServer

func RegisterGRPCServer(grpcServer *grpc.Server, apiServer pb.ApiServer)

Types

type Endpoints

type Endpoints struct {
	RequestEnrollmentEndpoint endpoint.Endpoint
	RequestConfigEndpoint     endpoint.Endpoint
	PublishLogsEndpoint       endpoint.Endpoint
	RequestQueriesEndpoint    endpoint.Endpoint
	PublishResultsEndpoint    endpoint.Endpoint
	CheckHealthEndpoint       endpoint.Endpoint
}

Endpoints defines the endpoints implemented by the Kolide remote extension servers and clients.

func MakeServerEndpoints

func MakeServerEndpoints(svc KolideService) Endpoints

func (Endpoints) CheckHealth

func (e Endpoints) CheckHealth(ctx context.Context) (int32, error)

func (Endpoints) PublishLogs

func (e Endpoints) PublishLogs(ctx context.Context, nodeKey string, logType logger.LogType, logs []string) (string, string, bool, error)

PublishLogs implements KolideService.PublishLogs

func (Endpoints) PublishResults

func (e Endpoints) PublishResults(ctx context.Context, nodeKey string, results []distributed.Result) (string, string, bool, error)

PublishResults implements KolideService.PublishResults

func (Endpoints) RequestConfig

func (e Endpoints) RequestConfig(ctx context.Context, nodeKey string) (string, bool, error)

RequestConfig implements KolideService.RequestConfig.

func (Endpoints) RequestEnrollment

func (e Endpoints) RequestEnrollment(ctx context.Context, enrollSecret, hostIdentifier string, details EnrollmentDetails) (string, bool, error)

RequestEnrollment implements KolideService.RequestEnrollment

func (Endpoints) RequestQueries

func (e Endpoints) RequestQueries(ctx context.Context, nodeKey string) (*distributed.GetQueriesResult, bool, error)

RequestQueries implements KolideService.RequestQueries

type EnrollmentDetails

type EnrollmentDetails struct {
	OSVersion       string `json:"os_version"`
	OSBuildID       string `json:"os_build_id"`
	OSPlatform      string `json:"os_platform"`
	Hostname        string `json:"hostname"`
	HardwareVendor  string `json:"hardware_vendor"`
	HardwareModel   string `json:"hardware_model"`
	HardwareSerial  string `json:"hardware_serial"`
	OsqueryVersion  string `json:"osquery_version"`
	LauncherVersion string `json:"launcher_version"`
	OSName          string `json:"os_name"`
	OSPlatformLike  string `json:"os_platform_like"`
	GOOS            string `json:"goos"`
	GOARCH          string `json:"goarch"`
	HardwareUUID    string `json:"hardware_uuid"`
}

type KolideClient

type KolideClient = Endpoints

KolideClient is an alias for the Endpoints type. It's added to aid in maintaining backwards compatibility for imports.

type KolideService

type KolideService interface {
	// RequestEnrollment requests a node key for the host, authenticating
	// with the given enroll secret.
	RequestEnrollment(ctx context.Context, enrollSecret, hostIdentifier string, details EnrollmentDetails) (string, bool, error)
	// RequestConfig requests the osquery config for the host.
	RequestConfig(ctx context.Context, nodeKey string) (string, bool, error)
	// PublishLogs publishes logs from the osquery process. These may be
	// status logs or result logs from scheduled queries.
	PublishLogs(ctx context.Context, nodeKey string, logType logger.LogType, logs []string) (string, string, bool, error)
	// RequestQueries requests the distributed queries to execute.
	RequestQueries(ctx context.Context, nodeKey string) (*distributed.GetQueriesResult, bool, error)
	// PublishResults publishes the results of executed distributed queries.
	PublishResults(ctx context.Context, nodeKey string, results []distributed.Result) (string, string, bool, error)
	// CheckHealth returns the status of the remote API, with 1 indicating OK status.
	CheckHealth(ctx context.Context) (int32, error)
}

KolideService is the interface exposed by the Kolide server.

func NewGRPCClient

func NewGRPCClient(conn *grpc.ClientConn, logger log.Logger) KolideService

New creates a new Kolide Client (implementation of the KolideService interface) using the provided gRPC client connection.

func NewJSONRPCClient

func NewJSONRPCClient(
	serverURL string,
	insecureTLS bool,
	insecureTransport bool,
	certPins [][]byte,
	rootPool *x509.CertPool,
	logger log.Logger,
	options ...jsonrpc.ClientOption,
) KolideService

New creates a new Kolide Client (implementation of the KolideService interface) using a JSONRPC client connection.

func NewNoopClient added in v0.11.25

func NewNoopClient(logger log.Logger) KolideService

type Middleware added in v0.11.12

type Middleware func(KolideService) KolideService

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) Middleware

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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