Commit Graph

318 Commits

Author SHA1 Message Date
David Lawrence
f2ec72b5b6 aliases removed from file names
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-23 09:41:03 -08:00
David Lawrence
6d5b8ff54a add role into PEM headers
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-23 09:41:03 -08:00
David Lawrence
377b72a54f updating list targets to list across multiple roles
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-17 10:09:34 -08:00
Ying Li
20c557a10b Merge pull request #291 from docker/server-docs
Server and signer docs
2015-12-15 13:26:08 -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
54c7de5bd6 Update the server and signer docs to reflect new code changes.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-11 12:26:48 -08:00
Ying Li
c77bbee0ef Merge pull request #351 from cyli/better-validation-errors
Propagate error validations from server to client
2015-12-10 21:29:57 -08:00
Ying Li
6aa114a49f Fix all instances where 'propagate' was mispelled as 'propogate'
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-10 15:12:05 -08:00
Miloslav Trmač
3c6335c572 Explicitly supply validity times to certificate generation
Add explicit startTime and endTime parameters to
cryptoservice.GenerateCertificate and trustmanager.NewCertificate.

trustmanager.NewCertificate as a low-level data manipulation function
should not be hard-coding policy (10-year expiration); that policy
belongs to its callers, or one more level higher to callers of
cryptoservice.GenerateCertificate.

These places hard-coding policy now also have an explict comment to
that effect.

In addition to conceptual cleanliness, this will allow writing tests
of certificate expiry by generating appropriate expired or nearly-expired
certificates.

Tests which don't care about the policy much will continue to use the
just added cryptoservice.GenerateTestingCertificate.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2015-12-09 20:02:10 +01:00
HuKeping
639f1e80f0 Use the function to parse viper on server side
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-12-09 09:17:25 +08:00
HuKeping
bfe7316de9 Add a function to parse viper
None of these `filename`, `ext` or `configPath` should be in `main`,
they are all just for creating a instance of Viper and then nothing.
Do it in a separate function will make the function `main` more readable.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-12-09 09:17:24 +08:00
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