Documentation
¶
Overview ¶
Package execwatch reads process starts from Tetragon and checks each new executable against the feeds' file-hash indicators.
Tetragon (Cilium) does the kernel side with eBPF and writes one JSON object per event to its export file (--export-filename, by default /var/run/cilium/tetragon/tetragon.log). Reading that file instead of its gRPC API keeps the sensor free of the gRPC stack, and works the same on a node where Tetragon runs as a DaemonSet or a systemd unit.
This is detection only. A match is reported; the process is not stopped, because stopping it cannot be undone and the sensor does not yet have a kernel hook that refuses the exec before it runs. The sensor reports the capability accordingly, and the console says so.
Index ¶
Constants ¶
const DefaultExport = "/var/run/cilium/tetragon/tetragon.log"
DefaultExport is Tetragon's default export file.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Exec ¶
type Exec struct {
PID int
Binary string
Arguments string
Cwd string
ParentBinary string
ParentArguments string
Pod string
Namespace string
Time time.Time
// PreExec is an exec that has not happened yet (the seccomp guard asks
// before it runs): /proc/<pid>/exe is still the caller, so the binary is
// read from its path.
PreExec bool
// KernelRefused is an exec the Tetragon policy already refused. The
// rules are run again to name the rule, and the event says blocked.
KernelRefused bool
}
Exec is one process start.
type Watcher ¶
type Watcher struct {
// Root is the filesystem binaries are read from: "/" on the host, or the
// host root mounted into the sensor's container.
Root string
Rules func() *engine.Set
Verdicts *decide.Engine
Report func(uplink.Event)
// contains filtered or unexported fields
}
Watcher checks execs against the current rule set.
func (*Watcher) Check ¶
Check runs the process rules over one exec: the feeds' Sigma rules against the start itself, and the file-hash indicators against the binary. Hashing prefers the process's own /proc/<pid>/exe, which is the file that ran even if the path was replaced since, and falls back to the path Tetragon reported.