Skip to content

go: expose rulesets - #392

Open
nicholasberlin wants to merge 1 commit into
mainfrom
go-rulesets
Open

go: expose rulesets#392
nicholasberlin wants to merge 1 commit into
mainfrom
go-rulesets

Conversation

@nicholasberlin

Copy link
Copy Markdown
Contributor

Split out of #386; this carries only the rule DSL exposure.

QueueAttr.RuleText installs a ruleset on the queue. It's parsed with quark_ruleset_parse() inside OpenQueue() — before any privileged operation, so parse errors surface without root — via an fmemopen shim borrowed from quark-test's ruleset_from_string1(). The C ruleset is owned by the Queue and released on Close() (the queue only borrows the pointer). Processes matched by poison rules carry the tag in the new Process.PoisonTag (set unconditionally, zero = no match, same semantics as quark_process.poison_tag). Until now the DSL — including file.exec_change — was unusable from Go.

Tests: TestRuleText covers parse success/failure without root; TestQuark gains RulePoison, a Go port of t_rule_poison (poison children by ppid, pass only poisoned, drop the rest — every surviving event must carry the tag). RulePoison uses /bin/true rather than /bin/echo so it also runs in the initramfs VM.

Code identical to #386, where the full Go suite passed as root on real hardware and under krun; gofmt, go vet and a test-binary link re-checked here.

Note: the go/quark PRs split out of #372/#386 each append a CHANGES bullet, so whichever merges later needs a trivial rebase.

QueueAttr.RuleText installs a ruleset on the queue. It's parsed with
quark_ruleset_parse() inside OpenQueue() -- before any privileged
operation, so parse errors surface without root -- via an fmemopen
shim borrowed from quark-test's ruleset_from_string1(). The C ruleset
is owned by the Queue and released on Close(). Processes matched by
poison rules carry the tag in the new Process.PoisonTag.

TestRuleText covers parse success/failure without root; TestQuark
gains RulePoison, a Go port of t_rule_poison.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant