2022-12-09 18:13:33 +00:00
|
|
|
# TUF Uploader Tool Example
|
|
|
|
|
|
|
|
|
|
:warning: This example uses the repository module which is not considered
|
|
|
|
|
part of the python-tuf stable API quite yet.
|
|
|
|
|
|
|
|
|
|
This is an example maintainer tool: It makes it possible to add delegations to
|
|
|
|
|
a remote repository, and then to upload delegated metadata to the repository.
|
|
|
|
|
|
|
|
|
|
Features:
|
2023-02-08 08:46:38 +00:00
|
|
|
- Initialization (much like the [client example](../client/))
|
2022-12-09 18:13:33 +00:00
|
|
|
- Claim delegation: this uses "unsafe repository API" in the sense that the
|
|
|
|
|
uploader sends repository unsigned data. This operation can be
|
|
|
|
|
compared to claiming a project name on PyPI.org
|
|
|
|
|
- Add targetfile: Here uploader uses signing keys that were added to the
|
|
|
|
|
delegation in the previous step to create a new version of the delegated
|
2023-02-08 08:46:38 +00:00
|
|
|
metadata. The repository will verify signatures on this metadata.
|
2022-12-09 18:13:33 +00:00
|
|
|
|
|
|
|
|
The used TUF repository can be set with `--url` (default repository is
|
|
|
|
|
"http://127.0.0.1:8001" which is also the default for the repository example).
|
|
|
|
|
In practice the uploader tool is only useful with the repository example.
|
|
|
|
|
|
|
|
|
|
### Usage with the repository example
|
|
|
|
|
|
2023-02-08 08:46:38 +00:00
|
|
|
In one terminal, run the [repository example](../repository/) and leave it running:
|
2022-12-09 18:13:33 +00:00
|
|
|
```console
|
|
|
|
|
examples/repository/repo
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
In another terminal, run uploader:
|
|
|
|
|
|
|
|
|
|
```console
|
2023-02-08 08:46:38 +00:00
|
|
|
# Initialize with Trust-On-First-Use
|
2022-12-09 18:13:33 +00:00
|
|
|
./uploader tofu
|
|
|
|
|
|
2023-02-08 09:01:07 +00:00
|
|
|
# Then claim a delegation for yourself (this also creates a new signing key):
|
2022-12-09 18:13:33 +00:00
|
|
|
./uploader add-delegation myrole
|
|
|
|
|
|
2023-02-08 09:01:07 +00:00
|
|
|
# Then add a new downloadable target file to your delegated role (to keep the
|
|
|
|
|
# example simple, the target file content is always the targetpath):
|
2022-12-09 18:13:33 +00:00
|
|
|
./uploader add-target myrole myrole/mytargetfile
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
At this point "myrole/mytargetfile" is downloadable from the repository
|
2023-02-08 08:46:38 +00:00
|
|
|
with the [client example](../client/).
|