Commit Graph

305 Commits

Author SHA1 Message Date
David Lawrence 3e96684ba1 Merge pull request #338 from cyli/keydbstore-error
KeyDBStore refactor so that it just directly takes the DB arguments.
2015-12-07 14:33:01 -08:00
Ying Li 8417f6670b KeyDBStore refactor so that it just directly takes the DB arguments.
Rather than create an SQL DB, then create a gorm BD using the SQL
DB.  Also split the Create/Get test into two tests.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-04 10:05:31 -08:00
David Lawrence c2c474b9c6 generalize notary server key storage to be able to handle any role, not just timestamps
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-03 11:25:45 -08:00
HuKeping 9ad415e0b5 Tiny refactor
It's no need to keep the `err` after asserting it should be `nil`, and
we can merge these two logs into one I suppose.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-12-02 19:22:56 +08:00
Ying Li 870fe0fd01 Define injected function types for notary-server/main.getTrustService
Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-30 17:24:28 -08:00
Ying Li 1dd04d4e5d trust_service is now a required section of the notary-server config.
The type must either be "local" or "remote".  Previously, any invalid
configuration would default to a local signing service, but since
a remote signing service is recommended, the user has to specifically
configure a local signing service.  We don't want it to be the
fallback.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-30 17:23:53 -08:00
Ying Li d62ac788a3 Fixed bug parsing trust service info in notary server.
Previously, if it wasn't a remote service, the config parser was
still setting the key algorithm to be whatever was configured.
Now, if we are using a local trust service, the algorithm is always
ED25519.

Also broke the trust parsing into its own function for testing.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-30 17:22:33 -08:00
David Lawrence 5500c81cd9 Merge pull request #304 from docker/server-signer-config
Make the server/signer configurations more similar
2015-11-30 17:06:13 -08:00
Ying Li 7153dc7463 Fix bug with keystore not getting assigned in the signer in the DB case.
Thanks @endophage!

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-30 16:41:07 -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
Ying Li 1670b69a18 Pretty-print certificates from the notary CLI command `notary cert list`
Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-30 16:35:53 -08:00
Ying Li a94a47651f Adds specific memory backend support to server and signer.
The server already supported a memory backend, but now it must be
specified, rather than just being a fallback if no storage is
specified.  This also adds a signer backend to signer, which
previously required a MySQL backend.

Thanks @endophage for the excellent suggestion!

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-30 10:58:57 -08:00
Ying Li f1bd28caf4 The TLS certificates are now relative to the config file used.
Previously, if a relative path was provided, it was relative to the
current working directory to wherever the binaries were run.  Now
it is relative to whatever config file was used.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-30 10:58:57 -08:00
Ying Li c43776d36f Use shared configuration parsing tools in notary-server.
This changes the 'addr' parameter of notary-server's config to
'http_addr', so we can add a GRPC server to notary-server if
necessary.  This also allows environment variables to override
the notary-server config file entries, as notary-signer already
does.

The bugsnag configuration has also been changed so that the
bugsnag parameters are under the "bugsnag" key.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-30 10:58:57 -08:00
Ying Li 9e5ac006ec Use the shared configuration parsing code in notary-signer's parsing.
Also add bugsnag support to notary-signer.

This also changes the 'server.cert_file' and 'server.key_file'
parameters to 'server.tls_cert_file' and 'server.tls_key_file',
respectively, to match notary-server.

Previously, the default alias, which was under the environment
variable NOTARY_SERVER_DEFAULT_ALIAS is now also available in
the config file in storage.default_alias.  The password has
not changed.

Finally, this removes some of the HSM references in notary-signer.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-30 10:58:57 -08:00
Ying Li b1fdea5b56 Add shared config file parsing to the utils package.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-30 10:58:57 -08:00
David Lawrence c4636411bc Merge pull request #309 from docker/rename-keystoremanager
Renamed keystoremanager to certs, and KeyStoreManager to Manager.
2015-11-30 10:56:13 -08:00
Ying Li 6ebb1fc7a8 Just connect to mysql as root, rather than as dockerdemo user with password.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-23 18:05:10 -05:00
Ying Li dbcb56b3bf Renamed keystoremanager to certs, and KeyStoreManager to Manager.
Since it no longer depends upon KeyStore, nor does it manipulate keys
in any way.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-23 17:19:26 -05:00
Diogo Mónica 378888f6d7 Merge pull request #295 from docker/no-stderr-for-cmds
Set the default output for all cobra commands to be STDOUT
2015-11-15 13:12:36 +01:00
David Lawrence d0b3bd2860 headers were still printing when no targets were found
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-15 02:48:33 -08:00
Ying Li 238ee32c78 Set the default output for all cobra commands to be STDOUT
Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-15 02:46:29 -08:00
Diogo Mónica ebc41c8154 Merge pull request #292 from docker/fix-signer-sign
The NotarySigner cryptoservice now implements GetPrivateKey.
2015-11-15 11:33:32 +01:00
Diogo Mónica 04941d90a0 Merge pull request #289 from endophage/pretty_print_targets
pretty printing targets
2015-11-15 11:32:02 +01: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 204a4f1534 The NotarySigner cryptoservice now implements GetPrivateKey.
Previously, because it's a CryptoService wrapper around a remote signer
service, it returned nil all the time.  Now, because signing is done
via private key more than CryptoService, it has to return a PrivateKey.

The key doesn't have private bytes, but can be used for signing.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-15 01:45:21 -08: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
David Lawrence 0088d16bba pretty printing targets
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-14 10:21: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
Diogo Mónica daa844079f Merge pull request #279 from docker/pretty-print
Pretty print output of `notary key list`.
2015-11-14 10:55:33 +01: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 edf0520c9b Remove KeyStoreManager's dependency on a KeyStore.
The root generation code is handled by CryptoService now.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-13 15:00:45 -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
Diogo Mónica b894d98392 Merge pull request #54 from docker/verify_hw_sigs
add verification to yubikey signatures. Attempt to generate sig up to…

Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Diogo Mónica <diogo.monica@gmail.com> (github: endophage)
2015-11-12 01:13:05 -08:00
David Lawrence 9b8645c39f add verification to yubikey signatures. Attempt to generate sig up to 5 times, fail if all 5 are invalid
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:13:03 -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
Diogo Monica f9f118d088 Changing env to be TARGETS
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:04 -08:00
Ying Li 0280a82ae0 Do not back up a root key that is imported into Yubikey.
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:11:43 -08:00
Ying Li 9a01cf091d Add "notary lookup" to the integration tests.
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:11:17 -08:00
Ying Li c82802b800 Move ecdsa_hardware_crypto_service to trustmanager/yubikeystore
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:56 -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