selinux_policy_root(3)

πŸ’– selinux_policy_root(3) πŸ’–

ok so bestie, this one is from the SELinux API documentation and it's literally just two little functions that handle where your SELinux policy files live. no cap. let's get into it πŸ¦‹


✨ NAME ✨

selinux_policy_root β€” return the path of the SELinux policy files for this machine.

selinux_set_policy_root β€” Set an alternate SELinux root path for the SELinux policy files for this machine.


🌸 SYNOPSIS 🌸

#include <selinux/selinux.h>

const char *selinux_policy_root(void);

int selinux_set_policy_root(const char *policypath);

πŸŽ€ DESCRIPTION πŸŽ€

ok so picture this: selinux_policy_root() reads the contents of the /etc/selinux/config file to determine which policy files should be used for this machine. that's it. that's the whole vibe. it's just out here peeking at the config to figure out your machine's policy situation πŸ’…

then you've got selinux_set_policy_root(), which sets up all policy paths based on the alternate root.

and yes, the /etc/selinux/config file is the thing that determines which policy files should be used for this machine. main character energy honestly πŸ‘‘


πŸ‘‘ RETURN VALUE πŸ‘‘

On success, selinux_policy_root returns a directory path containing the SELinux policy files. On failure, selinux_policy_root returns NULL. 😭 (it's giving "no path for you today")

On success, selinux_set_policy_root returns 0 on success, -1 on failure. slay when it works, screaming when it doesn't fr fr πŸ’€


🌈 SEE ALSO 🌈


lowkey the whole thing is just: read the config, get the path, or set your own path. periodt. ✨

and that's the page bestie!! 🫢 written by dwalsh@redhat.com on 25 May 2004 β€” yeah she's an icon from the archives, still serving πŸ’– and this manual page lives at selinux_policy_root(3), go off ⭐

πŸ“¦ where this page comes from