Skip to content

Commit a7c7b63

Browse files
committed
Update CLI descriptions and their reference in the README.md file
Signed-off-by: Radoslav Dimitrov <[email protected]>
1 parent 8b91e05 commit a7c7b63

File tree

11 files changed

+69
-32
lines changed

11 files changed

+69
-32
lines changed

README.md

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ a framework for securing software update systems.
99

1010
A TUF repository has the following directory layout:
1111

12-
```
12+
```bash
1313
.
1414
├── keys
1515
├── repository
@@ -32,7 +32,7 @@ The directories contain the following files:
3232

3333
### Install
3434

35-
```
35+
```bash
3636
go get github.com/theupdateframework/go-tuf/cmd/tuf
3737
```
3838

@@ -52,12 +52,15 @@ initialized to do so when generating keys.
5252
Prompts the user for an encryption passphrase (unless the
5353
`--insecure-plaintext` flag is set), then generates a new signing key and
5454
writes it to the relevant key file in the `keys` directory. It also stages
55-
the addition of the new key to the `root` manifest.
55+
the addition of the new key to the `root` manifest. Alternatively, passphrases
56+
can be set via environment variables in the form of `TUF_{{ROLE}}_PASSPHRASE`
5657

57-
#### `tuf set-threshold <role> <threshold>`
58+
#### `tuf revoke-key [--expires=<days>] <role> <id>`
5859

59-
Sets the `role` threshold, the required number of keys for signing, to
60-
`threshold`.
60+
Revoke a signing key
61+
62+
The key will be removed from the root manifest, but the key will remain in the
63+
"keys" directory if present.
6164

6265
#### `tuf add [<path>...]`
6366

@@ -82,7 +85,7 @@ the snapshot manifest will expire.
8285
Stages an appropriate `timestamp` manifest. If a `snapshot` manifest is staged,
8386
it must be fully signed.
8487

85-
#### `tuf sign ROLE`
88+
#### `tuf sign <manifest>`
8689

8790
Signs the given role's staged manifest with all keys present in the `keys`
8891
directory for that role.
@@ -96,6 +99,8 @@ manifest.
9699

97100
#### `tuf regenerate [--consistent-snapshot=false]`
98101

102+
Note: Not supported yet
103+
99104
Recreates the `targets` manifest based on the files in `repository/targets`.
100105

101106
#### `tuf clean`
@@ -107,6 +112,16 @@ Removes all staged manifests and targets.
107112
Outputs a JSON serialized array of root keys to STDOUT. The resulting JSON
108113
should be distributed to clients for performing initial updates.
109114

115+
#### `tuf set-threshold <role> <threshold>`
116+
117+
Sets the `role` threshold, the required number of keys for signing, to
118+
`threshold`.
119+
120+
#### Usage of environment variables
121+
122+
The `tuf` CLI supports receiving passphrases via environment variables in
123+
the form of `TUF_{{ROLE}}_PASSPHRASE`
124+
110125
For a list of supported commands, run `tuf help` from the command line.
111126

112127
### Examples
@@ -126,7 +141,7 @@ Some key IDs are truncated for illustrative purposes.
126141

127142
Generate a root key on the root box:
128143

129-
```
144+
```bash
130145
$ tuf gen-key root
131146
Enter root keys passphrase:
132147
Repeat root keys passphrase:
@@ -145,7 +160,7 @@ $ tree .
145160
Copy `staged/root.json` from the root box to the repo box and generate targets,
146161
snapshot and timestamp keys:
147162

148-
```
163+
```bash
149164
$ tree .
150165
.
151166
├── keys
@@ -183,7 +198,7 @@ $ tree .
183198

184199
Copy `staged/root.json` from the repo box back to the root box and sign it:
185200

186-
```
201+
```bash
187202
$ tree .
188203
.
189204
├── keys
@@ -205,7 +220,7 @@ committed alongside other manifests.
205220
Assuming a staged, signed `root` manifest and the file to add exists at
206221
`staged/targets/foo/bar/baz.txt`:
207222

208-
```
223+
```bash
209224
$ tree .
210225
.
211226
├── keys
@@ -285,7 +300,7 @@ $ tree .
285300

286301
Assuming the file to remove is at `repository/targets/foo/bar/baz.txt`:
287302

288-
```
303+
```bash
289304
$ tree .
290305
.
291306
├── keys
@@ -366,9 +381,9 @@ $ tree .
366381
└── staged
367382
```
368383

369-
#### Regenerate manifests based on targets tree
384+
#### Regenerate manifests based on targets tree (Note: Not supported yet)
370385

371-
```
386+
```bash
372387
$ tree .
373388
.
374389
├── keys
@@ -455,7 +470,7 @@ $ tree .
455470

456471
#### Update timestamp.json
457472

458-
```
473+
```bash
459474
$ tree .
460475
.
461476
├── keys

cmd/tuf/add.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ usage: tuf add [--expires=<days>] [--custom=<data>] [<path>...]
1313
1414
Add target file(s).
1515
16+
Alternatively, passphrases can be set via environment variables in the
17+
form of TUF_{{ROLE}}_PASSPHRASE
18+
1619
Options:
1720
--expires=<days> Set the targets manifest to expire <days> days from now.
1821
--custom=<data> Set custom JSON data for the target(s).

cmd/tuf/clean.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func init() {
1313
usage: tuf clean
1414
1515
Remove all staged manifests.
16-
`)
16+
`)
1717
}
1818

1919
func cmdClean(args *docopt.Args, repo *tuf.Repo) error {

cmd/tuf/gen_key.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ The key will be serialized to JSON and written to the "keys" directory with
1818
filename pattern "ROLE-KEYID.json". The root manifest will also be staged
1919
with the addition of the key's ID to the role's list of key IDs.
2020
21+
Alternatively, passphrases can be set via environment variables in the
22+
form of TUF_{{ROLE}}_PASSPHRASE
23+
2124
Options:
2225
--expires=<days> Set the root manifest to expire <days> days from now.
2326
`)

cmd/tuf/main.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,19 @@ Options:
2828
--insecure-plaintext Don't encrypt signing keys
2929
3030
Commands:
31-
help Show usage for a specific command
32-
gen-key Generate a new signing key for a specific manifest
33-
revoke-key Revoke a signing key
34-
add Add target file(s)
35-
remove Remove a target file
36-
snapshot Update the snapshot manifest
37-
timestamp Update the timestamp manifest
38-
sign Sign a manifest
39-
commit Commit staged files to the repository
40-
regenerate Recreate the targets manifest
41-
clean Remove all staged manifests
42-
root-keys Output a JSON serialized array of root keys to STDOUT
31+
help Show usage for a specific command
32+
init Initialize a new repository
33+
gen-key Generate a new signing key for a specific manifest
34+
revoke-key Revoke a signing key
35+
add Add target file(s)
36+
remove Remove a target file
37+
snapshot Update the snapshot manifest
38+
timestamp Update the timestamp manifest
39+
sign Sign a role's manifest
40+
commit Commit staged files to the repository
41+
regenerate Recreate the targets manifest [Not supported yet]
42+
clean Remove all staged manifests
43+
root-keys Output a JSON serialized array of root keys to STDOUT
4344
set-threshold Sets the threshold for a role
4445
4546
See "tuf help <command>" for more information on a specific command

cmd/tuf/regenerate.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ func init() {
1111
register("regenerate", cmdRegenerate, `
1212
usage: tuf regenerate [--consistent-snapshot=false]
1313
14-
Recreate the targets manifest.
15-
`)
14+
Recreate the targets manifest. Important: Not supported yet
15+
16+
Alternatively, passphrases can be set via environment variables in the
17+
form of TUF_{{ROLE}}_PASSPHRASE
18+
`)
1619
}
1720

1821
func cmdRegenerate(args *docopt.Args, repo *tuf.Repo) error {

cmd/tuf/remove.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ usage: tuf remove [--expires=<days>] [--all] [<path>...]
1313
1414
Remove target file(s).
1515
16+
Alternatively, passphrases can be set via environment variables in the
17+
form of TUF_{{ROLE}}_PASSPHRASE
18+
1619
Options:
1720
--all Remove all target files.
1821
--expires=<days> Set the targets manifest to expire <days> days from now.

cmd/tuf/sign.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ func init() {
99
register("sign", cmdSign, `
1010
usage: tuf sign <manifest>
1111
12-
Sign a manifest.
12+
Sign a role's manifest.
13+
14+
Signs the given role's staged manifest with all keys present in the 'keys'
15+
directory for that role.
1316
`)
1417
}
1518

cmd/tuf/snapshot.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ usage: tuf snapshot [--expires=<days>]
1111
1212
Update the snapshot manifest.
1313
14+
Alternatively, passphrases can be set via environment variables in the
15+
form of TUF_{{ROLE}}_PASSPHRASE
16+
1417
Options:
1518
--expires=<days> Set the snapshot manifest to expire <days> days from now.
1619
`)

cmd/tuf/timestamp.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ usage: tuf timestamp [--expires=<days>]
1111
1212
Update the timestamp manifest.
1313
14+
Alternatively, passphrases can be set via environment variables in the
15+
form of TUF_{{ROLE}}_PASSPHRASE
16+
1417
Options:
1518
--expires=<days> Set the timestamp manifest to expire <days> days from now.
1619
`)

repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ func (r *Repo) Commit() error {
946946
return err
947947
}
948948

949-
// We can start incrementing versin numbers again now that we've
949+
// We can start incrementing version numbers again now that we've
950950
// successfully committed the metadata to the local store.
951951
r.versionUpdated = make(map[string]struct{})
952952

0 commit comments

Comments
 (0)