| 1 | package rsynctest |
| 2 | |
| 3 | import ( |
| 4 | "os" |
| 5 | |
| 6 | "github.com/gokrazy/rsync/internal/restrict" |
| 7 | "github.com/landlock-lsm/go-landlock/landlock" |
| 8 | ) |
| 9 | |
| 10 | func init() { |
| 11 | restrict.ExtraHook = func() []landlock.Rule { |
| 12 | return []landlock.Rule{ |
| 13 | // contains /usr/bin/rsync (and library deps) |
| 14 | landlock.RODirs("/usr"), |
| 15 | landlock.RODirs("/nix").IgnoreIfMissing(), |
| 16 | |
| 17 | // for t.TempDir() |
| 18 | landlock.RWDirs(os.TempDir()).WithRefer(), |
| 19 | |
| 20 | // used in some of our test code |
| 21 | landlock.RWFiles("/dev/null"), |
| 22 | } |
| 23 | } |
| 24 | } |