2021-11-29 13:21:17 +00:00
|
|
|
# TUF Client Example
|
2021-11-16 07:42:21 +00:00
|
|
|
|
|
|
|
|
|
2021-11-29 13:21:17 +00:00
|
|
|
TUF Client Example, using ``python-tuf``.
|
2021-11-16 07:42:21 +00:00
|
|
|
|
2021-11-29 13:21:17 +00:00
|
|
|
This TUF Client Example implements the following actions:
|
2022-11-24 15:09:57 +00:00
|
|
|
- Client Initialization
|
|
|
|
|
- Target file download
|
2021-11-16 07:42:21 +00:00
|
|
|
|
2022-11-24 15:09:57 +00:00
|
|
|
The client can be used against any TUF repository that serves metadata and
|
|
|
|
|
targets under the same URL (in _/metadata/_ and _/targets/_ directories, respectively). 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).
|
2021-11-16 07:42:21 +00:00
|
|
|
|
|
|
|
|
|
2022-12-05 10:19:33 +00:00
|
|
|
### Usage with the repository example
|
2022-11-24 15:09:57 +00:00
|
|
|
|
|
|
|
|
In one terminal, run the repository example and leave it running:
|
2021-11-16 07:42:21 +00:00
|
|
|
```console
|
2022-11-24 15:09:57 +00:00
|
|
|
examples/repository/repo
|
2021-11-16 07:42:21 +00:00
|
|
|
```
|
|
|
|
|
|
2022-11-24 15:09:57 +00:00
|
|
|
In another terminal, run the client:
|
2021-11-16 07:42:21 +00:00
|
|
|
|
2021-11-29 13:21:17 +00:00
|
|
|
```console
|
2022-11-24 15:09:57 +00:00
|
|
|
# initialize the client with Trust-On-First-Use
|
|
|
|
|
./client tofu
|
|
|
|
|
|
|
|
|
|
# Then download example files from the repository:
|
|
|
|
|
./client download file1.txt
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Note that unlike normal repositories, the example repository only exists in
|
|
|
|
|
memory and is re-generated from scratch at every startup: This means your
|
2022-12-03 09:33:06 +00:00
|
|
|
client needs to run `tofu` every time you restart the repository application.
|
2022-11-24 15:09:57 +00:00
|
|
|
|
|
|
|
|
|
2022-12-05 10:19:33 +00:00
|
|
|
### Usage with a repository on the internet
|
2022-11-24 15:09:57 +00:00
|
|
|
|
|
|
|
|
```console
|
|
|
|
|
# On first use only, initialize the client with Trust-On-First-Use
|
|
|
|
|
./client --url https://jku.github.io/tuf-demo tofu
|
|
|
|
|
|
|
|
|
|
# Then download example files from the repository:
|
|
|
|
|
./client --url https://jku.github.io/tuf-demo download demo/succinctly-delegated-1.txt
|
2021-11-29 13:21:17 +00:00
|
|
|
```
|