launcher

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: BSD-3-Clause Imports: 12 Imported by: 8

Documentation

Overview

Package launcher boots the target kernel.

Index

Constants

This section is empty.

Variables

View Source
var ErrBootNotSelected = errors.New("boot entry not yet selected")

ErrBootNotSelected means a boot was not selected and it must be

Functions

func IsInitrdSet added in v0.15.0

func IsInitrdSet() bool

IsInitrdSet returns whether an initrd has been set or not.

func IsValidBootEntry added in v0.15.0

func IsValidBootEntry(entry string) bool

IsValidBootEntry validates that the provided string compiles to the rules for boot entries. Specifically, this means all alphanumeric characters, plus '-', '_', and '.'.

func MatchBootEntry added in v0.15.0

func MatchBootEntry(entryName string, bootEntries map[string]BootEntry) error

MatchBootEntry tries to match the given name to a boot entry. If successful, the kernel and initrd files are read and the command-line is returned.

func MeasureInitrd added in v0.15.0

func MeasureInitrd() error

MeasureInitrd hashes the initrd and extends the measurement into a TPM PCR.

func MeasureKernel added in v0.15.0

func MeasureKernel() error

MeasureKernel hashes the kernel and extends the measurement into a TPM PCR.

Types

type BootEntry added in v0.15.0

type BootEntry struct {
	KernelName  string `json:"kernel name"`
	KernelHash  string `json:"kernel hash"`
	KernelBytes []byte
	InitrdName  string `json:"initrd name"`
	InitrdHash  string `json:"initrd hash"`
	InitrdBytes []byte
	Cmdline     string `json:"cmdline"`
}

BootEntry holds the names and hashes for a kernel and initrd and the command line to use.

type Launcher

type Launcher struct {
	Type        string               `json:"type"`
	BootEntries map[string]BootEntry `json:"boot entries"`
}

Launcher describes the "launcher" section of policy file.

func (*Launcher) Boot

func (l *Launcher) Boot() error

Boot boots the target kernel based on information provided in the "launcher" section of the policy file.

Summary of steps: - extract the kernel, initrd and cmdline from the "launcher" section of policy file. - measure the kernel and initrd file into the tpmDev (tpm device). - mount the disks where the kernel and initrd file are located. - kexec to boot into the target kernel.

returns error - if measurement of kernel and initrd fails - if mount fails - if kexec fails

Jump to

Keyboard shortcuts

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