Documentation
¶
Overview ¶
Package launcher boots the target kernel.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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
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
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 ¶
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