handlers

package module
v0.0.0-...-94ec48a Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter) *responseWriter

func RegisterMetrics

func RegisterMetrics(reg prometheus.Registerer)

Types

type HandlersTLS

type HandlersTLS struct {
	Envs        *environments.Environment
	EnvsMap     *environments.MapEnvironments
	Nodes       *nodes.NodeManager
	Tags        *tags.TagManager
	Queries     *queries.Queries
	Carves      *carves.Carves
	Settings    *settings.Settings
	SettingsMap *settings.MapSettings
	Metrics     *metrics.Metrics
	Logs        *logging.LoggerTLS
}

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) Inc

func (h *HandlersTLS) Inc(name string)

Inc - Helper to send metrics if it is enabled

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 WithEnvs

func WithEnvs(envs *environments.Environment) 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 WithMetrics

func WithMetrics(metrics *metrics.Metrics) Option

WithMetrics to pass value as option

func WithNodes

func WithNodes(nodes *nodes.NodeManager) Option

WithNodes to pass value as option

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

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
JackTT - Gopher 🇻🇳