Commit Graph

1005 Commits

Author SHA1 Message Date
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 b25f8546f8 Ensure that environment variables can override config file entries.
Also support parameterized allowed backends when parsing for
storage backends, so that a DB backend can be tested.

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
David Lawrence 69dae91788 Merge pull request #314 from docker/mysql-user
Just connect to mysql as root, rather than as dockerdemo user.
2015-11-30 10:55:54 -08:00
Sven Dowideit e8dc2097a1 Use FROM docs/base:latest again
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2015-11-26 20:14:11 +10:00
Ying Li 9c3d87d5eb When validating root.json on the server, timestamp threshold must be 1.
This is because the server handles the timestamp key and timestamp signing.
So there can only ever be 1 key.  Thanks @mtrmac for pointing this out.

This change also refactors some of the test code somewhat.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-24 17:47:00 -05:00
Ying Li bd84f3cce1 Address review comments.
Thanks @mtrmac!

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-24 13:55:15 -05: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
Ying Li ff75aefc84 Merge pull request #303 from SvenDowideit/docs-validation-changes
Docs fixes for docs validation
2015-11-19 21:27:01 -08:00
Sven Dowideit 844daf465c Docs fixes for docs validation
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2015-11-20 13:35:38 +10:00
Ying Li e63af87b25 Merge pull request #290 from docker/vet-filenames
Make vet target now also checks for filenames with _test_ in the middle.
2015-11-19 09:16:48 -08:00
Ying Li b4fb4ac173 Change the error message on the client, if the server returns 400.
Previously it was "fatal: Unable to reach trust server at this time: 400."
and now it is "fatal: Trust server rejected operation."

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-18 14:53:28 -08:00
Ying Li 4f8c1a8ef4 Server check that the root.json's timestamp key ID is valid.
If the client sends a root.json with an invalid timestamp key ID,
possibly because they are pushing an existing repo to a new server,
then the server should reject the update.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-18 00:57:40 -08: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
Diogo Mónica 4f347a1303 Merge pull request #296 from endophage/pretty_print_targets
headers were still printing when no targets were found
2015-11-15 13:12:29 +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
Ying Li a05fee7469 Make vet target now also checks for filenames with _test_ in the middle.
Since if they are generic test helpers that should be exported,
they should probably go into their own package.  If they are used
during testing, they should end in _test.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-15 02:42:14 -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
Diogo Monica 2c451909db Fixing wrongly named file that led to test init deleting keys 2015-11-14 12:51:31 +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 517763a26d Merge pull request #280 from docker/remove-get-root
Remove KeyStoreManager's dependency on a KeyStore.
2015-11-13 15:51:42 -08:00
Ying Li 68962ce0f7 Merge pull request #281 from docker/better-pkcs11-logging
Log whether a pkcs11 library was found and if it was loadable.

This unfortunately prints out every time any operation is done on the Yubikey, producing a lot of log output, but perhaps that is better because an operation might fail at any given time.

Output if no Yubikey:
DEBU[0000] Failed to initialize PKCS11 environment: loaded library /usr/local/lib/libykcs11.dylib, but no HSM slots found 

If there is a Yubikey:
DEBU[0000] Initialized PKCS11 library /usr/local/lib/libykcs11.dylib and started HSM session
2015-11-13 15:51:11 -08:00
Ying Li 142da6ccd3 Merge pull request #282 from docker/report-http-error
Fixes client to report problems contacting the remote server.
2015-11-13 15:49:48 -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 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
Diogo Mónica f0ca498474 Merge pull request #278 from docker/bail-if-no-cert
More defensive coding around listing our keys in the yubikey.
2015-11-13 08:01:06 -08:00
Ying Li 8432f9db07 Fixes client to report problems contacting the remote server.
Currently, when listing, publishing, or getting a particular target,
if the remote server errors, the client attempts to load it from a
local cache.  However, if there is no local cache, it just returns
Metadata Not Found for listing and getting.  Have it report the
remote the original remote error instead of Metadata Not Found
locally.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-13 05:26:00 -08:00
Ying Li 54e375c62e Add tests to ensure that the TUF httpstore returns the right error on 5XX.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-13 05:24:51 -08:00
Ying Li f9bd60701f Log whether a pkcs11 library was found and if it was loadable.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-13 02:53:39 -08:00
Ying Li 51cb6e7296 Add github.com/olekukonko/tablewriter dependency to Godeps.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-13 01:41:01 -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
Ying Li 587906e6c6 More defensive coding around listing our keys in the yubikey.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-11-13 00:08:53 -08:00
David Lawrence 45de2828b5 Merge pull request #271 from docker/adding-pkcs11-signed
Adding pkcs11 signed
2015-11-12 01:40:38 -08:00
Diogo Monica d2f69fe5bc Adding another path to search for ykcs libs
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-11-12 01:22:40 -08:00
Diogo Mónica 42cc828865 Merge pull request #56 from docker/last-stuff
Some more tests, one minor change

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:14:05 -08:00
Ying Li 5d0893ef2a Oops, it'd be helpful if we actually ran the new CryptoService 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:14:01 -08:00
Ying Li 87231d9a5d Fix new bug where adding a duplicate key to a yubikey added to the backup.
Added a test for this case as well - thanks @endophage!

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:13:58 -08:00