Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
b2dbdbf
add boot transparency support
danbia Dec 9, 2025
d31a7ff
update documentation
danbia Dec 9, 2025
2f42c9d
tyding
danbia Dec 9, 2025
8623013
address PR comments
danbia Dec 10, 2025
bd2b1ed
replace online/offline nomenclature
danbia Dec 10, 2025
40b0cbd
move back transparency code to a dedicated pkg, add btCmd under cmd/a…
danbia Dec 10, 2025
fd40723
tyding
danbia Dec 11, 2025
117a3dc
add to bt validation artifacts hash check
danbia Dec 15, 2025
b2f1ea2
improves godoc and comments
danbia Dec 15, 2025
8602fe6
tyding
danbia Dec 15, 2025
10733ef
fix per-entry path construction
danbia Dec 15, 2025
fa75081
remove uneccessary const type + improve godoc comments
danbia Dec 15, 2025
9169926
tyding
danbia Dec 15, 2025
83de386
uses idiomatic errors where applicable
danbia Dec 15, 2025
6e41fb7
use path.Join to assemble configuration paths
danbia Dec 15, 2025
dca10be
better usage of BtStatus type
danbia Dec 15, 2025
a9b37f2
move configuration loading to transparency.go
danbia Dec 15, 2025
2227596
better code organization in cmd/linux and add configuration methods
danbia Dec 16, 2025
3fca8d7
improves configuration path construction
danbia Dec 17, 2025
13cfbf8
define BootEntry type for better code organization
danbia Dec 17, 2025
ead2d21
tyding
danbia Dec 17, 2025
d293f00
more idiomatic code re-organization
danbia Dec 17, 2025
2afa5f2
more consistent proof hash validation names
danbia Dec 18, 2025
07720d1
fix code repetition in load config
danbia Dec 19, 2025
b7bad2a
add support for external pkg usage
danbia Dec 20, 2025
967e784
automatically detect if operating externally to a UEFI bootloader
danbia Dec 20, 2025
518e7be
tyding
danbia Dec 20, 2025
6f43b79
tyding
danbia Dec 20, 2025
299e394
add protections against invalid hash and root fs
danbia Dec 20, 2025
33f0ce0
add test files for transparency pkg
danbia Dec 20, 2025
a182d68
fix Offline vs Online tests
danbia Dec 21, 2025
ae5685b
returns error if online mode is selected and network is unavailable
danbia Jan 8, 2026
9ea8cae
improve cmd help consistency
danbia Jan 8, 2026
a67ce20
limit returns in the bt config function
danbia Jan 8, 2026
bc17134
documentation tyiding
danbia Jan 8, 2026
b67c30e
moves btValidate function to auth.go
danbia Jan 8, 2026
cc56a74
better usage of const to store test values
danbia Jan 8, 2026
efb36e8
avoid func definition on *BootEntry -> use BootEntry
danbia Jan 8, 2026
6a2fee3
moves entirely btValidate function to auth.go btValidateLinux
danbia Jan 12, 2026
7a0b4ed
tyding
danbia Jan 15, 2026
107027d
function renaming hasValidHash -> validHash
danbia Jan 15, 2026
7697446
makes engine a Config property and align the codebase to the latest b…
danbia Jan 19, 2026
5ead986
improves error messages
danbia Jan 19, 2026
82b9a5b
revert cmd/auth.go
danbia Jan 19, 2026
2146afe
move hash validation function comment
danbia Jan 19, 2026
a79b5a8
fix error detection boot_entry test
danbia Jan 19, 2026
a26554b
updates SetKey to use []byte as argument
danbia Jan 20, 2026
a771b1a
improve comments on config key fields
danbia Jan 20, 2026
a69663b
improve comments and error messages
danbia Jan 20, 2026
bba9774
uses fmt.Errorf instead of errors.New as fmt is already imported
danbia Jan 20, 2026
7f3e20c
more idomatic error check
danbia Jan 20, 2026
03b54ae
improves error checks
danbia Jan 26, 2026
74c8947
change Status code resolution function name Resove -> String
danbia Jan 26, 2026
2e16529
simplifies error message on bt validation
danbia Jan 26, 2026
cccd427
change Hash(*[]byte) (string) -> Sum(b []byte) ([]byte)
danbia Jan 26, 2026
cbc5c14
align test files to Sum()
danbia Jan 26, 2026
a83ab5a
uses artifact.Sum() and artifact.HashSize const from boot-transparenc…
danbia Jan 27, 2026
766688e
moves artifact hash verification to boot-transparency library
danbia Mar 11, 2026
3f6cef2
Merge branch 'development' into boot-transparency
danbia Mar 11, 2026
447c09d
update dependencies
danbia Mar 11, 2026
a9a68ea
replace UEFI specific loading code
danbia Mar 11, 2026
83d80ce
tyding
danbia Mar 12, 2026
775721e
exports PathPrefix to allow configuring the asset store directory
danbia Mar 12, 2026
9d9e1f8
expand testcases
danbia Mar 12, 2026
e5f5144
removes Metadata from BootArtifact until they will be fully supported
danbia Mar 12, 2026
4b86329
exports default path prefix
danbia Mar 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ initializing console (text)
go-boot • tamago/amd64 (go1.24.1) • UEFI x64

. <path> # load and start EFI image
bt (on|off)? (net)? # show/set boot-transparency configuration
bt (none|offline|online)? # show/set boot-transparency status
build # build information
cat <path> # show file contents
clear # clear screen
Expand Down Expand Up @@ -139,9 +139,6 @@ build:
* `NET`: set to either `0` (default) or `1` controls enabling of UEFI
networking support (see _UEFI networking_).

* `TRANSPARENCY`: set either to `0` (default) or `1` controls enabling
support for interacting with transparency ecosystem.

Build the `go-boot.efi` executable:

```
Expand Down
47 changes: 47 additions & 0 deletions cmd/auth.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright (c) The go-boot authors. All Rights Reserved.
//
// Use of this source code is governed by the license
// that can be found in the LICENSE file.

package cmd

import (
"fmt"
"regexp"
"strings"

"github.com/usbarmory/go-boot/shell"
"github.com/usbarmory/go-boot/transparency"
)

func init() {
shell.Add(shell.Cmd{
Name: "bt",
Args: 1,
Pattern: regexp.MustCompile(`^(?:bt)( none| offline| online)?$`),
Syntax: "(none|offline|online)?",
Help: "show/set boot-transparency status",
Fn: btCmd,
})
}

func btCmd(_ *shell.Interface, arg []string) (res string, err error) {
if len(arg[0]) > 0 {
transparency.Config.Status = strings.TrimSpace(arg[0])
}

switch transparency.Config.Status {
case "none":
transparency.CleanupConfig()

return fmt.Sprintf("boot-transparency is disabled\n"), nil
case "offline","online":
if err = transparency.LoadConfig(); err != nil {
return "", err
}

return fmt.Sprintf("boot-transparency is enabled in %s mode\n", transparency.Config.Status), nil
}

return
}
162 changes: 4 additions & 158 deletions cmd/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package cmd
import (
"errors"
"fmt"
"io/fs"
"log"
"regexp"

Expand All @@ -19,11 +18,8 @@ import (
"github.com/usbarmory/go-boot/uapi"
"github.com/usbarmory/go-boot/uefi"
"github.com/usbarmory/go-boot/uefi/x64"
"github.com/usbarmory/go-boot/transparency"
"github.com/usbarmory/tamago/dma"

"github.com/usbarmory/boot-transparency/engine/sigsum"
"github.com/usbarmory/boot-transparency/policy"
"github.com/usbarmory/boot-transparency/transparency"
)

const (
Expand All @@ -37,20 +33,6 @@ const (
// Loader Entry (`linux,l,\\r` command).
var DefaultLinuxEntry string

var btConfig struct {
enabled bool
net bool
}

const (
// boot-transparency paths.
bootPolicyPath = `\transparency\policy.json`
witnessPolicyPath = `\transparency\trust_policy`
proofBundlePath = `\transparency\proof-bundle.json`
submitKeyPath = `\transparency\submit-key.pub`
logKeyPath = `\transparency\log-key.pub`
)

func init() {
shell.Add(shell.Cmd{
Name: "linux,l",
Expand All @@ -70,15 +52,6 @@ func init() {
Fn: linuxCmd,
})
}

shell.Add(shell.Cmd{
Name: "bt",
Args: 2,
Pattern: regexp.MustCompile(`^(?:bt)( on| off)?( net)?$`),
Syntax: "(on|off)? (net)?",
Help: "show/set boot-transparency configuration",
Fn: btCmd,
})
}

func reserveMemory(m *uefi.MemoryMap, image *exec.LinuxImage) (err error) {
Expand Down Expand Up @@ -263,9 +236,9 @@ func linuxCmd(_ *shell.Interface, arg []string) (res string, err error) {
return "", fmt.Errorf("could not open root volume, %v", err)
}

if btConfig.enabled {
if err = btCheck(root, btConfig.net); err != nil {
return "", fmt.Errorf("boot-transparency check failed\n%v", err)
if transparency.Config.Status != "none" {
if err = transparency.Validate(); err != nil {
return "", fmt.Errorf("boot-transparency validation failed\n%v", err)
}
}

Expand All @@ -287,130 +260,3 @@ func linuxCmd(_ *shell.Interface, arg []string) (res string, err error) {

return "", boot(image)
}

func btCmd(_ *shell.Interface, arg []string) (res string, err error) {
if len(arg[0]) > 0 {
if arg[0] == " on" {
btConfig.enabled = true

if len(arg[1]) > 0 {
btConfig.net = true
}
} else {
btConfig.enabled = false
btConfig.net = false
}
}

if btConfig.enabled {
if btConfig.net {
return fmt.Sprintf("boot-transparency is on, with network access enabled\n"), nil
} else {
return fmt.Sprintf("boot-transparency is on, with network access disabled (default)\n"), nil
}
} else {
return fmt.Sprintf("boot-transparency is off\n"), nil
}
}

func btCheck(fsys fs.FS, net bool) (err error) {
bootPolicy, err := fs.ReadFile(fsys, bootPolicyPath)
if err != nil {
return fmt.Errorf("cannot read boot policy, %v", err)
}

witnessPolicy, err := fs.ReadFile(fsys, witnessPolicyPath)
if err != nil {
return fmt.Errorf("cannot read witness policy, %v", err)
}

submitKey, err := fs.ReadFile(fsys, submitKeyPath)
if err != nil {
return fmt.Errorf("cannot read log submitter key, %v", err)
}

logKey, err := fs.ReadFile(fsys, logKeyPath)
if err != nil {
return fmt.Errorf("cannot read log key, %v", err)
}

proofBundle, err := fs.ReadFile(fsys, proofBundlePath)
if err != nil {
return fmt.Errorf("cannot read proof bundle, %v", err)
}

te, err := transparency.GetEngine(transparency.Sigsum)
if err != nil {
return fmt.Errorf("unable to configure the transparency engine, %w", err)
}

err = te.SetKey([]string{string(logKey)}, []string{string(submitKey)})
if err != nil {
return
}

wp, err := te.ParseWitnessPolicy(witnessPolicy)
if err != nil {
return
}

err = te.SetWitnessPolicy(wp)
if err != nil {
return
}

// Parse the proof bundle, which is expected to contain
// the logged statement and its inclusion proof, or the probe
// data to request the inclusion proof when operating with
// network access enabled.
pb, _, err := te.ParseProof(proofBundle)
if err != nil {
return
}

if net {
// Probe the log to obtain a fresh inclusion proof.
pr, err := te.GetProof(pb)
if err != nil {
return err
}

freshBundle := pb.(*sigsum.ProofBundle)
freshBundle.Proof = string(pr)

// Inclusion proof verification with network access:
// use the inclusion proof fetched from the log.
err = te.VerifyProof(freshBundle)
if err != nil {
return err
}
} else {
// Inclusion proof verification without network access:
// use the inclusion proof included in the proof bundle.
err = te.VerifyProof(pb)
if err != nil {
return err
}
}

r, err := policy.ParseRequirements(bootPolicy)
if err != nil {
return
}

b := pb.(*sigsum.ProofBundle)

c, err := policy.ParseStatement(b.Statement)
if err != nil {
return
}

// Check if the logged claims are matching the policy requirements.
if err = policy.Check(r, c); err != nil {
// The boot bundle is NOT authorized for boot.
return
}

// All boot-transparency checks passed.
return
}
Loading