2014-07-12 13:12:32 +00:00
|
|
|
## Client Setup ##
|
2014-07-06 01:13:36 +00:00
|
|
|
|
2014-07-12 13:12:32 +00:00
|
|
|
The following [repository tool](README.md) function creates a directory
|
|
|
|
|
structure that a client downloading new software using TUF (via tuf/client/updater.py)
|
|
|
|
|
expects. The `root.json` metadata file must exist, and also the directories that hold
|
|
|
|
|
the metadata files downloaded from a repository. Software updaters integrating with
|
2014-07-06 01:13:36 +00:00
|
|
|
TUF may use this directory to store TUF updates saved on the client side.
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
>>> from tuf.repository_tool import *
|
2014-07-10 13:48:24 +00:00
|
|
|
>>> create_tuf_client_directory("/path/to/repository/", "/path/to/client/")
|
2014-07-06 01:13:36 +00:00
|
|
|
```
|
|
|
|
|
|
2014-07-12 13:08:10 +00:00
|
|
|
`create_tuf_client_directory()` moves metadata from `/path/to/repository/metadata`
|
2014-07-07 23:24:11 +00:00
|
|
|
to `/path/to/client/`. The repository in `/path/to/repository/` may be the repository
|
2014-07-12 13:08:10 +00:00
|
|
|
example created in the repository tool [README](README.md).
|
2014-07-07 23:24:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## Test TUF Locally ##
|
|
|
|
|
Run the local TUF repository server.
|
2014-07-06 01:13:36 +00:00
|
|
|
```Bash
|
2014-07-10 13:48:24 +00:00
|
|
|
$ cd "/path/to/repository/"; python -m SimpleHTTPServer 8001
|
2014-07-06 01:13:36 +00:00
|
|
|
```
|
|
|
|
|
|
2014-07-12 13:08:10 +00:00
|
|
|
Retrieve targets from the TUF repository and save them to `/path/to/client/`. The
|
2014-07-07 23:24:11 +00:00
|
|
|
`basic_client.py` module is available in `tuf/client/`.
|
2014-07-06 01:13:36 +00:00
|
|
|
In a different command-line prompt . . .
|
|
|
|
|
```Bash
|
2014-07-10 13:48:24 +00:00
|
|
|
$ cd "/path/to/client/"
|
2014-07-06 01:13:36 +00:00
|
|
|
$ ls
|
|
|
|
|
metadata/
|
|
|
|
|
|
|
|
|
|
$ basic_client.py --repo http://localhost:8001
|
|
|
|
|
$ ls . targets/ targets/django/
|
|
|
|
|
.:
|
|
|
|
|
metadata targets tuf.log
|
|
|
|
|
|
|
|
|
|
targets/:
|
|
|
|
|
django file1.txt file2.txt
|
|
|
|
|
|
|
|
|
|
targets/django/:
|
|
|
|
|
file4.txt
|
|
|
|
|
```
|