-
Notifications
You must be signed in to change notification settings - Fork 275
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
Reframe CLI, revise quickstart, and reorganize tutorials #849
Changes from 1 commit
907186e
5a94d5d
1f3e5b6
ed6acd4
2af4d3f
67dd649
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
Getting Started | ||
--------------- | ||
|
||
- `Overview of TUF <OVERVIEW.rst>`_ | ||
- `Installation <INSTALLATION.rst>`_ | ||
- `Contributors <CONTRIBUTORS.rst>`_ | ||
- `Quickstart <QUICKSTART.md>`_ | ||
- `CLI <CLI.md>`_ | ||
- `CLI Usage Examples <CLI_EXAMPLES.md>`_ | ||
- `Tutorial <TUTORIAL.md>`_ | ||
- Beginner Tutorials (using the basic command-line interface): `Quickstart <QUICKSTART.md>`_; `CLI Tutorial <CLI.md>`_; `CLI Further Examples <CLI_EXAMPLES.md>`_ | ||
- `Advanced Tutorial <TUTORIAL.md>`_ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you call it advanced tutorial here, which I think is a good idea, you maybe also want to call it that in the document heading? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed there and elsewhere, thanks. |
||
- `Guidelines for Contributors <CONTRIBUTORS.rst>`_ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,44 @@ | ||
# Quickstart # | ||
|
||
The CLI requires a few dependencies and C extensions that can be installed with | ||
`pip install securesystemslib[crypto,pynacl]`. | ||
In this quickstart tutorial, we'll use the basic TUF command-line interface | ||
(CLI), which includes the `repo.py` script and the `client.py` script, to set | ||
up a repository with an update and metadata about that update, then download | ||
and verify that update as a client. | ||
|
||
Unlike the underlying TUF modules that the CLI uses, the CLI itself is a bit | ||
bare-bones. Using the CLI is the easiest way to familiarize yourself with | ||
how TUF works, however. It will serve as a very basic update system and use | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ...? I think this is missing the end of the sentence. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. ^_^ |
||
|
||
---- | ||
The following is a basic workflow in four steps: | ||
|
||
**Step (1)** - Initialize a repo. The `tufrepo`, `tufkeystore`, and | ||
`tufclient` directories are created in the current working directory. | ||
**Step (0)** - Make sure TUF is installed | ||
|
||
See the [installation instructions for TUF](docs/INSTALLATION.rst). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are in the same directory There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, would it be bad to just provide the snippet here? So that quickstarters don't have to go through INSTALLATION.rst?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They do need to go through the installation instructions to install TUF. Prior text was a bit misleading in that it suggested that they only needed to run the ssl install. In any case, that step is listed two lines down, to emphasize it, since it would otherwise be optional. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But isn't the line I'm suggesting all that's required for the quick start? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, you need TUF installed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Simplified. Installing pip produces everything you need already on a basic Ubuntu platform, so I didn't delve into python-dev or libssl-dev, etc. Just provided the single command in the QUICKSTART. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
To contextualize, you need this to build the native support for the openssl backend. I think it's better to keep this from becoming a transient dependency as that may change at some point in the future... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not clear on your suggestion, sorry: are you saying that we should avoid implicitly requiring that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, the opposite. I understood that you were advising to remove these deps because something else is pulling them in. I'd rather have them explicitly just in case this is not the default in the future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, those requirements are now only in the collaborator docs, not in the installation docs. I was wondering if I should move them back into the installation docs. You're suggesting that we include them, which is good to hear, so I'll pull them back in to the natural place to put them (the installation instructions). I'll frame them as as-necessary installations, I guess, to try to keep things simple. That's beyond the scope of this PR, so I'll just do that in the next one, but for this PR, I'll split the difference in |
||
The TUF CLI makes use of some crypto dependencies, so please include the | ||
optional `pip install securesystemslib[crypto,pynacl]` step. | ||
|
||
|
||
**Step (1)** - Create a basic repository and client | ||
|
||
The following command will set up a basic update repository and basic client | ||
that knows about the repository. `tufrepo`, `tufkeystore`, and | ||
`tufclient` directories will be created in the current directory. | ||
|
||
```Bash | ||
$ repo.py --init | ||
``` | ||
Four sets of keys are created in the `tufkeystore` directory and metadata | ||
is initiated in the `tufrepo` and `tufclient` directories. | ||
|
||
**Step (2)** - Add a target file to the repo. The file size and hashes of | ||
the target file are also written to the Targets metadata file. | ||
Four sets of keys are created in the `tufkeystore` directory. Initial metadata | ||
about the repository is created in the `tufrepo` directory, and also provided | ||
to the client in the `tufclient` directory. | ||
|
||
|
||
**Step (2)** - Add an update to the repository. | ||
|
||
We'll create a target file that will later be delivered as an update to clients. | ||
Metadata about that file will be created and signed, and added to the | ||
repository's metadata. | ||
|
||
```Bash | ||
$ echo 'Test file' > testfile | ||
$ repo.py --add testfile | ||
|
@@ -38,21 +61,38 @@ tufrepo/ | |
|
||
3 directories, 11 files | ||
``` | ||
The new file `testfile` is added and metadata is updated in the `tufrepo` directory. | ||
|
||
The new file `testfile` is added to the repository, and metadata is updated in | ||
the `tufrepo` directory. The Targets metadata (`targets.json`) now includes | ||
the file size and hashes of the `testfile` target file, and this metadata is | ||
signed by the Targets role's key, so that clients can verify that metadata | ||
about `testfile` and then verify `testfile` itself. | ||
|
||
|
||
**Step (3)** - Serve the repo | ||
|
||
We'll host a toy http server containing the `testfile` update and the | ||
repository's metadata. | ||
|
||
```Bash | ||
$ cd "tufrepo/" | ||
$ python3 -m http.server 8001 | ||
|
||
# or, if you are using Python2: | ||
$ python -m SimpleHTTPServer 8001 | ||
|
||
or with Python 3... | ||
$ python3 -m http.server 8001 | ||
``` | ||
|
||
**Step (4)** - Fetch a target file from the repo. The client downloads | ||
any required metadata and the requested target file. | ||
**Step (4)** - Obtain and verify the `testfile` update on a client. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minuscule nit-pick: You end some heading sentences with a period and other not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
|
||
The client can request the package `testfile` from the repository. TUF will | ||
download and verify metadata from the repository as necessary to determine | ||
what the trustworthy hashes and length of `testfile` are, then download | ||
the target `testfile` from the repository and keep it only if it matches that | ||
trustworthy metadata. | ||
|
||
```Bash | ||
$ cd "tufclient/" | ||
$ cd "../tufclient/" | ||
$ client.py --repo http://localhost:8001 testfile | ||
$ tree | ||
. | ||
|
@@ -75,11 +115,35 @@ $ tree | |
|
||
5 directories, 11 files | ||
``` | ||
client.py verified metadata from the server and downloaded content. The client has now verified and obtained `testfile`. | ||
The scope of TUF ends here. | ||
|
||
Now that a trustworthy update target has been obtained, an updater can proceed | ||
however it normally would to install or use the update. | ||
|
||
---- | ||
|
||
See [CLI.md](CLI.md) and [CLI_EXAMPLES.md](CLI_EXAMPLES.md) to learn about the | ||
other supported CLI options. A [tutorial](TUTORIAL.md) is also available, and | ||
intended for users that want more control over the repo creation process. | ||
### Next Steps | ||
|
||
TUF provides functionality for both ends of a software update system, the | ||
**update provider** and the **update client**. | ||
|
||
`repo.py` made use of `tuf.repository_tool`'s functionality for an update | ||
provider, helping you produce and sign metadata about your updates. | ||
|
||
`client.py` made use of `tuf.client.updater`'s client-side functionality, | ||
performing download and the critical verification steps for metadata and the | ||
update itself. | ||
|
||
You can look at [CLI.md](CLI.md) and [CLI_EXAMPLES.md](CLI_EXAMPLES.md) to toy | ||
with the TUF CLI a bit more. After that, try out using the underlying modules | ||
for a great deal more control. The more detailed [TUF Tutorial](TUTORIAL.md) | ||
shows you how to use them. | ||
|
||
Ultimately, a sophisticated update client will use or re-implement those | ||
underlying modules. The TUF design is intended to play well with any update | ||
workflow. | ||
|
||
Please provide feedback or questions for this or other tutorials, or | ||
TUF in general, by checking out | ||
[our contact info](https://github.com/theupdateframework/tuf#contact), or | ||
creating [issues](https://github.com/theupdateframework/tuf/issues) in this | ||
repository! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The long line looks a little daunting now. I would leave QUICKSTART.md separate and see if the cli tutorials could be combined, or restructured? From a quick glance, CLI.md looks like a documentation of the interface, whereas CLI_EXAMPLES.md looks like a slightly more in-depth version of QUICKSTART.md.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, and I've now combined the two CLI documents.