is_selinux_enabled(3)

πŸ“¦
version 3.11 Β· 3 versions
, in alpine 3.24, centos-stream 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

✨ NAME ✨

okay so bestie, welcome to the SELinux API documentation corner of the man pages πŸ’– today we're talking about is_selinux_enabled β€” the little function that checks whether SELinux is enabled 🫢

  • is_selinux_enabled β€” check whether SELinux is enabled

✨ NAME ✨

and like, there's a second one too because of course there is πŸ’…

  • is_selinux_mls_enabled β€” check whether SELinux is enabled for (Multi Level Security) MLS

🌸 SYNOPSIS 🌸

here's the vibe, copy it exactly bestie:

#include <selinux/selinux.h>

int is_selinux_enabled(void);

int is_selinux_mls_enabled(void);

πŸ¦‹ DESCRIPTION πŸ¦‹

so is_selinux_enabled() is giving very simple main character energy: it returns 1 if SELinux is running, or 0 if it is not. that's it. that's the whole thing. periodt ✨

and is_selinux_mls_enabled()? it returns 1 if SELinux is capable of running in MLS mode, or 0 if it is not. no cap. πŸŽ€

lowkey important side quest: if you actually wanna figure out the policy in use on the system, use selinux_getpolicytype(3) instead πŸ‘‘ don't come for this function for that, it's not its job.

🌈 SEE ALSO 🌈


and that's a wrap, my love πŸ’œ this little page was brought to you by russell@coker.com.au, dated 7 Mar 2010, and it's the is_selinux_enabled(3) page from the SELinux API documentation β€” slay, go check your SELinux status bestie πŸ’…βœ¨