Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 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
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
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ initializing console (text)
go-boot • tamago/amd64 (go1.24.1) • UEFI x64

. <path> # load and start EFI image
bt (none|offline|online)? # show/set boot-transparency status
build # build information
cat <path> # show file contents
clear # clear screen
Expand Down Expand Up @@ -240,6 +241,16 @@ for Google Compute Engine:

* [Google Compute Engine](https://github.com/usbarmory/go-boot/wiki/Google-Compute-Engine)

Boot transparency
=================

The interaction with a transparency ecosystem for boot loading operations is provided
by the [boot-transparency](https://github.com/usbarmory/boot-transparency) Go library.

The following example demonstrates how to enable, and configure, the boot transparency support:

* [Boot transparency](https://github.com/usbarmory/go-boot/wiki/Boot-Transparency)

License
=======

Expand Down
79 changes: 79 additions & 0 deletions cmd/auth.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// 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 (
"errors"
"fmt"
"io/fs"
"net"
"regexp"
"strings"

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

var btConfig transparency.Config

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

func btCmd(_ *shell.Interface, arg []string) (res string, err error) {
if len(arg[0]) > 0 {
switch strings.TrimSpace(arg[0]) {
case "none":
btConfig.Status = transparency.None
case "offline":
btConfig.Status = transparency.Offline
case "online":
if net.SocketFunc == nil {
return "", errors.New("network unavailable")
}
btConfig.Status = transparency.Online
}
}

switch btConfig.Status {
case transparency.None:
res = fmt.Sprintf("boot-transparency is disabled\n")
case transparency.Offline, transparency.Online:
res = fmt.Sprintf("boot-transparency is enabled in %s mode\n", btConfig.Status.Resolve())
}

return
}

func btValidateLinux(entry *uapi.Entry, root fs.FS) (err error) {
if entry == nil || len(entry.Linux) == 0 {
return errors.New("invalid kernel entry")
}

btConfig.UefiRoot = root

btEntry := transparency.BootEntry{
transparency.Artifact{
Category: artifact.LinuxKernel,
Hash: transparency.Hash(&entry.Linux),
},
transparency.Artifact{
Category: artifact.Initrd,
Hash: transparency.Hash(&entry.Initrd),
},
}

return btEntry.Validate(&btConfig)
}
8 changes: 8 additions & 0 deletions cmd/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"github.com/usbarmory/armory-boot/exec"
"github.com/usbarmory/go-boot/shell"
"github.com/usbarmory/go-boot/transparency"
"github.com/usbarmory/go-boot/uapi"
"github.com/usbarmory/go-boot/uefi"
"github.com/usbarmory/go-boot/uefi/x64"
Expand Down Expand Up @@ -245,6 +246,13 @@ func linuxCmd(_ *shell.Interface, arg []string) (res string, err error) {
return "", errors.New("empty kernel entry")
}

// boot transparency validation (if enabled)
if btConfig.Status != transparency.None {
if err = btValidateLinux(entry, root); err != nil {
return "", fmt.Errorf("boot transparency validation failed, %v", err)
}
}

image := &exec.LinuxImage{
Kernel: entry.Linux,
InitialRamDisk: entry.Initrd,
Expand Down
3 changes: 3 additions & 0 deletions cmd/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import (
"github.com/usbarmory/go-boot/shell"
"github.com/usbarmory/go-boot/uefi"
"github.com/usbarmory/go-boot/uefi/x64"

// maintained set of TLD roots for any potential TLS client request
_ "golang.org/x/crypto/x509roots/fallback"
)

// Resolver represents the default name server
Expand Down
6 changes: 6 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ require (
github.com/therootcompany/xz v1.0.1 // indirect
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 // indirect
github.com/ulikunitz/xz v0.5.15 // indirect
github.com/usbarmory/boot-transparency v0.0.0-20251214154413-cc17620555b5 // indirect
golang.org/x/crypto v0.42.0 // indirect
golang.org/x/crypto/x509roots/fallback v0.0.0-20251208183426-19acf81bd7bc // indirect
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
golang.org/x/mod v0.28.0 // indirect
golang.org/x/net v0.44.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/time v0.7.0 // indirect
gvisor.dev/gvisor v0.0.0-20250911055229-61a46406f068 // indirect
sigsum.org/sigsum-go v0.11.2 // indirect
)
14 changes: 14 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,35 @@ github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY=
github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/usbarmory/armory-boot v0.0.0-20251106084515-0ad568ddb5ff h1:ei2XuYJXp8gJ4Ezte4EtJQOleFMs5d2Ppehm/NyNRWc=
github.com/usbarmory/armory-boot v0.0.0-20251106084515-0ad568ddb5ff/go.mod h1:2cCdG4eUnVtrKyfbCc2A+0SHJl62Cgf4jEXTw/OvlW4=
github.com/usbarmory/boot-transparency v0.0.0-20251209141545-d49bc8b83d3e h1:06J4nBtMyqUhYwNigymqipQIXDezoytYJCaZb2WAYCM=
github.com/usbarmory/boot-transparency v0.0.0-20251209141545-d49bc8b83d3e/go.mod h1:sRG+Jvx0W7gw7ATXOGPgF93DhjHYZ0I9CnT0myhtdKo=
github.com/usbarmory/boot-transparency v0.0.0-20251214154413-cc17620555b5 h1:n/gGzxy3Y7QfEDCgANybJGiKjRFVxJPza6y7z/18FoQ=
github.com/usbarmory/boot-transparency v0.0.0-20251214154413-cc17620555b5/go.mod h1:sRG+Jvx0W7gw7ATXOGPgF93DhjHYZ0I9CnT0myhtdKo=
github.com/usbarmory/go-net v0.0.0-20251003201608-93d9ffe808de h1:5O20CXXbFwjrqyDFtCyFUlxiRLCdc+ksT8MUihbjIDg=
github.com/usbarmory/go-net v0.0.0-20251003201608-93d9ffe808de/go.mod h1:+6WiKCFJtJQZdNM2VpwQsYGo/aBJ39pN7nWx6Td3Z8s=
github.com/usbarmory/tamago v1.25.5 h1:9iOrTuQnS/MtBTIhiI/YSJE3eWLZNiwxANUZtb19d9c=
github.com/usbarmory/tamago v1.25.5/go.mod h1:CySGMX26pVXp1CMBxA5bq52eXEWqXqr+mWcZQW2e54c=
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/crypto/x509roots/fallback v0.0.0-20251208183426-19acf81bd7bc h1:jKhXqlxjiWmODO7bW0ihd0EGOzSDgQ1YVarUldQI/Wk=
golang.org/x/crypto/x509roots/fallback v0.0.0-20251208183426-19acf81bd7bc/go.mod h1:MEIPiCnxvQEjA4astfaKItNwEVZA5Ki+3+nyGbJ5N18=
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ=
golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
gvisor.dev/gvisor v0.0.0-20250911055229-61a46406f068 h1:95kdltF/maTDk/Wulj7V81cSLgjB/Mg/6eJmOKsey4U=
gvisor.dev/gvisor v0.0.0-20250911055229-61a46406f068/go.mod h1:K16uJjZ+hSqDVsXhU2Rg2FpMN7kBvjZp/Ibt5BYZJjw=
sigsum.org/sigsum-go v0.11.2 h1:7HhDPC8gVJzl3wB3gAg3j6gTpO2t0UPHC0ogwhKuNRc=
sigsum.org/sigsum-go v0.11.2/go.mod h1:pGa/r4QsNYom+RqRMkdhcG5E00ty1nlTmALEizdRWPk=
Loading