selinux

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEnabled

func IsEnabled() (bool, error)

IsEnabled checks whether SELinux is enabled

func IsEnforcing

func IsEnforcing() (bool, error)

IsEnabled checks whether SELinux is in enforcing mode

func MockIsEnabled

func MockIsEnabled(isEnabled func() (bool, error)) (restore func())

MockIsEnabled makes the system believe a certain SELinux state is currently true

func MockIsEnforcing

func MockIsEnforcing(isEnforcing func() (bool, error)) (restore func())

MockIsEnforcing makes the system believe the current SELinux is currently enforcing

func RestoreContext

func RestoreContext(aPath string, mode RestoreMode) error

RestoreContext restores the default SELinux context of given path

func SnapMountContext

func SnapMountContext() string

SnapMountContext finds out the right context for mounting snaps

func Summary

func Summary() string

Summary describes SELinux status

func VerifyPathContext

func VerifyPathContext(aPath string) (bool, error)

VerifyPathContext checks whether a given path is labeled according to its default SELinux context

Types

type LevelType

type LevelType int

LevelType encodes the state of SELinux support found on this system.

const (
	// SELinux is not supported
	Unsupported LevelType = iota
	// SELinux is supported and in permissive mode
	Permissive
	// SELinux is supported and in enforcing mode
	Enforcing
)

func ProbedLevel

func ProbedLevel() LevelType

ProbedLevel tells what level of SELinux enforcement is currently used

func Status

func Status() (level LevelType, summary string)

Status returns the current level of SELinux support and a descriptive summary

type RestoreMode

type RestoreMode struct {
	// Recursive indicates whether the default context shall be restored
	// recursively
	Recursive bool
}

RestoreMode configures how default path context is restored

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL