release

package
v2.42.5-go-mod+incompa... Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OnClassic bool

OnClassic states whether the process is running inside a classic Ubuntu system or a native Ubuntu Core image.

View Source
var OnWSL bool

OnWSL states whether the process is running inside the Windows Subsystem for Linux

View Source
var Series = "16"

Series holds the Ubuntu Core series for snapd to use.

Functions

func AppArmorKernelFeatures

func AppArmorKernelFeatures() ([]string, error)

AppArmorKernelFeatures returns a sorted list of apparmor features like []string{"dbus", "network"}. The result is cached internally.

func AppArmorParserFeatures

func AppArmorParserFeatures() ([]string, error)

AppArmorParserFeatures returns a sorted list of apparmor parser features like []string{"unsafe", ...}. The computation is costly to perform. The result is cached internally.

func AppArmorParserMtime

func AppArmorParserMtime() int64

AppArmorParserMtime returns the mtime of the parser, else 0.

func AppArmorSummary

func AppArmorSummary() string

AppArmorSummary describes how well apparmor is supported on the current kernel. The computation is costly to perform. The result is cached internally.

func DistroLike

func DistroLike(distros ...string) bool

DistroLike checks if the distribution ID or ID_LIKE matches one of the given names.

func MockAppArmorFeatures

func MockAppArmorFeatures(kernelFeatures []string, kernelError error, parserFeatures []string, parserError error) (restore func())

MockAppArmorFeatures makes the system believe it has certain kernel and parser features.

AppArmor level and summary are automatically re-assessed as needed on both the change and the restore process. Use this function to observe real assessment of arbitrary features.

func MockAppArmorLevel

func MockAppArmorLevel(level AppArmorLevelType) (restore func())

MockAppArmorLevel makes the system believe it has certain level of apparmor support.

AppArmor kernel and parser features are set to unrealistic values that do not match the requested level. Use this function to observe behavior that relies solely on the apparmor level value.

func MockForcedDevmode

func MockForcedDevmode(isDevmode bool) (restore func())

MockForcedDevmode fake the system to believe its in a distro that is in ForcedDevmode

func MockOnClassic

func MockOnClassic(onClassic bool) (restore func())

MockOnClassic forces the process to appear inside a classic Ubuntu system or a native image for testing purposes.

func MockReleaseInfo

func MockReleaseInfo(osRelease *OS) (restore func())

MockReleaseInfo fakes a given information to appear in ReleaseInfo, as if it was read /etc/os-release on startup.

func MockSELinuxIsEnabled

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

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

func MockSecCompActions

func MockSecCompActions(actions []string) (restore func())

func SELinuxSummary

func SELinuxSummary() string

SELinuxSummary describes SELinux status

func SecCompActions

func SecCompActions() []string

SecCompActions returns a sorted list of seccomp actions like []string{"allow", "errno", "kill", "log", "trace", "trap"}.

func SecCompSupportsAction

func SecCompSupportsAction(action string) bool

Types

type AppArmorLevelType

type AppArmorLevelType int

AppArmorLevelType encodes the kind of support for apparmor found on this system.

const (
	// UnknownAppArmor indicates that apparmor was not probed yet.
	UnknownAppArmor AppArmorLevelType = iota
	// NoAppArmor indicates that apparmor is not enabled.
	NoAppArmor
	// UnusableAppArmor indicates that apparmor is enabled but cannot be used.
	UnusableAppArmor
	// PartialAppArmor indicates that apparmor is enabled but some
	// features are missing.
	PartialAppArmor
	// FullAppArmor indicates that all features are supported.
	FullAppArmor
)

func AppArmorLevel

func AppArmorLevel() AppArmorLevelType

AppArmorLevel quantifies how well apparmor is supported on the current kernel. The computation is costly to perform. The result is cached internally.

func (AppArmorLevelType) String

func (level AppArmorLevelType) String() string

type OS

type OS struct {
	ID        string   `json:"id"`
	IDLike    []string `json:"-"`
	VersionID string   `json:"version-id,omitempty"`
}

OS contains information about the system extracted from /etc/os-release.

var ReleaseInfo OS

ReleaseInfo contains data loaded from /etc/os-release on startup.

func (*OS) ForceDevMode

func (o *OS) ForceDevMode() bool

ForceDevMode returns true if the distribution doesn't implement required security features for confinement and devmode is forced.

type SELinuxLevelType

type SELinuxLevelType int

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

const (
	// NoSELinux indicates that SELinux is not enabled
	NoSELinux SELinuxLevelType = iota
	// SELinux is supported and in permissive mode
	SELinuxPermissive
	// SELinux is supported and in enforcing mode
	SELinuxEnforcing
)

func SELinuxLevel

func SELinuxLevel() SELinuxLevelType

SELinuxLevel tells what level of SELinux enforcement is currently used

func SELinuxStatus

func SELinuxStatus() (level SELinuxLevelType, summary string)

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

Jump to

Keyboard shortcuts

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