Documentation
¶
Overview ¶
Package engine compiles a feed's rules into what the sensor can run, and reports, per rule, whether it compiled. That report is the whole basis for the console calling a rule "protecting": a rule this package could not compile, or has no engine for, is never shown as running.
Engines:
MODSECURITY and the generated virtual patches in that format run on Coraza, in detection-only mode: Coraza says which rule matched and the verdict engine decides what to do about it.
REGEX_L7 runs on Go's RE2. A pattern that needs PCRE (lookaround, backreferences) is rejected with that reason rather than approximated.
STIX and OpenIOC become sets of domains, IP addresses and file hashes for the egress proxy, the DNS check and the file scan. So does IOC_LIST, the line-per-indicator list the site serves for catalog: and org: feeds (ioc.go addList).
SIGMA rules for process_creation run against process starts (sigma.go).
YARA rules in the subset yara.go evaluates run against the binary of each process start.
Snort, Suricata, AWS WAF, Cloudflare and nginx rules are loaded as no-engine: this sensor build cannot run them, and says so.
Index ¶
Constants ¶
const ( Compiled = "compiled" Rejected = "rejected" NoEngine = "no-engine" )
Load statuses, as the runtime API names them.
const MaxYaraFile = 64 << 20
MaxYaraFile bounds a file the sensor evaluates YARA rules against.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IOCSet ¶
type IOCSet struct {
Domains map[string]decide.RuleRef
IPs map[string]decide.RuleRef
Hashes map[string]decide.RuleRef
}
IOCSet is the indicators the sensor can check without a rule engine: a domain someone resolves or connects to, an address someone connects to, a file hash on disk. Each indicator remembers the rule it came from, so a hit is reported against that rule.
type Process ¶
type Process struct {
Image string
CommandLine string
ParentImage string
ParentCommandLine string
CurrentDirectory string
User string
}
Process is the event a Sigma rule is evaluated against.
type Set ¶
type Set struct {
IOC IOCSet
// contains filtered or unexported fields
}
Set is everything compiled from one or more feeds.
func (*Set) HasFileRules ¶
HasFileRules reports whether any YARA rule is loaded.
func (*Set) HasProcessRules ¶
HasProcessRules reports whether anything checks process starts.
func (*Set) InspectRequest ¶
InspectRequest runs the HTTP engines over one request. body is what was buffered of it, possibly cut short.
func (*Set) MatchProcess ¶
MatchProcess evaluates the Sigma rules against one process start.