canonical / canonical/secboot

Move internal/efi.HostEnvironment into a separate sub-package

Open
#388 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
23
Forks
29
Avg merge
2d 8h
Merged PRs (30d)
2

Description

The `efi` sub-package has a public `HostEnvironment` interface for overriding
EFI variables and the TCG log, which is useful both for unit testing and producing
profiles without executing code within the host environment.

To support some cases in `efi/preinstall`, this interface was moved to `internal/efi`
with the originally exported interface now a type alias into an interface from
the internal package. The `internal/efi` package has a more extensive interface
that isn't exposed publicly (and with no intention to for now), but is used
for mocking host system properties during unit testing. However, most of this
extra functionality has nothing to do with EFI, and so `internal/efi` seems like
a weird place for this larger interface. This interface makes it possible to mock
the following things:

- The default TPMDevice.
- Whether the current environment is virtualized.
- Devices and their attributes in sysfs.
- CPU vendor (on amd64 builds)
- cpuid features (on amd64 builds)
- MSR values (on amd64).

None of these are related to EFI, which is why I think this interface and its
default implementation should move to a new package (maybe something
like `internal/system`?)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.