Skip to content

Commit

Permalink
[wicketd] Accept TUF repos with RoT archives signed with different ke…
Browse files Browse the repository at this point in the history
…ys (#4289)

As of this PR, wicketd will (a) accept TUF repos containing multiple RoT
archives for the same board target (e.g., multiple gimlet RoT images),
and when performing a mupdate, it will ask the RoT for its
currently-active CMPA and CFPA pages and search for an RoT archive that
matches.

After this is deployed to all fielded systems, we'll be able to drop the
`-rot-staging-dev` and `-prod-rel` TUF repos from CI, and only build a
single TUF repo with all RoT images. This PR adds a new `-rot-all` TUF
repo publishing step but does not remove the old ones, as we'll need
them to update into this version of wicketd.
  • Loading branch information
jgallagher authored Oct 19, 2023
1 parent 93b280c commit 58c8c6e
Show file tree
Hide file tree
Showing 15 changed files with 695 additions and 129 deletions.
62 changes: 62 additions & 0 deletions .github/buildomat/jobs/tuf-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@
#: job = "helios / build trampoline OS image"
#:
#: [[publish]]
#: series = "rot-all"
#: name = "repo.zip.parta"
#: from_output = "/work/repo-rot-all.zip.parta"
#:
#: [[publish]]
#: series = "rot-all"
#: name = "repo.zip.partb"
#: from_output = "/work/repo-rot-all.zip.partb"
#:
#: [[publish]]
#: series = "rot-all"
#: name = "repo.zip.sha256.txt"
#: from_output = "/work/repo-rot-all.zip.sha256.txt"
#:
#: [[publish]]
#: series = "rot-prod-rel"
#: name = "repo.zip.parta"
#: from_output = "/work/repo-rot-prod-rel.zip.parta"
Expand Down Expand Up @@ -168,6 +183,38 @@ caboose_util_rot() {
}

SERIES_LIST=()

# Create an initial `manifest-rot-all.toml` containing the SP images for all
# boards. While we still need to build multiple TUF repos,
# `add_hubris_artifacts` below will append RoT images to this manifest (in
# addition to the single-RoT manifest it creates).
prep_rot_all_series() {
series="rot-all"

SERIES_LIST+=("$series")

manifest=/work/manifest-$series.toml
cp /work/manifest.toml "$manifest"

for board_rev in "${ALL_BOARDS[@]}"; do
board=${board_rev%-?}
tufaceous_board=${board//sidecar/switch}
sp_image="/work/hubris/${board_rev}.zip"
sp_caboose_version=$(/work/caboose-util read-version "$sp_image")
sp_caboose_board=$(/work/caboose-util read-board "$sp_image")

cat >>"$manifest" <<EOF
[[artifact.${tufaceous_board}_sp]]
name = "$sp_caboose_board"
version = "$sp_caboose_version"
[artifact.${tufaceous_board}_sp.source]
kind = "file"
path = "$sp_image"
EOF
done
}
prep_rot_all_series

add_hubris_artifacts() {
series="$1"
rot_dir="$2"
Expand All @@ -177,6 +224,7 @@ add_hubris_artifacts() {
SERIES_LIST+=("$series")

manifest=/work/manifest-$series.toml
manifest_rot_all=/work/manifest-rot-all.toml
cp /work/manifest.toml "$manifest"

for board in gimlet psc sidecar; do
Expand All @@ -198,6 +246,20 @@ path = "$rot_image_a"
[artifact.${tufaceous_board}_rot.source.archive_b]
kind = "file"
path = "$rot_image_b"
EOF

cat >>"$manifest_rot_all" <<EOF
[[artifact.${tufaceous_board}_rot]]
name = "$rot_caboose_board-${rot_dir//\//-}"
version = "$rot_caboose_version"
[artifact.${tufaceous_board}_rot.source]
kind = "composite-rot"
[artifact.${tufaceous_board}_rot.source.archive_a]
kind = "file"
path = "$rot_image_a"
[artifact.${tufaceous_board}_rot.source.archive_b]
kind = "file"
path = "$rot_image_b"
EOF
done

Expand Down
52 changes: 28 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ foreign-types = "0.3.2"
fs-err = "2.9.0"
futures = "0.3.28"
gateway-client = { path = "clients/gateway-client" }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "1e180ae55e56bd17af35cb868ffbd18ce487351d", default-features = false, features = ["std"] }
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "1e180ae55e56bd17af35cb868ffbd18ce487351d" }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "2739c18e80697aa6bc235c935176d14b4d757ee9", default-features = false, features = ["std"] }
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "2739c18e80697aa6bc235c935176d14b4d757ee9" }
gateway-test-utils = { path = "gateway-test-utils" }
glob = "0.3.1"
headers = "0.3.9"
Expand Down
1 change: 1 addition & 0 deletions gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ license = "MPL-2.0"
[dependencies]
anyhow.workspace = true
async-trait.workspace = true
base64.workspace = true
ciborium.workspace = true
clap.workspace = true
dropshot.workspace = true
Expand Down
Loading

0 comments on commit 58c8c6e

Please sign in to comment.