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 signatures/rego 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/typesand implement thetypes.Signatureinterface. - Export a package level variable called
ExportedSignaturesof type[]types.Signaturethat 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 signatures/golang/examples for example Go signatures.