Documentation
¶
Overview ¶
Package agent runs the sensor: it loads rules from the feeds, registers with what compiled, serves the proxies, ships events and applies decisions.
Losing the platform does not stop the sensor. Rules already compiled keep running, decisions already applied keep applying, and events wait in a bounded queue until the uplink answers again. If the queue fills, the oldest events are dropped and the count is reported with the next batch, so a gap is visible rather than silent.
Index ¶
- func ToDecision(d uplink.Decision) decide.Decision
- type Agent
- func (a *Agent) Enqueue(e uplink.Event)
- func (a *Agent) Flush(ctx context.Context)
- func (a *Agent) RefreshRules(ctx context.Context) []uplink.RuleLoad
- func (a *Agent) ReportHostChecks(now time.Time) int
- func (a *Agent) ReportInventory(ctx context.Context) error
- func (a *Agent) Run(ctx context.Context) error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Agent ¶
type Agent struct {
Verdicts *decide.Engine
Rules *proxy.Rules
// contains filtered or unexported fields
}
Agent is a running sensor.
func (*Agent) Flush ¶
Flush posts the queue in batches of 500. A batch that fails goes back to the front of the queue.
func (*Agent) RefreshRules ¶
RefreshRules fetches every feed and, when any changed, compiles and installs the merged rule set. It returns the rule loads to report, or nil when nothing changed or nothing could be fetched.
func (*Agent) ReportHostChecks ¶ added in v3.143.0
ReportHostChecks reads the host's configuration and queues each failing check as an event in the cis lane. The event key includes the day, so a failure that persists is reported once a day, and one that is fixed stops.
func (*Agent) ReportInventory ¶ added in v3.142.0
ReportInventory reads which installed packages processes map and posts it.
type Config ¶
type Config struct {
SensorKey string
Version string
Mode decide.Mode
Hold time.Duration
Facts host.Facts
Feeds []*feed.Source
Uplink *uplink.Client
// Reverse is nil when the sensor does not front a port; Egress is nil
// when it does not proxy outbound calls.
Reverse *proxy.Reverse
ReverseListen string
Egress *proxy.Egress
EgressListen string
// DNSListen is the UDP address the DNS guard answers on, forwarding to
// DNSUpstream. Empty leaves DNS alone.
DNSListen string
DNSUpstream string
// TetragonExport is Tetragon's JSON export file. When set, every process
// start is checked against the feeds' file-hash indicators.
TetragonExport string
// HostRoot is where the host's filesystem is visible to the sensor, for
// hashing what a process ran: "/" on the host, or a mount in a container.
HostRoot string
// InventoryEvery is how often the in-use package inventory is read from
// HostRoot/proc and reported. Zero turns it off.
InventoryEvery time.Duration
FeedEvery time.Duration
HeartbeatEvery time.Duration
FlushEvery time.Duration
QueueLimit int
Logf func(string, ...any)
}
Config is how the sensor is run.