You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
k3s/pkg/agent/containerd/selinux.go

28 lines
463 B

5 years ago
package containerd
import (
"github.com/opencontainers/selinux/go-selinux"
)
const (
SELinuxContextType = "container_runtime_t"
)
func selinuxStatus() (bool, bool, error) {
5 years ago
if !selinux.GetEnabled() {
return false, false, nil
5 years ago
}
label, err := selinux.CurrentLabel()
if err != nil {
return true, false, err
5 years ago
}
ctx, err := selinux.NewContext(label)
if err != nil {
return true, false, err
5 years ago
}
return true, ctx["type"] == SELinuxContextType, nil
5 years ago
}