Commit Graph

76 Commits

Author SHA1 Message Date
Ying Li d67a7e128c Refactor the notary command line to not use global mutable state, and to not exit on error.
This way we can test the command more easily (we want to test the error, as opposed to
just killing the test).

Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-03 12:01:16 -08:00
Riyaz Faizullabhoy 9c59af1397 passwd command and tests
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-28 10:36:05 -08:00
Riyaz Faizullabhoy ca67f1e71a client library deletion functionality, and integration into remove cert
CLI

Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-19 11:18:33 -08:00
David Lawrence 89f250c253 when doing getTransport readOnly needs to be false for a key rotation as write permissions are required to retrieve keys
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-11 17:25:23 -08:00
Ying Li 63f48791c3 Fix docstring for 'key-type' parameter on key rotate.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-15 10:18:58 -08:00
Ying Li ca1623e17b Update CLI rotate key command to optionally rotate a single key.
This makes it possible to delegate snapshots key management to the
server, and to reclaim the responsibility.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-14 17:17:23 -08:00
Ying Li 2ce0232972 Refactor notary CLI keys cmds to use less globally mutable state.
This way we can test the command functions more easily.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-14 17:17:23 -08:00
Ying Li 35b104beee Move all the pretty-print functions to their own file in cmd/notary.
Also add tests for pretty-printing and sorting targets.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-30 16:35:53 -08:00
Diogo Mónica e638f0a4d6 Merge pull request #285 from docker/delete-key-is-back
Add an interactive command to delete a key from any keystore.
2015-11-15 11:31:41 +01:00
Ying Li 0d7df87805 Add an interactive command to delete a key from any keystore.
This lists any matching keys, and requires the user to pick which one
to choose, if there is more than 1 matching key.  Also requires the
user to confirm before deleting.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-14 14:17:08 -08:00
Diogo Mónica 53626b6fe6 Merge pull request #284 from docker/key-command-renaming
Rename command line options from export/import key to backup/restore.
2015-11-14 13:49:53 +01:00
Ying Li cb6fd71848 Rename command line options from export/import key to backup/restore.
import-root/export-root have been renamed to import/export.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-14 02:33:36 -08:00
Ying Li eb9de9f0e8 Print out a different message for list keys if no keys are found.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-13 15:44:56 -08:00
Ying Li 39c682327e Pretty-print the key list in a deterministic sorted order.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-13 01:41:00 -08:00
David Lawrence ca7e4c8d38 set withHardware flag to false for export commands. We can never export from hardware
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:13:00 -08:00
David Lawrence 8628b57a96 private subdir should be added by keyfilestore, rather than all over the place
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:12:57 -08:00
Diogo Monica 4c2fcda620 Addressing small nits
Signed-off-by: Diogo Monica <diogo@docker.com>
Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Diogo Monica <diogo@docker.com> (github: endophage)
2015-11-12 01:12:48 -08:00
Diogo Monica 0344dfc038 Making tests pass
Signed-off-by: Diogo Monica <diogo@docker.com>
Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Diogo Monica <diogo@docker.com> (github: endophage)
2015-11-12 01:12:31 -08:00
Diogo Monica 5b7480f599 Adding default to notary key generate and configurable trust dir from
config

Signed-off-by: Diogo Monica <diogo.monica@gmail.com>
Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Diogo Monica <diogo.monica@gmail.com> (github: endophage)
2015-11-12 01:12:26 -08:00
David Lawrence ee270b6a2b fixing integrations tests for new list keys layout
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:12:21 -08:00
David Lawrence a21287c0d1 taking out message when yubikey not found
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:12:20 -08:00
David Lawrence 6acc130e17 list shows where the key is stored
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:12:20 -08:00
Ying Li 4867410e98 Ensure that tests pass and binaries build without the pkcs11 build tag.
Signed-off-by: Ying Li <ying.li@docker.com>
Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Ying Li <ying.li@docker.com> (github: endophage)
2015-11-12 01:10:16 -08:00
Ying Li 087f13ae7d Normalize and elaborate on the command line help.
Ensures that the notary command line help text start with capital
letters, and add information about hardware keys and online/offline operation.

Signed-off-by: Ying Li <ying.li@docker.com>
Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Ying Li <ying.li@docker.com> (github: endophage)
2015-11-12 01:10:03 -08:00
Ying Li 1f1868d3ee Adding integration tests for notary client.
This runs through the basic notary init/add/publish/etc. workflow,
and some basic key workflows.

Note that this does work with the Yubikey, in that created keys while
testing do not require touch.

Signed-off-by: Ying Li <ying.li@docker.com>
Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Ying Li <ying.li@docker.com> (github: endophage)
2015-11-12 01:09:40 -08:00
David Lawrence 91e8b9bcdb backup to a KeyFileStore and take out key remove
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:09:32 -08:00
David Lawrence f9cf7bcca5 remove needs to list keys to find guns
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:09:31 -08:00
David Lawrence 51a99a4127 generate should instantiate a yubikeystore
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:09:31 -08:00
David Lawrence e8d2240c79 write private key to a backup dir when creating keys on yubikey
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:09:31 -08:00
David Lawrence b7c38f0287 fixing tests
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:09:31 -08:00
David Lawrence da18f54699 import-root, list, and remove working with yubikey
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:09:31 -08:00
David Lawrence be4c0669c1 move import/export to cryptoservice and add import to yubikey
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:09:31 -08:00
David Lawrence 07f0065152 ask for pin when signing
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:06:38 -08:00
Diogo Mónica fd0775e1dc Merge pull request #257 from mtrmac/fix-export-root
Fix (notary key export-root)
2015-11-01 10:31:29 +00:00
Miloslav Trmač 62dc66e936 Remove key ID from (notary key import-root)
PR #242 has started requiring a passphrase for the imported key, and
recomputes the key ID, making the command-line argument redundant.  So,
remove it from the command line and from the KeyStoreManager API.

Also updates the comment for KeyStoreManager.ImportRootKey, and changes
(notary key import-root) to refuse unexpected arguments instead of
silently ignoring them.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2015-10-30 20:40:03 +01:00
Miloslav Trmač 93c28ccb1b Fix (notary key export-root)
-c was recently taken over by --configFile; using it for
--change-passphrase as well results in

panic: shorthand redefinition

So, move --change-passphrase to -p.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2015-10-30 20:39:20 +01:00
Ying Li 566bd3ce67 Combine the nonRootKeyStore with the rootKeyStore, and move the abstracting
over the root keys directory from non-root keys directory from keystoremanager
to keystore, since we're eliminating keystoremanager.

Maintain the two separate directories, though, because one can't tell whether
there is an old-style separate-directories structure, or if someone has a GUN
that starts with tuf_keys.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-27 12:33:46 -07:00
David Lawrence 98cde51f18 working basic key rotation for targets and snapshot key. Command is 'notary key rotate [GUN]'
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-09 20:35:06 -07:00
David Lawrence ac54370fb0 cleanup after discussing with Diogo
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-09 19:40:36 -07:00
Diogo Mónica 53467fd417 Merge pull request #85 from docker/simple_test_script
add a simple test script, eventually this can grow to be our CI script
2015-10-08 16:58:44 -07:00
Aaron Lehmann ec3167eedb Import and export symlinks in keystore
- Export symlinks by encoding them in the zip file.

- Detect symlinks in a zip file on import and create them on the local
  filesystem.

- Add test coverage.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-08-03 15:03:31 -07:00
Diogo Monica b04ed5042b Added -y no confirmation and more integration tests
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-30 16:22:14 -07:00
Diogo Monica 27461ad9fb Added cli cert command, changed keylisting to be a map, fixed key removal
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 18:14:29 -07:00
Aaron Lehmann c3cf6c4083 Add a flag to change the password of the root key when exporting it
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-28 15:08:41 -07:00
Aaron Lehmann 3af03daa42 Change "notary keys" command to "notary key"
This makes the full subcommand names smoother; for example "notary key
generate" instead of "notary keys generate".

Add a "notary key list" subcommand to list keys, so "notary key"
lists the possible subcommands, instead of needing to use "notary key
-h".

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-28 13:46:45 -07:00
Aaron Lehmann 558f52530b Add key import and export commands
This adds four commands:

- notary keys export: export all keys, or keys for a particular GUN
  (with -g)
- notary keys export-root: export root key by ID
- notary keys import: import a zip file of keys
- notary keys import-root: import a single root key

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-28 13:46:45 -07:00
Diogo Monica bdd6760c69 Changing key removal message
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 13:30:41 -07:00
Diogo Monica e7fb8ab46c Fixing golint
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 11:47:14 -07:00
Diogo Monica 579f51866b Removed all local keystores, added configurable trust dir
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-28 11:47:14 -07:00
Diogo Monica 58e6544d0a Adding Cert retrieval by common name, and renaming KeyID to CertID
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-17 14:28:30 -07:00