Documentation ¶
Overview ¶
Package selinux provides generic code for managing SELinux.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var IsEnabled = sync.OnceValue(func() bool { if _, err := os.Stat("/usr/etc/in-container"); err == nil { return false } val := procfs.ProcCmdline().Get(constants.KernelParamSELinux).First() return val != nil && *val == "1" })
IsEnabled checks if SELinux is enabled on the system by reading the kernel command line. It returns true if SELinux is enabled, otherwise it returns false. It also ensures we're not in a container. By default SELinux is disabled.
View Source
var IsEnforcing = sync.OnceValue(func() bool { if !IsEnabled() { return false } val := procfs.ProcCmdline().Get(constants.KernelParamSELinuxEnforcing).First() return val != nil && *val == "1" })
IsEnforcing checks if SELinux is enabled and the mode should be enforcing. By default if SELinux is enabled we consider it to be permissive.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.