Help us shape the future of Go! Take the 2026 Go Developer Survey

handlers

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestPath   = "path"
	RequestMethod = "method"
	StatusCode    = "status_code"
	Environment   = "osctrl_env"
	RequestType   = "type"
	LogType       = "log_type"
)

Variables

This section is empty.

Functions

func NewBatchWriter added in v0.4.4

func NewBatchWriter(batchSize int, timeout time.Duration, bufferSize int, repo nodes.NodeManager) *batchWriter

NewBatchWriter creates and starts a new batch writer.

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter) *responseWriter

func RegisterMetrics

func RegisterMetrics(reg prometheus.Registerer)

Types

type HandlersTLS

type HandlersTLS struct {
	Envs            *environments.EnvManager
	EnvsMap         *environments.MapEnvironments
	EnvCache        *environments.EnvCache
	Nodes           *nodes.NodeManager
	Tags            *tags.TagManager
	Queries         *queries.Queries
	Carves          *carves.Carves
	Settings        *settings.Settings
	SettingsMap     *settings.MapSettings
	Logs            *logging.LoggerTLS
	WriteHandler    *batchWriter
	OsqueryValues   *config.OsqueryConfiguration
	DebugHTTP       *zerolog.Logger
	DebugHTTPConfig *config.DebugHTTPConfiguration
}

HandlersTLS to keep all handlers for TLS

func CreateHandlersTLS

func CreateHandlersTLS(opts ...Option) *HandlersTLS

CreateHandlersTLS to initialize the TLS handlers struct

func (*HandlersTLS) CarveBlockHandler

func (h *HandlersTLS) CarveBlockHandler(w http.ResponseWriter, r *http.Request)

CarveBlockHandler - Function to handle the blocks of the file carver

func (*HandlersTLS) CarveInitHandler

func (h *HandlersTLS) CarveInitHandler(w http.ResponseWriter, r *http.Request)

CarveInitHandler - Function to handle the initialization of the file carver This function does not use go routines to handle requests because the session_id returned must be already created in the DB, otherwise block requests will fail.

func (*HandlersTLS) CertHandler

func (h *HandlersTLS) CertHandler(w http.ResponseWriter, r *http.Request)

CertHandler - Function to retrieve certificate for osquery nodes, from osctrld

func (*HandlersTLS) ConfigHandler

func (h *HandlersTLS) ConfigHandler(w http.ResponseWriter, r *http.Request)

ConfigHandler - Function to handle the configuration requests from osquery nodes

func (*HandlersTLS) EnrollHandler

func (h *HandlersTLS) EnrollHandler(w http.ResponseWriter, r *http.Request)

EnrollHandler - Function to handle the enroll requests from osquery nodes

func (*HandlersTLS) EnrollPackageHandler

func (h *HandlersTLS) EnrollPackageHandler(w http.ResponseWriter, r *http.Request)

EnrollPackageHandler - Function to handle the endpoint for quick enrollment package download

func (*HandlersTLS) ErrorHandler

func (h *HandlersTLS) ErrorHandler(w http.ResponseWriter, r *http.Request)

ErrorHandler for error requests

func (*HandlersTLS) FlagsHandler

func (h *HandlersTLS) FlagsHandler(w http.ResponseWriter, r *http.Request)

FlagsHandler - Function to retrieve flags for osquery nodes, from osctrld

func (*HandlersTLS) HealthHandler

func (h *HandlersTLS) HealthHandler(w http.ResponseWriter, r *http.Request)

HealthHandler for health requests

func (*HandlersTLS) LogHandler

func (h *HandlersTLS) LogHandler(w http.ResponseWriter, r *http.Request)

LogHandler - Function to handle the log requests from osquery nodes, both status and results

func (*HandlersTLS) ProcessCarveBlock

func (h *HandlersTLS) ProcessCarveBlock(req types.CarveBlockRequest, environment, uuid string, envid uint)

ProcessCarveBlock - Function to process one block from a file carve FIXME it can be more efficient on db access

func (*HandlersTLS) ProcessCarveInit

func (h *HandlersTLS) ProcessCarveInit(req types.CarveInitRequest, sessionid, environment string) error

ProcessCarveInit - Function to initialize a file carve from a node

func (*HandlersTLS) ProcessCarveWrite

func (h *HandlersTLS) ProcessCarveWrite(req types.QueryCarveScheduled, queryName, nodeKey, environment string) error

ProcessCarveWrite - Function to process the scheduling of file carves from a node

func (*HandlersTLS) PrometheusMiddleware

func (h *HandlersTLS) PrometheusMiddleware(next http.Handler) http.Handler

func (*HandlersTLS) QueryReadHandler

func (h *HandlersTLS) QueryReadHandler(w http.ResponseWriter, r *http.Request)

QueryReadHandler - Function to handle on-demand queries to osquery nodes

func (*HandlersTLS) QueryWriteHandler

func (h *HandlersTLS) QueryWriteHandler(w http.ResponseWriter, r *http.Request)

QueryWriteHandler - Function to handle distributed query results from osquery nodes

func (*HandlersTLS) QuickEnrollHandler

func (h *HandlersTLS) QuickEnrollHandler(w http.ResponseWriter, r *http.Request)

QuickEnrollHandler - Function to handle the endpoint for quick enrollment script distribution

func (*HandlersTLS) QuickRemoveHandler

func (h *HandlersTLS) QuickRemoveHandler(w http.ResponseWriter, r *http.Request)

QuickRemoveHandler - Function to handle the endpoint for quick removal script

func (*HandlersTLS) RootHandler

func (h *HandlersTLS) RootHandler(w http.ResponseWriter, r *http.Request)

RootHandler to be used as health check

func (*HandlersTLS) ScriptHandler

func (h *HandlersTLS) ScriptHandler(w http.ResponseWriter, r *http.Request)

ScriptHandler - Function to retrieve enroll/remove script for osquery nodes, from osctrld

func (*HandlersTLS) VerifyHandler

func (h *HandlersTLS) VerifyHandler(w http.ResponseWriter, r *http.Request)

VerifyHandler - Function to verify status of enrolled osquery nodes, from osctrld

type Option

type Option func(*HandlersTLS)

Option to pass to creator

func WithCarves

func WithCarves(carves *carves.Carves) Option

WithCarves to pass value as option

func WithDebugHTTP added in v0.4.5

func WithDebugHTTP(cfg *config.DebugHTTPConfiguration) Option

func WithEnvs

func WithEnvs(envs *environments.EnvManager) Option

WithEnvs to pass value as option

func WithEnvsMap

func WithEnvsMap(envsmap *environments.MapEnvironments) Option

WithEnvsMap to pass value as option

func WithLogs

func WithLogs(logs *logging.LoggerTLS) Option

WithLogs to pass value as option

func WithNodes

func WithNodes(nodes *nodes.NodeManager) Option

WithNodes to pass value as option

func WithOsqueryValues added in v0.4.7

func WithOsqueryValues(values *config.OsqueryConfiguration) Option

WithOsqueryValues to pass osquery configuration values

func WithQueries

func WithQueries(queries *queries.Queries) Option

WithQueries to pass value as option

func WithSettings

func WithSettings(settings *settings.Settings) Option

WithSettings to pass value as option

func WithSettingsMap

func WithSettingsMap(settingsmap *settings.MapSettings) Option

WithSettingsMap to pass value as option

func WithTags

func WithTags(tags *tags.TagManager) Option

WithTags to pass value as option

func WithWriteHandler added in v0.4.4

func WithWriteHandler(writeHandler *batchWriter) Option

WithWriteHandler to pass value as option

type TLSResponse

type TLSResponse struct {
	Message string `json:"message"`
}

TLSResponse to be returned to requests

Jump to

Keyboard shortcuts

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