Documentation ¶
Overview ¶
Package service holds the implementation of the kolide service interface and the HTTP endpoints for the API
Index ¶
- func MakeHandler(svc kolide.Service, config config.KolideConfig, logger kitlog.Logger) http.Handler
- func NewLoggingService(svc kolide.Service, logger kitlog.Logger) kolide.Service
- func NewMetricsService(svc kolide.Service, requestCount metrics.Counter, ...) kolide.Service
- func NewService(ds kolide.Datastore, resultStore kolide.QueryResultStore, logger kitlog.Logger, ...) (kolide.Service, error)
- func RedirectLoginToSetup(svc kolide.Service, logger kitlog.Logger, next http.Handler, urlPrefix string) http.HandlerFunc
- func RedirectSetupToLogin(svc kolide.Service, logger kitlog.Logger, next http.Handler, urlPrefix string) http.HandlerFunc
- func RequireSetup(svc kolide.Service) (bool, error)
- func ServeFrontend(urlPrefix string, logger log.Logger) http.Handler
- func ServeStaticAssets(path string) http.Handler
- func WithSetup(svc kolide.Service, logger kitlog.Logger, next http.Handler) http.HandlerFunc
- type Client
- func (c *Client) ApplyAppConfig(payload *kolide.AppConfigPayload) error
- func (c *Client) ApplyEnrollSecretSpec(spec *kolide.EnrollSecretSpec) error
- func (c *Client) ApplyLabels(specs []*kolide.LabelSpec) error
- func (c *Client) ApplyOptions(spec *kolide.OptionsSpec) error
- func (c *Client) ApplyPacks(specs []*kolide.PackSpec) error
- func (c *Client) ApplyQueries(specs []*kolide.QuerySpec) error
- func (c *Client) AuthenticatedDo(verb, path string, params interface{}) (*http.Response, error)
- func (c *Client) DeleteHost(id uint) error
- func (c *Client) DeleteLabel(name string) error
- func (c *Client) DeletePack(name string) error
- func (c *Client) DeleteQuery(name string) error
- func (c *Client) Do(verb, path string, params interface{}) (*http.Response, error)
- func (c *Client) GetAppConfig() (*kolide.AppConfigPayload, error)
- func (c *Client) GetEnrollSecretSpec() (*kolide.EnrollSecretSpec, error)
- func (c *Client) GetHosts() ([]HostResponse, error)
- func (c *Client) GetLabel(name string) (*kolide.LabelSpec, error)
- func (c *Client) GetLabels() ([]*kolide.LabelSpec, error)
- func (c *Client) GetOptions() (*kolide.OptionsSpec, error)
- func (c *Client) GetPack(name string) (*kolide.PackSpec, error)
- func (c *Client) GetPacks() ([]*kolide.PackSpec, error)
- func (c *Client) GetQueries() ([]*kolide.QuerySpec, error)
- func (c *Client) GetQuery(name string) (*kolide.QuerySpec, error)
- func (c *Client) GetServerSettings() (*kolide.ServerSettings, error)
- func (c *Client) HostByIdentifier(identifier string) (*HostResponse, error)
- func (c *Client) LiveQuery(query string, labels []string, hosts []string) (*LiveQueryResultsHandler, error)
- func (c *Client) Login(email, password string) (string, error)
- func (c *Client) Logout() error
- func (c *Client) SearchTargets(query string, selectedHostIDs, selectedLabelIDs []uint) (*kolide.TargetSearchResults, error)
- func (c *Client) SetToken(t string)
- func (c *Client) Setup(email, username, password, org string) (string, error)
- type HostResponse
- type InvalidLoginErr
- type KolideEndpoints
- type LiveQueryResultsHandler
- type NotFoundErr
- type NotSetupErr
- type SetupAlreadyErr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeHandler ¶
MakeHandler creates an HTTP handler for the Fleet server endpoints.
func NewLoggingService ¶
NewLoggingService takes an existing service and adds a logging wrapper
func NewMetricsService ¶
func NewMetricsService( svc kolide.Service, requestCount metrics.Counter, requestLatency metrics.Histogram, ) kolide.Service
NewMetrics service takes an existing service and wraps it with instrumentation middleware.
func NewService ¶
func NewService(ds kolide.Datastore, resultStore kolide.QueryResultStore, logger kitlog.Logger, config config.KolideConfig, mailService kolide.MailService, c clock.Clock, sso sso.SessionStore, lq kolide.LiveQueryStore) (kolide.Service, error)
NewService creates a new service from the config struct
func RedirectLoginToSetup ¶
func RedirectLoginToSetup(svc kolide.Service, logger kitlog.Logger, next http.Handler, urlPrefix string) http.HandlerFunc
RedirectLoginToSetup detects if the setup endpoint should be used. If setup is required it redirect all frontend urls to /setup, otherwise the frontend router is used.
func RedirectSetupToLogin ¶
func RedirectSetupToLogin(svc kolide.Service, logger kitlog.Logger, next http.Handler, urlPrefix string) http.HandlerFunc
RedirectSetupToLogin forces the /setup path to be redirected to login. This middleware is used after the app has been setup.
func RequireSetup ¶
RequireSetup checks to see if the service has been setup.
func ServeStaticAssets ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ApplyAppConfig ¶
func (c *Client) ApplyAppConfig(payload *kolide.AppConfigPayload) error
ApplyAppConfig sends the application config to be applied to the Fleet instance.
func (*Client) ApplyEnrollSecretSpec ¶
func (c *Client) ApplyEnrollSecretSpec(spec *kolide.EnrollSecretSpec) error
ApplyEnrollSecretSpec applies the enroll secrets.
func (*Client) ApplyLabels ¶
ApplyLabels sends the list of Labels to be applied (upserted) to the Fleet instance.
func (*Client) ApplyOptions ¶
func (c *Client) ApplyOptions(spec *kolide.OptionsSpec) error
ApplyOptions sends the osquery options to be applied to the Fleet instance.
func (*Client) ApplyPacks ¶
ApplyPacks sends the list of Packs to be applied (upserted) to the Fleet instance.
func (*Client) ApplyQueries ¶
ApplyQueries sends the list of Queries to be applied (upserted) to the Fleet instance.
func (*Client) AuthenticatedDo ¶
func (*Client) DeleteHost ¶
DeleteHost deletes the host with the matching id.
func (*Client) DeleteLabel ¶
DeleteLabel deletes the label with the matching name.
func (*Client) DeletePack ¶
DeletePack deletes the pack with the matching name.
func (*Client) DeleteQuery ¶
DeleteQuery deletes the query with the matching name.
func (*Client) GetAppConfig ¶
func (c *Client) GetAppConfig() (*kolide.AppConfigPayload, error)
GetAppConfig fetches the application config from the server API
func (*Client) GetEnrollSecretSpec ¶
func (c *Client) GetEnrollSecretSpec() (*kolide.EnrollSecretSpec, error)
GetEnrollSecretSpec fetches the enroll secrets stored on the server
func (*Client) GetHosts ¶
func (c *Client) GetHosts() ([]HostResponse, error)
GetHosts retrieves the list of all Hosts
func (*Client) GetOptions ¶
func (c *Client) GetOptions() (*kolide.OptionsSpec, error)
GetOptions retrieves the configured osquery options.
func (*Client) GetQueries ¶
GetQueries retrieves the list of all Queries.
func (*Client) GetServerSettings ¶
func (c *Client) GetServerSettings() (*kolide.ServerSettings, error)
GetServerSettings fetches the server settings from the server API
func (*Client) HostByIdentifier ¶
func (c *Client) HostByIdentifier(identifier string) (*HostResponse, error)
HostByIdentifier retrieves a host by the uuid, osquery_host_id, hostname, or node_key.
func (*Client) LiveQuery ¶
func (c *Client) LiveQuery(query string, labels []string, hosts []string) (*LiveQueryResultsHandler, error)
LiveQuery creates a new live query and begins streaming results.
func (*Client) Login ¶
Login attempts to login to the current Fleet instance. If login is successful, an auth token is returned.
func (*Client) SearchTargets ¶
func (c *Client) SearchTargets(query string, selectedHostIDs, selectedLabelIDs []uint) (*kolide.TargetSearchResults, error)
SearchTargets searches for the supplied targets in the Fleet instance.
type HostResponse ¶
type HostResponse struct { kolide.Host Status kolide.HostStatus `json:"status"` DisplayText string `json:"display_text"` Labels []kolide.Label `json:"labels,omitempty"` }
HostResponse is the response struct that contains the full host information along with the host online status and the "display text" to be used when rendering in the UI.
type InvalidLoginErr ¶
type KolideEndpoints ¶
type KolideEndpoints struct { Login endpoint.Endpoint Logout endpoint.Endpoint ForgotPassword endpoint.Endpoint ResetPassword endpoint.Endpoint Me endpoint.Endpoint ChangePassword endpoint.Endpoint CreateUser endpoint.Endpoint GetUser endpoint.Endpoint ListUsers endpoint.Endpoint ModifyUser endpoint.Endpoint AdminUser endpoint.Endpoint EnableUser endpoint.Endpoint RequirePasswordReset endpoint.Endpoint PerformRequiredPasswordReset endpoint.Endpoint GetSessionsForUserInfo endpoint.Endpoint DeleteSessionsForUser endpoint.Endpoint GetSessionInfo endpoint.Endpoint DeleteSession endpoint.Endpoint GetAppConfig endpoint.Endpoint ModifyAppConfig endpoint.Endpoint ApplyEnrollSecretSpec endpoint.Endpoint GetEnrollSecretSpec endpoint.Endpoint CreateInvite endpoint.Endpoint ListInvites endpoint.Endpoint DeleteInvite endpoint.Endpoint VerifyInvite endpoint.Endpoint GetQuery endpoint.Endpoint ListQueries endpoint.Endpoint CreateQuery endpoint.Endpoint ModifyQuery endpoint.Endpoint DeleteQuery endpoint.Endpoint DeleteQueryByID endpoint.Endpoint DeleteQueries endpoint.Endpoint ApplyQuerySpecs endpoint.Endpoint GetQuerySpecs endpoint.Endpoint GetQuerySpec endpoint.Endpoint CreateDistributedQueryCampaign endpoint.Endpoint CreateDistributedQueryCampaignByNames endpoint.Endpoint CreatePack endpoint.Endpoint ModifyPack endpoint.Endpoint GetPack endpoint.Endpoint ListPacks endpoint.Endpoint DeletePack endpoint.Endpoint DeletePackByID endpoint.Endpoint GetScheduledQueriesInPack endpoint.Endpoint ScheduleQuery endpoint.Endpoint GetScheduledQuery endpoint.Endpoint ModifyScheduledQuery endpoint.Endpoint DeleteScheduledQuery endpoint.Endpoint ApplyPackSpecs endpoint.Endpoint GetPackSpecs endpoint.Endpoint GetPackSpec endpoint.Endpoint EnrollAgent endpoint.Endpoint GetClientConfig endpoint.Endpoint GetDistributedQueries endpoint.Endpoint SubmitDistributedQueryResults endpoint.Endpoint SubmitLogs endpoint.Endpoint CreateLabel endpoint.Endpoint ModifyLabel endpoint.Endpoint GetLabel endpoint.Endpoint ListLabels endpoint.Endpoint ListHostsInLabel endpoint.Endpoint DeleteLabel endpoint.Endpoint DeleteLabelByID endpoint.Endpoint ApplyLabelSpecs endpoint.Endpoint GetLabelSpecs endpoint.Endpoint GetLabelSpec endpoint.Endpoint GetHost endpoint.Endpoint HostByIdentifier endpoint.Endpoint DeleteHost endpoint.Endpoint ListHosts endpoint.Endpoint GetHostSummary endpoint.Endpoint SearchTargets endpoint.Endpoint ApplyOsqueryOptionsSpec endpoint.Endpoint GetOsqueryOptionsSpec endpoint.Endpoint GetCertificate endpoint.Endpoint ChangeEmail endpoint.Endpoint InitiateSSO endpoint.Endpoint CallbackSSO endpoint.Endpoint SSOSettings endpoint.Endpoint StatusResultStore endpoint.Endpoint StatusLiveQuery endpoint.Endpoint }
KolideEndpoints is a collection of RPC endpoints implemented by the Kolide API.
func MakeKolideServerEndpoints ¶
func MakeKolideServerEndpoints(svc kolide.Service, jwtKey, urlPrefix string) KolideEndpoints
MakeKolideServerEndpoints creates the Kolide API endpoints.
type LiveQueryResultsHandler ¶
type LiveQueryResultsHandler struct {
// contains filtered or unexported fields
}
LiveQueryResultsHandler provides access to all of the information about an incoming stream of live query results.
func NewLiveQueryResultsHandler ¶
func NewLiveQueryResultsHandler() *LiveQueryResultsHandler
func (*LiveQueryResultsHandler) Errors ¶
func (h *LiveQueryResultsHandler) Errors() <-chan error
Errors returns a read channel that includes any errors returned by the server or receiving the results.
func (*LiveQueryResultsHandler) Results ¶
func (h *LiveQueryResultsHandler) Results() <-chan kolide.DistributedQueryResult
Results returns a read channel including any received results
func (*LiveQueryResultsHandler) Status ¶
func (h *LiveQueryResultsHandler) Status() *campaignStatus
func (*LiveQueryResultsHandler) Totals ¶
func (h *LiveQueryResultsHandler) Totals() *targetTotals
Totals returns the current metadata of hosts targeted by the query
type NotFoundErr ¶
type NotSetupErr ¶
type SetupAlreadyErr ¶
Source Files ¶
- client.go
- client_appconfig.go
- client_errors.go
- client_hosts.go
- client_labels.go
- client_live_query.go
- client_options.go
- client_packs.go
- client_queries.go
- client_sessions.go
- client_setup.go
- client_targets.go
- endpoint_appconfig.go
- endpoint_campaigns.go
- endpoint_certificate.go
- endpoint_change_email.go
- endpoint_hosts.go
- endpoint_invites.go
- endpoint_labels.go
- endpoint_middleware.go
- endpoint_osquery.go
- endpoint_osquery_options.go
- endpoint_packs.go
- endpoint_queries.go
- endpoint_scheduled_queries.go
- endpoint_sessions.go
- endpoint_setup.go
- endpoint_status.go
- endpoint_targets.go
- endpoint_users.go
- frontend.go
- handler.go
- http_auth.go
- logging.go
- logging_appconfig.go
- logging_campaigns.go
- logging_email_change.go
- logging_hosts.go
- logging_invites.go
- logging_labels.go
- logging_osquery.go
- logging_osquery_options.go
- logging_packs.go
- logging_queries.go
- logging_scheduled_queries.go
- logging_sessions.go
- logging_users.go
- metrics.go
- metrics_appconfig.go
- metrics_change_email.go
- metrics_invites.go
- metrics_labels.go
- metrics_sessions.go
- metrics_users.go
- service.go
- service_appconfig.go
- service_campaigns.go
- service_certificate.go
- service_errors.go
- service_hosts.go
- service_invites.go
- service_labels.go
- service_osquery.go
- service_osquery_options.go
- service_packs.go
- service_queries.go
- service_scheduled_queries.go
- service_sessions.go
- service_status.go
- service_targets.go
- service_users.go
- transport.go
- transport_appconfig.go
- transport_campaigns.go
- transport_change_email.go
- transport_error.go
- transport_hosts.go
- transport_invites.go
- transport_labels.go
- transport_osquery.go
- transport_osquery_options.go
- transport_packs.go
- transport_queries.go
- transport_scheduled_queries.go
- transport_sessions.go
- transport_setup.go
- transport_targets.go
- transport_users.go
- validation_app_config.go
- validation_invites.go
- validation_sessions.go
- validation_setup.go
- validation_users.go