Logo

index : blog

---

  • summary
  • about
  • tree
  • log
  • branches
<< path: root/public/blog.git/html/src/search/sec_landlock.jai blob: 67e7c742c5b22fece3fff862e0d80d457f95a37c [raw] [clear marker]

        
0
1
2
3sec_landlock_init :: () {
4 #if !LANDLOCK_ENABLED {
5 log_error("LANDLOCK IS DISABLED!");
6 if !is_dev_machine() then exit(99);
7 return;
8 }
9
10 new_context := context;
11 new_context.logger = my_logger;
12
13 push_context,defer_pop new_context;
14
15 version := landlock_is_version_equal_or_higher(DESIRED_VERSION, true);
16 if !version {
17 log_error("Warning: Your version of landlock is too old.");
18 }
19
20 rules := landlock_all_rules();
21 ok, ll_fd := landlock_create_ruleset(*rules);
22 if !ok exit(1);
23
24 ok = landlock_lock_privileges();
25 if !ok exit(1);
26
27 ok = landlock_restrict_self(ll_fd);
28 if !ok exit(1);
29
30 log("is armed.");
31}
32
33
34#scope_file
35
36
37DESIRED_VERSION :: 7;
38
39
40my_logger :: #bake_arguments base_logger(prefix="Landlock");
41
42
Copyright 2026  E766CB298A6D1E64 | Git-Thing heavily inspired by cgit