<<
path:
root/public/0x2lib.git/html/tests/landlock.jai
blob: 69647c4b3b9f9ff92a806367b0c0885c0bc126d3
[raw]
[clear marker]
4 hostname_fp :: "/etc/hostname";
5 content, ok := read_entire_file(hostname_fp);
8 log("Pre Landlock: This is your hostname: »%«", content);
9 log("OK returns: %", ok);
10 log("-------------------------------------------------");
13 content, ok = read_entire_file(hostname_fp);
15 log("-------------------------------------------------");
16 log("Post Landlock: You should NOT see your hostname: »%«", content);
17 log("OK returns: %", ok);
19 /** Note: If a FD is already open pre landlock init, you can still use it here! */
29sec_landlock_init :: () {
30 version := landlock_is_version_equal_or_higher(DESIRED_VERSION, true);
32 log("Warning: Your version of landlock is too old.", flags=.WARNING);
35 rules := landlock_all_rules();
36 ok, ll_fd := landlock_create_ruleset(*rules);
39 ok = landlock_lock_privileges();
42 ok = landlock_restrict_self(ll_fd);
45 log("Landlock is armed.");
52#import,file "../0x2_Landlock.jai";