Documentation ¶
Index ¶
- Constants
- func FilterScopeAlreadyExists(scope *FilterScope, id int) error
- func FilterScopeNilError() error
- func FilterScopeNotFoundError(idx int) error
- func FilterScopesMaxExceededError() error
- func FilterScopesOutOfRangeError(idx int) error
- func FindingToEvent(f detect.Finding) (*trace.Event, error)
- func GetCaptureEventsList(cfg Config) map[events.ID]eventConfig
- func GetEssentialEventsList() map[events.ID]eventConfig
- func LoadKallsymsValues(ksymsTable helpers.KernelSymbolTable, ksymbols []string) map[string]*helpers.KernelSymbol
- func MergeErrors(cs ...<-chan error) <-chan error
- func SendKsymbolsToMap(bpfKsymsMap *libbpfgo.BPFMap, ksymbols map[string]*helpers.KernelSymbol) error
- func ValidateKsymbolsTable(ksyms helpers.KernelSymbolTable) bool
- type BPFLog
- func (b BPFLog) CPU() uint32
- func (b BPFLog) Count() uint32
- func (b *BPFLog) Decode(rawBuffer []byte) error
- func (b BPFLog) Error() string
- func (b BPFLog) File() []byte
- func (b BPFLog) FileAsString() string
- func (b BPFLog) ID() uint32
- func (b BPFLog) Line() uint32
- func (b BPFLog) LogLevel() logger.Level
- func (b BPFLog) Return() int64
- func (b BPFLog) Size() int
- func (b BPFLog) Type() BPFLogType
- type BPFLogType
- type CapabilitiesConfig
- type CaptureConfig
- type Config
- type FilterScope
- type FilterScopes
- func (fs *FilterScopes) Add(scope *FilterScope) error
- func (fs FilterScopes) ContainerFilterEnabled() uint64
- func (fs FilterScopes) Count() int
- func (fs *FilterScopes) Delete(id int) error
- func (fs FilterScopes) Lookup(id int) (*FilterScope, error)
- func (fs FilterScopes) Map() map[*FilterScope]int
- func (fs FilterScopes) PIDFilterMax() uint64
- func (fs FilterScopes) PIDFilterMin() uint64
- func (fs FilterScopes) PIDFilterableInUserSpace() bool
- func (fs *FilterScopes) Set(id int, scope *FilterScope) error
- func (fs FilterScopes) UIDFilterMax() uint64
- func (fs FilterScopes) UIDFilterMin() uint64
- func (fs FilterScopes) UIDFilterableInUserSpace() bool
- func (fs FilterScopes) UserSpaceMap() map[*FilterScope]int
- type InitValues
- type OutputConfig
- type Tracee
- func (t *Tracee) Close()
- func (t *Tracee) GetTailCalls() ([]events.TailCall, error)
- func (t *Tracee) Init() error
- func (t *Tracee) NewKernelSymbols() error
- func (t *Tracee) RegisterEventDerivation(deriveFrom events.ID, deriveTo events.ID, deriveCondition func() bool, ...) error
- func (t *Tracee) RegisterEventProcessor(id events.ID, proc func(evt *trace.Event) error) error
- func (t *Tracee) Run(ctx gocontext.Context) error
- func (t *Tracee) Running() bool
- func (t *Tracee) Stats() *metrics.Stats
- func (t *Tracee) UpdateBPFKsymbolsMap() error
- func (t *Tracee) UpdateKallsyms() error
- func (t *Tracee) UpdateKernelSymbols() error
- func (t *Tracee) WaitForPipeline(errs ...<-chan error) error
Constants ¶
const ( Iterate )
const ( UIDFilterMap = "uid_filter" PIDFilterMap = "pid_filter" MntNSFilterMap = "mnt_ns_filter" PidNSFilterMap = "pid_ns_filter" UTSFilterMap = "uts_ns_filter" CommFilterMap = "comm_filter" ProcessTreeFilterMap = "process_tree_map" CgroupIdFilterMap = "cgroup_id_filter" ContIdFilter = "cont_id_filter" BinaryFilterMap = "binary_filter" ProcInfoMap = "proc_info_map" )
const BPFMaxLogFileLen = 72 // BPF_MAX_LOG_FILE_LEN
const MaxFilterScopes = 64
Variables ¶
This section is empty.
Functions ¶
func FilterScopeAlreadyExists ¶ added in v0.11.0
func FilterScopeAlreadyExists(scope *FilterScope, id int) error
func FilterScopeNilError ¶ added in v0.11.0
func FilterScopeNilError() error
func FilterScopeNotFoundError ¶ added in v0.11.0
func FilterScopesMaxExceededError ¶ added in v0.11.0
func FilterScopesMaxExceededError() error
func FilterScopesOutOfRangeError ¶ added in v0.11.0
func FindingToEvent ¶ added in v0.10.0
FindingToEvent converts a detect.Finding into a trace.Event This is used because the pipeline expects trace.Event, but the rule engine returns detect.Finding
func GetCaptureEventsList ¶ added in v0.8.0
GetCaptureEventsList sets events used to capture data
func GetEssentialEventsList ¶ added in v0.8.0
GetEssentialEventsList sets the default events used by tracee
func LoadKallsymsValues ¶ added in v0.11.0
func LoadKallsymsValues(ksymsTable helpers.KernelSymbolTable, ksymbols []string) map[string]*helpers.KernelSymbol
func MergeErrors ¶
MergeErrors merges multiple channels of errors. Based on https://blog.golang.org/pipelines.
func SendKsymbolsToMap ¶ added in v0.11.0
func ValidateKsymbolsTable ¶ added in v0.11.0
func ValidateKsymbolsTable(ksyms helpers.KernelSymbolTable) bool
ValidateKsymbolsTable checks if the addresses in the table are valid by checking a specific symbol address. The reason for the addresses to be invalid is if the capabilities required to read the kallsyms file are not given. The chosen symbol used here is "security_file_open" because it is a must-have symbol for tracee to run.
Types ¶
type BPFLog ¶ added in v0.11.0
type BPFLog struct {
// contains filtered or unexported fields
}
BPFLog struct contains aggregated data about a bpf log origin
func (BPFLog) FileAsString ¶ added in v0.11.0
func (BPFLog) Type ¶ added in v0.11.0
func (b BPFLog) Type() BPFLogType
type BPFLogType ¶ added in v0.11.0
type BPFLogType uint32
const ( BPFLogIDUnspec BPFLogType = iota // BPF_LOG_ID_UNSPEC // tracee functions BPFLogIDInitContext // BPF_LOG_ID_INIT_CONTEXT // bpf helpers functions BPFLogIDMapLookupElem // BPF_LOG_ID_MAP_LOOKUP_ELEM BPFLogIDMapUpdateElem // BPF_LOG_ID_MAP_UPDATE_ELEM BPFLogIDMapDeleteElem // BPF_LOG_ID_MAP_DELETE_ELEM BPFLogIDGetCurrentComm // BPF_LOG_ID_GET_CURRENT_COMM BPFLogIDTailCall // BPF_LOG_ID_TAIL_CALL BPFLogIDMemRead // BPF_LOG_ID_MEM_READ )
func (BPFLogType) String ¶ added in v0.11.0
func (b BPFLogType) String() string
type CapabilitiesConfig ¶ added in v0.9.0
type CaptureConfig ¶
type Config ¶
type Config struct { FilterScopes *FilterScopes Capture *CaptureConfig Capabilities *CapabilitiesConfig Output *OutputConfig Cache queue.CacheConfig PerfBufferSize int BlobPerfBufferSize int BTFObjPath string BPFObjPath string BPFObjBytes []byte KernelConfig *helpers.KernelConfig ChanEvents chan trace.Event OSInfo *helpers.OSInfo Sockets runtime.Sockets ContainersEnrich bool EngineConfig engine.Config // contains filtered or unexported fields }
Config is a struct containing user defined configuration of tracee
type FilterScope ¶ added in v0.11.0
type FilterScope struct { ID int EventsToTrace map[events.ID]string UIDFilter *filters.BPFUIntFilter[uint32] PIDFilter *filters.BPFUIntFilter[uint32] NewPidFilter *filters.BoolFilter MntNSFilter *filters.BPFUIntFilter[uint64] PidNSFilter *filters.BPFUIntFilter[uint64] UTSFilter *filters.BPFStringFilter CommFilter *filters.BPFStringFilter ContFilter *filters.BoolFilter NewContFilter *filters.BoolFilter ContIDFilter *filters.ContainerFilter RetFilter *filters.RetFilter ArgFilter *filters.ArgFilter ContextFilter *filters.ContextFilter ProcessTreeFilter *filters.ProcessTreeFilter BinaryFilter *filters.BPFBinaryFilter Follow bool }
func NewFilterScope ¶ added in v0.11.0
func NewFilterScope() *FilterScope
func (FilterScope) ContainerFilterEnabled ¶ added in v0.11.0
func (fs FilterScope) ContainerFilterEnabled() bool
ContainerFilterEnabled returns true when the scope has at least one container filter type enabled
type FilterScopes ¶ added in v0.11.0
type FilterScopes struct {
// contains filtered or unexported fields
}
TODO: add locking mechanism as scopes will change at runtime
func NewFilterScopes ¶ added in v0.11.0
func NewFilterScopes() *FilterScopes
func (*FilterScopes) Add ¶ added in v0.11.0
func (fs *FilterScopes) Add(scope *FilterScope) error
Add adds a scope to FilterScopes. Its ID (index) is set to the first room found. Returns nil if scope is already inserted.
func (FilterScopes) ContainerFilterEnabled ¶ added in v0.11.0
func (fs FilterScopes) ContainerFilterEnabled() uint64
ContainerFilterEnabled returns a bitmask of scopes that have at least one container filter type enabled
func (FilterScopes) Count ¶ added in v0.11.0
func (fs FilterScopes) Count() int
func (*FilterScopes) Delete ¶ added in v0.11.0
func (fs *FilterScopes) Delete(id int) error
Delete deletes a scope from FilterScopes.
func (FilterScopes) Lookup ¶ added in v0.11.0
func (fs FilterScopes) Lookup(id int) (*FilterScope, error)
func (FilterScopes) Map ¶ added in v0.11.0
func (fs FilterScopes) Map() map[*FilterScope]int
func (FilterScopes) PIDFilterMax ¶ added in v0.11.0
func (fs FilterScopes) PIDFilterMax() uint64
func (FilterScopes) PIDFilterMin ¶ added in v0.11.0
func (fs FilterScopes) PIDFilterMin() uint64
func (FilterScopes) PIDFilterableInUserSpace ¶ added in v0.11.0
func (fs FilterScopes) PIDFilterableInUserSpace() bool
func (*FilterScopes) Set ¶ added in v0.11.0
func (fs *FilterScopes) Set(id int, scope *FilterScope) error
func (FilterScopes) UIDFilterMax ¶ added in v0.11.0
func (fs FilterScopes) UIDFilterMax() uint64
func (FilterScopes) UIDFilterMin ¶ added in v0.11.0
func (fs FilterScopes) UIDFilterMin() uint64
func (FilterScopes) UIDFilterableInUserSpace ¶ added in v0.11.0
func (fs FilterScopes) UIDFilterableInUserSpace() bool
func (FilterScopes) UserSpaceMap ¶ added in v0.11.0
func (fs FilterScopes) UserSpaceMap() map[*FilterScope]int
UserSpaceMap returns a reduced scopes map which must be filtered in user space (ArgFilter, RetFilter, ContextFilter, UIDFilter and PIDFilter).
type InitValues ¶ added in v0.8.1
type InitValues struct {
// contains filtered or unexported fields
}
InitValues determines if to initialize values that might be needed by eBPF programs
type OutputConfig ¶
type Tracee ¶
type Tracee struct { StackAddressesMap *bpf.BPFMap FDArgPathMap *bpf.BPFMap // contains filtered or unexported fields }
Tracee traces system calls and system events using eBPF
func New ¶
New creates a new Tracee instance based on a given valid Config It is expected that New will not cause external system side effects (reads, writes, etc.)
func (*Tracee) GetTailCalls ¶ added in v0.8.3
func (*Tracee) Init ¶ added in v0.8.1
Init initialize tracee instance and it's various subsystems, potentially performing external system operations to initialize them. NOTE: any initialization logic, especially one that causes side effects, should go here and not New().
func (*Tracee) NewKernelSymbols ¶ added in v0.11.0
func (*Tracee) RegisterEventDerivation ¶ added in v0.11.0
func (t *Tracee) RegisterEventDerivation(deriveFrom events.ID, deriveTo events.ID, deriveCondition func() bool, deriveLogic derive.DeriveFunction) error
RegisterEventDerivation registers an event derivation handler for tracee to use in the event pipeline
func (*Tracee) RegisterEventProcessor ¶ added in v0.11.0
RegisterEventProcessor registers a pipeline processing handler for an event
func (*Tracee) UpdateBPFKsymbolsMap ¶ added in v0.11.0
func (*Tracee) UpdateKallsyms ¶ added in v0.11.0
func (*Tracee) UpdateKernelSymbols ¶ added in v0.11.0
func (*Tracee) WaitForPipeline ¶
WaitForPipeline waits for results from all error channels.