Debian Codegraph @

docs/rule_libraries.md

raw
1 # Rule libraries
2
3 With Landlock's *composite rules*, you can build reusable libraries of
4 Landlock rules, without having to resort to custom list appending.
5
6 An example is:
7
8 ```
9 // DNSLookup bundles the Landlock rules required for basic DNS lookup.
10 func DNSLookup() landlock.Rule {
11 return landlock.CompositeRule(
12 landlock.RODirs("/etc"),
13 landlock.ConnectTCP(53),
14 )
15 }
16 ```
17
18 Noteworthy special case: The empty composite rule
19 `landlock.CompositeRule()` is a no-op rule which adds no actual rule
20 to the Landlock ruleset at the C API layer.