-
Notifications
You must be signed in to change notification settings - Fork 3
Tufaceous v2: project rewrite / RFD 621 implementation #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
138 commits
Select commit
Hold shift + click to select a range
ea2dc59
wip
iliana ece6da9
define and wire up metadata
iliana bc122f2
editor refactor; allow the CLI to guess kinds
iliana 09fd212
todo -> todone
iliana 2e4f484
add edit/ls/cat commands
iliana e5f270e
match tokio-util version with omicron
iliana b6a79ba
impl Eq for Artifacts
iliana 2d998ad
wip changes while working on omicron integration
iliana 243782f
load repo from opened zip; flatten io error variants
iliana 10f3578
fix incorrect conversion into TransportErrorKind::FileNotFound
iliana fdd859e
ability to retrieve archive path/sha256 from loaded repo
iliana cae592a
impl From<T> for Sign
iliana 734c376
refactor RepositoryEditor::fake
iliana 9153796
add Repository::fake shorthand method
iliana a05e82a
add `Artifacts::filter_tags`
iliana 49fd3ff
clean up unwraps from fake artifact generation
iliana 3fed6a3
big-ass editor refactor
iliana 2089329
clippy pedantic cleanup and explicit unwraps
iliana 1f329c4
small nit
iliana 9a48652
ugh clippy
iliana fb729bc
add a `Repository::verify_targets` method
iliana 846b468
ensure target streams impl `Sync`
iliana 8afcc64
add ErrorKind::is_repository_error
iliana b487607
add ArtifactId and ArtifactHandle
iliana e69319a
i fought the borrow checker and won
iliana 3d48760
create `Root` struct
iliana 6225be4
various tweaks
iliana 1aeda4a
add v1_compatibility tests
iliana 24868ed
a few tweaks and tests
iliana 8d88948
metadata will always be string:string map
iliana f5ced8f
don't bother with symlinks in zip files
iliana ebd9aa3
oops
iliana 4515d8e
write a big comment about zip archive safety
iliana 32c790d
regenerate installinator documents for v1 repos
iliana a23d0fe
disallow creating repos with unexpected tag collisions
iliana 284002c
read the artifact version from measurement corpus
iliana dae6f91
better corim errors / partial guess test
iliana 1b702b2
installinator document must contain the artifact version
iliana 38e45c7
impl Display for Root
iliana cf894c5
impl Clone for RepositoryEditor
iliana 3e892c6
nit
iliana 3f01e5c
rewrite ZipTransport::stream
iliana 865bc27
add RepositoryEditor::inconsistent_fake
iliana 7cb0bef
deal with weird zone file names
iliana e478d77
update fake sp/rot tags for what omicron tests expect
iliana be9c1e7
implement strongly-typed repo metadata
iliana c6b269e
rework common to_map function
iliana 2b44f17
bump tar
iliana b3415b7
bump rsa
iliana dbd0cf7
move DisplayTags into tags.rs
iliana b099e58
remove ArtifactId
iliana 370f380
consistently use re-export of ExpirationEnforcement
iliana def2f94
clean up composite archive types from brand-metadata
iliana bc4fd3d
refactor / docs pass on tufaceous-artifact
iliana 159e047
docs pass, remove InstallinatorArtifactId etc
iliana 76b6c4b
oops
iliana cce2ef2
upstream tough PR got merged yay
iliana 865bf09
README; problem checker; verify subcommand
iliana 3fdbb39
further checks and tests for some checks
iliana 9f19c9c
further comment nits
iliana 152463b
rename "sign" -> "RKTH"
iliana 72f9778
tough 0.22.0
iliana 2610c9e
os_board should not be an enum
iliana b0fce4f
add RotKeyTableHash::from_bytes
iliana f3ae21d
helix pls
iliana 268680f
zip transport error handling nits
iliana a5c8765
rust 1.94; improve readability of ZipTransport::from_impl_blocking
iliana 33885f7
update rawzip
iliana ef094c3
Merge remote-tracking branch 'origin/main' into iliana/rfd621
iliana cc29a9b
make `to_map` fallible
iliana f401a27
keep installinator documents if --no-installinator-document
iliana e53bd8f
rename ArtifactSet::get -> get_only
iliana ced6306
archive_* args to Repository::from_loaded are never Some
iliana 115132a
KnownArtifactTags tweaks and Artifact docs
iliana 3984261
also use the "causality hazard" warning here
iliana 227fb0c
clarify the v1 compat stuff in the installinator module
iliana a4c160a
deserialize_from_empty -> deserialize_previously_valid
iliana 4a41037
add TODO for LoadOptions
iliana 4fb79bc
fixup! rename ArtifactSet::get -> get_only
iliana 4ea661b
lock hubtools/rats-corim to same commits as omicron
iliana d64ef97
update packages implicated by `cargo audit`
iliana e021b77
serde_human_bytes -> byte-wrapper; sha256 0.11
iliana b8f65d3
remove target_name from Artifact
iliana 38ebade
fix doc anchors on ZipTransport
iliana 14f1fcb
macro (and documentation) for "usize fits in u64"
iliana 7f4168f
bail early if more zip entries than EOCD claims
iliana be1d943
lift spawn_blocking out of ZipTransport::from_file
iliana 0268a3c
doc comments for tufaceous_artifact::map
iliana 41a264f
fix comment note on Metadata
iliana 7a7e03d
move Option out of RotKeyTableHash
iliana 4695ec1
make RepositoryEditor::new fallible
iliana e3594ce
also set artifact_version in RepositoryEditor::system_version
iliana d0dc957
verbify RepositoryEditor's methods
iliana cfd60a7
sprinkle `impl` into RepositoryEditor method args
iliana ef620c8
remove RepositoryEditor::add_fake_artifact
iliana 94c93c4
properly handle invalid hash lengths from imported repos
iliana 41b93cc
immediately check for conflicting artifact definitions
iliana 7a653ce
some more s/sign/rkth/
iliana 1af3f9b
remove errant eprintln!
iliana a02d5c0
fix logic bug in read_os_tarball_metadata_blocking
iliana 34aebb8
stronger root types in edit::sign
iliana 176d282
return Err in zip_writer::write_task if other end is dropped
iliana 1fa4878
don't panic in deflate_heuristic
iliana ea8e14b
fmt
iliana 44eff96
Update lib/src/edit/input.rs
iliana eb21197
() = result??;
iliana 68bf84e
split ErrorKind::ReadZip
iliana abccf73
un-backwards the streams (remove stream::try_unfold)
iliana 479e433
redo trust store options, implement in bin
iliana 1a4bb85
bin docs pass
iliana 77d4820
require compression param in ZipWriter::new_file
iliana 80e93ab
fix doc test after 479e433
iliana ec5bb32
simplify the zip writer, moving it to edit::sign
iliana 350530a
bleh
iliana 0e0a7e4
generate a more-realistic fake OS phase 2 image
iliana 47feead
attempt to explain Source/Input/Output
iliana 4078d3f
explicitly tag source errors as #[source]
iliana a889f72
fixup! simplify the zip writer, moving it to edit::sign
iliana 9f301a0
reject repos with bad target metadata
iliana cff1fc4
verify subcommand should print repo hash
iliana a0f34b8
fix added/changed flags in readme
iliana 3f740da
make Repository::check_problems fallible
iliana 509557c
list problem if metadata cannot convert to mapping
iliana 1dedde5
make unix.z/cpio.z optional as intended
iliana 89c4f39
comments for v1
iliana e81ad2a
document GuessInput/GuessResult
iliana 0975ac6
consistently use `tuf_repo: tough::Repository`
iliana f503e6a
avoid overrelying on RotSlot::fmt
iliana 5bd5bd0
ensure TargetSource::stream is Send
iliana 52d37f2
correctly use the friendly CA name in the target name
iliana 53b20ab
properly handle JoinError in the blocking stream pattern
iliana e37c399
max parallelism in RepositoryEditor::finish
iliana 67e9ea2
wow
iliana 470478c
return io errors while guessing artifacts
iliana 85ba134
check max_root_size when blindly trusting 1.root.json
iliana 50e55db
fixup! return io errors while guessing artifacts
iliana d692cc7
further guessing about guess errors
iliana 2c4c642
fix os image guess error
iliana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # Tufaceous | ||
|
|
||
| Tufaceous is the library and tooling for Oxide update repositories. It is a layer of Oxide-specific tooling on top of [tough](https://github.com/awslabs/tough), a Rust library that implements [TUF](https://theupdateframework.io/). | ||
|
|
||
| This README is intended to provide a high-level overview of the library and instructions for adding to it. More context can be found in [RFD 621](https://rfd.shared.oxide.computer/rfd/0621). | ||
|
|
||
| ## Repository format | ||
|
|
||
| We selected ZIP archives as the primary format for our repositories, despite ZIP's many shortcomings. Because Oxide customers are receiving update repositories and uploading them to their systems, we wanted them to be readable for most users so that they could see what is inside. | ||
|
|
||
| The ZIP archive has a top-level `repo` directory. Inside this directory is a `metadata` directory, containing the signed TUF metadata, and a `targets` directory, containing all the targets described by that metadata. | ||
|
|
||
| ## Artifacts | ||
|
|
||
| "Artifacts" are our jargon for a file that the Oxide control plane needs in order to perform updates. (All artifacts are "targets", TUF jargon for a file described by the repository metadata, but not all targets are artifacts.) | ||
|
|
||
| Artifacts in the repository are described by the `artifacts-v2.json`. Each artifact has a set of tags that is used by the control plane to decide what to do with the artifact. When creating and using artifacts, these tags are strongly-typed (see `KnownArtifactTags` in `artifact/src/tags.rs`), but they are encoded as an arbitrary key-value mapping. This allows us to potentially release a new type of artifact and use it in the same release, once Nexus has been updated. | ||
|
|
||
| As a general rule it is not possible to use this tooling to create a repository with arbitrary blobs and artifacts in it. The library is very opinionated about how artifacts are named to keep things usable for the CLI and for users of these repositories. | ||
|
|
||
| ## Tooling | ||
|
|
||
| Most of the time you're working with repositories generated by the [Omicron release tooling](https://github.com/oxidecomputer/omicron/blob/main/docs/releng.adoc) (`cargo xtask releng` in Omicron). There is also a binary target that is a thin CLI on top of the library, which you can build with `cargo build --release --bin tufaceous`. | ||
|
|
||
| In all commands that read from a repository, use either `-r`/`--trust-roots` to provide a list of trust roots to verify signatures against, or `--blindly-trust` to use the `metadata/1.root.json` root in the repository as the trust root. If you want to load a repository with an expired signature, use `--allow-expired`. For convenience you can combine `--allow-expired` and `--blindly-trust` with `-f`/`--force-load`. | ||
|
|
||
| ### Verify a repository | ||
|
|
||
| `tufaceous verify` will read a repository, print its SHA256 checksum, and verify the metadata and checksums of all the metadata in the repository. It will also run a series of compatibility checks on the repository and warn you of any detected issues. | ||
|
|
||
| ### Unpack a repository | ||
|
|
||
| Scripts can use `tufaceous list-targets` to get a list of targets from the repository, and `tufaceous show-target` to write a target to stdout. | ||
|
|
||
| To unpack an entire repository, use `unzip` or ZIP tooling provided by your OS. | ||
|
|
||
| ### Build a repository | ||
|
|
||
| `tufaceous build` has two required flags: | ||
|
|
||
| - `--output file.zip`, which provides the path to write to | ||
| - `--system-version 1.0.0`, which provides the system version | ||
|
|
||
| The arguments are the set of artifacts to add: | ||
|
|
||
| - A measurement corpus is a CoRIM file | ||
| - An OS image is a directory containing `cosmo.rom`, `gimlet.rom`, and `zfs.img`, as produced by `helios-build image` | ||
|
iliana marked this conversation as resolved.
|
||
| - An RoT, RoT bootloader, or SP image is a Hubris archive (ZIP format) | ||
| - A zone image is a tarball that starts with the `oxide.json` Omicron brand metadata | ||
|
|
||
| When building a repository, an Installinator document is automatically created based on the artifacts in the repository. You can avoid this with `--no-installinator-document`. | ||
|
|
||
| ### Add/remove artifacts from a repository | ||
|
|
||
| Using `tufaceous edit` you can remove targets from a repository using `--remove-targets` and add new artifacts using `--add-artifacts`. | ||
|
|
||
| The Installinator document is automatically regenerated based on the artifacts in the final repository. You can avoid this with `--no-installinator-document`, which will keep an existing Installinator document if there is one. | ||
|
|
||
| ## Adding new artifacts | ||
|
|
||
| In order to add a new type of artifact, you will need to make a series of changes to the library: | ||
|
|
||
| - Modify `KnownArtifactTags` to describe your new artifact | ||
| - Add methods for adding an actual artifact and a fake artifact to `RepositoryEditor` | ||
| - Add a fake artifact in `Input::fake` (`lib/src/edit/fake.rs`) | ||
| - Add code for guessing this type of artifact to `Input::guess` (`lib/src/edit/guess.rs`) | ||
|
|
||
| As a general rule, Tufaceous artifacts are self-describing. The "guess" code is used by the CLI and generates tags from the artifact to avoid needing an unwieldy set of command line options to describe tags. If your artifact is not self-describing, you can staple a header of some kind to the beginning of the artifact that control plane code knows to strip before using the artifact. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.