fix: selinux detection

Fix SELinux detection.

Fixes: #10965

Signed-off-by: Noel Georgi <git@frezbo.dev>
This commit is contained in:
Noel Georgi 2025-05-14 19:12:23 +05:30
parent 52c76ea3a6
commit ea5de19fad
No known key found for this signature in database
GPG Key ID: 21A9F444075C9E36

View File

@ -34,7 +34,13 @@ var IsEnabled = sync.OnceValue(func() bool {
val := procfs.ProcCmdline().Get(constants.KernelParamSELinux).First()
return val != nil && *val == "1"
var selinuxFSPresent bool
if _, err := os.Stat("/sys/fs/selinux"); err == nil {
selinuxFSPresent = true
}
return val != nil && *val == "1" && selinuxFSPresent
})
// IsEnforcing checks if SELinux is enabled and the mode should be enforcing.