Authoring Rules
Tracee supports authoring rules in Golang) or in Rego (the language of Open Policy Agent).
Rego rules
Create a .rego
file in the rules directory that has the following Rego Rules (in this context rules are Rego's language constructs):
__rego_metadoc__
: A document rule that defines the rule's metadata.tracee_selected_events
: A set rule that defines the event selectors.tracee_match
: A boolean or a document rule that defines the logic of the signature. If bool is "returned", a true evaluation will generate a Finding with no data. If a document is "returned", any non-empty evaluation will generate a Finding with the returned document as the Finding's "Data".
See tracee/tracee-rules/signatures/rego/examples for example Rego signatures.
Golang Rules
Tracee exports a Signature
interface that you can implement. We use Go Plugins to load Go signatures.
- Create a new Go project with a package
main
- Import
github.com/aquasecurity/tracee/tracee-rules/types
and implement thetypes.Signature
interface. - Export a package level variable called
ExportedSignatures
of type[]types.Signature
that declares the implemented signature (or more) that your package exports. - Compile using goplugins
go build -buildmode=plugin -o yourplugin.so yoursource.go
. - Place the resulting compiled file in the rules directory and it will be automatically discovered by Tracee.
See tracee/tracee-rules/signatures/golang/examples for example Go signatures.