config

package
Version: v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DistroTypeStrings = [...]string{"Ubuntu", "CentOS", "Debian"}

DistroTypeStrings is the string version of enum DistroType

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Name             string
	Type             ArtifactType
	SourcePath       string
	SupportedKernels []KernelMask

	Qemu struct {
		Cpus    int
		Memory  int
		Timeout Duration
	}

	Docker struct {
		Timeout Duration
	}

	Mitigations struct {
		DisableSmep  bool
		DisableSmap  bool
		DisableKaslr bool
		DisableKpti  bool
	}

	Preload []PreloadModule
}

Artifact is for .out-of-tree.toml

func ReadArtifactConfig

func ReadArtifactConfig(path string) (ka Artifact, err error)

ReadArtifactConfig is for read .out-of-tree.toml

func (Artifact) Supported

func (ka Artifact) Supported(ki KernelInfo) (supported bool, err error)

Supported returns true if given kernel is supported by artifact

type ArtifactType

type ArtifactType int

ArtifactType is the kernel module or exploit

const (
	// KernelModule is any kind of kernel module
	KernelModule ArtifactType = iota
	// KernelExploit is the privilege escalation exploit
	KernelExploit
)

func (ArtifactType) MarshalTOML

func (at ArtifactType) MarshalTOML() (data []byte, err error)

MarshalTOML is for support github.com/naoina/toml

func (ArtifactType) String

func (at ArtifactType) String() string

func (*ArtifactType) UnmarshalTOML

func (at *ArtifactType) UnmarshalTOML(data []byte) (err error)

UnmarshalTOML is for support github.com/naoina/toml

type ByRootFS

type ByRootFS []KernelInfo

ByRootFS is sorting by .RootFS lexicographically

func (ByRootFS) Len

func (a ByRootFS) Len() int

func (ByRootFS) Less

func (a ByRootFS) Less(i, j int) bool

func (ByRootFS) Swap

func (a ByRootFS) Swap(i, j int)

type DistroType

type DistroType int

DistroType is enum with all supported distros

const (
	// Ubuntu https://ubuntu.com/
	Ubuntu DistroType = iota
	// CentOS https://www.centos.org/
	CentOS
	// Debian https://www.debian.org/
	Debian
)

func NewDistroType

func NewDistroType(dType string) (dt DistroType, err error)

NewDistroType is create new Distro object

func (DistroType) MarshalTOML

func (dt DistroType) MarshalTOML() (data []byte, err error)

MarshalTOML is for support github.com/naoina/toml

func (DistroType) String

func (dt DistroType) String() string

func (*DistroType) UnmarshalTOML

func (dt *DistroType) UnmarshalTOML(data []byte) (err error)

UnmarshalTOML is for support github.com/naoina/toml

type DockerCommand

type DockerCommand struct {
	DistroType DistroType
	Command    string
}

type Duration

type Duration struct {
	time.Duration
}

Duration type with toml unmarshalling support

func (Duration) MarshalTOML

func (d Duration) MarshalTOML() (data []byte, err error)

MarshalTOML for Duration

func (*Duration) UnmarshalTOML

func (d *Duration) UnmarshalTOML(data []byte) (err error)

UnmarshalTOML for Duration

type KernelConfig

type KernelConfig struct {
	Kernels []KernelInfo
}

KernelConfig is the ~/.out-of-tree/kernels.toml configuration description

func ReadKernelConfig

func ReadKernelConfig(path string) (kernelCfg KernelConfig, err error)

ReadKernelConfig is for read kernels.toml

type KernelInfo

type KernelInfo struct {
	DistroType    DistroType
	DistroRelease string // 18.04/7.4.1708/9.1

	// Must be *exactly* same as in `uname -r`
	KernelRelease string

	// Build-time information
	KernelSource  string // module/exploit will be build on host
	ContainerName string

	// Runtime information
	KernelPath string
	InitrdPath string
	RootFS     string

	// Debug symbols
	VmlinuxPath string
}

KernelInfo defines kernels.toml entries

type KernelMask

type KernelMask struct {
	DistroType    DistroType
	DistroRelease string // 18.04/7.4.1708/9.1
	ReleaseMask   string

	// Overrides ReleaseMask
	Kernel kernel
}

KernelMask defines the kernel

func (KernelMask) DockerName

func (km KernelMask) DockerName() string

DockerName is returns stable name for docker container

type OutOfTree

type OutOfTree struct {
	Kernels     string
	UserKernels string

	Database string

	Qemu struct {
		Timeout string
	}

	Docker struct {
		Timeout  string
		Registry string

		// Commands that will be executed before
		// the base layer of Dockerfile
		Commands []DockerCommand
	}
}

func ReadOutOfTreeConf

func ReadOutOfTreeConf(path string) (c OutOfTree, err error)

type PreloadModule

type PreloadModule struct {
	Repo             string
	Path             string
	TimeoutAfterLoad Duration
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto