Commit Graph

61 Commits

Author SHA1 Message Date
David Lawrence f791c01974 cryptoservices can abstract multiple keystores
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-30 11:05:43 -07:00
David Lawrence 06990fd5a1 integreating with @cyli's improvements
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-30 10:15:52 -07:00
Ying Li 91d54899d7 Add a GetPrivateKey method to cryptoservice so that we can future-proof
cryptoservice having multiple keystores

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-29 16:34:40 -07:00
Ying Li f9019873a6 Merge pull request #243 from endophage/key_types
creating concrete types for the various key ciphers
2015-10-29 14:21:33 -07:00
David Lawrence b7ce16ab6f fixes for Diogo's comments
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-28 19:24:51 -07:00
David Lawrence f73560d839 creating concrete types for the various key ciphers
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-28 16:02:55 -07:00
Ying Li 126691ac9e Update the notary server and signer configs to make use of client authentication.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-28 15:42:33 -07:00
Ying Li 34aecae033 Split out parsing the client TLS in notary-server.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-28 15:40:41 -07:00
David Lawrence daa36b43b7 Merge pull request #242 from docker/unify-root-nonroot-keystore
Unify root nonroot keystore
2015-10-28 13:14:19 -07:00
David Lawrence fa70a79ed7 go fmt was complaining about import order after my sed replacement
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-27 17:22:08 -07:00
David Lawrence 2833a88292 adding gotuf to notary
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-27 16:36:06 -07:00
Ying Li 75b63b84cd Add import/export to KeyStore interface so that the import_export code
makes use of this rather than mangle files manually to import/export
root keys.  (Regular keys it just zips up the whole directory.)

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-27 16:19:14 -07:00
Ying Li 61f9f84254 Use configuration option structures to set up client TLS and server TLS.
Test for if client cert is passed without a client key and vice versa.
Fail in ConfigureClientTLS if only one of client cert/key is passed.
Lint fixes.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-21 18:43:33 -07:00
Ying Li fb1013b997 Add servername to the client TLS config, and use it to build notary-server's
TLS connection to notary-signer.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-19 17:29:54 -07:00
Ying Li 3c58f3cffc Simplify server health check to only check only the key management client.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-16 15:11:19 -07:00
Ying Li 6db76a873e Small cleanup as per review comments
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-16 14:48:05 -07:00
Ying Li 81380e0862 Even simpler - cancel the GRPC call using the context object passed
to the GRPC clients - thanks @endophage!

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-16 09:46:08 -07:00
Ying Li faff328d62 Simplify by using a single buffered channel, instead of having a done
channel and a regular channel - thanks @aaronlehmann!

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-15 11:43:17 -07:00
Ying Li 23a5d42bf6 Use a done channel to clean up and prevent the goroutine from writing
to a closed channel.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-15 11:15:07 -07:00
Ying Li a1edc02b82 Use a function interface instead of declaring an anonymous interface in
the function arguments.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-15 10:34:11 -07:00
Ying Li b94915628b Changing docstring to re-trigger CI
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-15 09:13:24 -07:00
Ying Li 33e031444e Better line wrapping and more comments
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-14 18:10:21 -07:00
Ying Li bca919c65f Making an RPC call would hang forever if the connection to the GRPC server dies
(it just retries to connect, and the RPC call would just block until it does), so change up
how this works by timing out the health check.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-14 18:03:19 -07:00
Ying Li 4028941b3f Add health checks functions to the trust service client API.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-14 13:23:21 -07:00
Diogo Monica c5e3580189 Added base signer Dockerfile, and changed base to be go 1.5.1
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-10-12 17:13:39 -07:00
Ying Li a70605a9e6 Shorten health check name and remove redundant logging
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-08 15:42:14 -07:00
Ying Li 2740fd011a Fix docstring comment
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-07 21:00:01 -07:00
Ying Li 75516a1e84 Add the CheckHealth implementations to the RPC servers, go fmt some other files
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-07 20:51:53 -07:00
Ying Li 701e5df79e Change the rpc Server objects to take a function that can check health
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-07 18:12:51 -07:00
Ying Li a67ed67bdc Add a health check function for the key DB store that verifies we can access the required table
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-07 16:31:24 -07:00
Aaron Lehmann a833f055e2 Change logging to use contexts effectively
Use the github.com/docker/distribution/context package to get a logger
that adds a unique ID and useful information about each HTTP request.

Use this logger in HTTP handlers instead of using logrus or the log
package directly.

Remove [Notary Server] and [Notary Signer] prefixes from log messages.

The distribution/context package was already vendored, so there are no
Godeps changes necessary.

Sample output:

    notaryserver_1 | time="2015-07-31T23:02:01Z" level=debug msg="retrieving timestamp key for docker.com/docker"
    notarysigner_1 | time="2015-07-31T23:02:01Z" level=debug msg="generated ECDSA key with keyID: ea89e7dc49a13feab1e5ed349760b148c3c6ebd86968b2bc6cb0d003a8b79f78"
    notarysigner_1 | time="2015-07-31T23:02:01Z" level=debug msg="generated new ecdsa key for role:  and keyID: ea89e7dc49a13feab1e5ed349760b148c3c6ebd86968b2bc6cb0d003a8b79f78"
    notarysigner_1 | time="2015-07-31T23:02:01Z" level=info msg="CreateKey: Created KeyID ea89e7dc49a13feab1e5ed349760b148c3c6ebd86968b2bc6cb0d003a8b79f78"
    notaryserver_1 | time="2015-07-31T23:02:01Z" level=debug msg="Creating new timestamp key for docker.com/docker. With algo: ecdsa"
    notaryserver_1 | time="2015-07-31T23:02:01Z" level=debug msg="Inserting timestamp key for docker.com/docker"
    notaryserver_1 | time="2015-07-31T23:02:01Z" level=debug msg="200 GET timestamp key" docker.com/docker=gun http.request.host="192.168.99.100:4443" http.request.id=a720da02-4312-48ae-b122-6d4bce9d3b20 http.request.method=GET http.request.remoteaddr="192.168.99.1:58178" http.request.uri="/v2/docker.com/docker/_trust/tuf/timestamp.key" http.request.useragent="Go 1.1 package http"
    notaryserver_1 | time="2015-07-31T23:02:01Z" level=info msg="response completed" http.request.host="192.168.99.100:4443" http.request.id=a720da02-4312-48ae-b122-6d4bce9d3b20 http.request.method=GET http.request.remoteaddr="192.168.99.1:58178" http.request.uri="/v2/docker.com/docker/_trust/tuf/timestamp.key" http.request.useragent="Go 1.1 package http" http.response.duration=29.703624ms http.response.status=200 http.response.written=181

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-31 16:06:56 -07:00
Derek McGowan bd9d7c9c74 Move key database to signer package
The key database is not generally used but only used by the signing service.
Move the implementation to the signer package to be imported by the signer.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-07-30 16:22:47 -07:00
Diogo Monica e568babc0a Added one more test, and fixed delete bug
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-24 06:47:04 -07:00
Diogo Monica b4b364df5f Removing unused hex_bytes.go
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-23 03:45:05 -07:00
Diogo Monica a2a0385c53 Fixing rsa hardware crypto service nil-interface bug
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-22 17:17:02 -07:00
Diogo Monica 6f4e6fffea Fixing protobufs and signer
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-22 16:51:55 -07:00
David Lawrence 81d69a4f5c update signature proto to include sig algorithm
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-22 16:51:55 -07:00
Derek McGowan c35c1ea254 Move passphrase logic to its own package
The logic to retrieve passphrase is generic and may be used by directly by clients.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-07-20 13:02:05 -07:00
Nathan McCauley 38fe6bd45b gofmt across the baord
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 11:00:24 -07:00
Nathan McCauley de6f65b7e7 many testing fixups to support key aliasing
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 11:00:22 -07:00
Diogo Monica 3b261e8972 Removing comments
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-20 10:08:15 -07:00
Aaron Lehmann a9f12f52f8 Implement missing functions in NotarySigner to fully satisfy CryptoService interface
These missing functions aren't used, so they're not strictly necessary
at this point. However, it's cleaner to fully implement the interface
than to have functions that don't work with TODO comments.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-20 09:57:44 -07:00
Aaron Lehmann d2ea9cc0d5 Updates to notary for gotuf's split of PublicKey and PrivateKey interfaces
Functions should now take data.PublicKey or data.PrivateKey instead of
data.Key.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-17 11:35:22 -07:00
Aaron Lehmann 125d72fd77 Big refactor to make signer use cryptoservices
- Add MemoryFileStore, a partial FileStore implementation that doesn't
  persist on disk.

- Create a KeyStore interface that allows pluggable key store types. Use
  this interface in the cryptoservice implementation.

- Add KeyMemoryStore, which uses MemoryFileStore to provide a KeyStore.

- Add GetKey and DeleteKey functions to cryptoservice.CryptoService.

- Refactor the hardware RSA signing service as a CryptoService.

- Replace custom ed25519 code with cryptoservice.CryptoService.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-17 09:33:19 -07:00
Aaron Lehmann 167a07c894 Change notary-signer to use gotuf's key types
This causes notary-signer to use gotuf's Key interface instead of
defining its own redundant types.

We can go further with this in the future by removing the redundant
ED25519 implementation. This would be refactored into the cryptoservice
package, and notary-signer would be changed to use that package's
cryptoservice for key creation and signing operations.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 17:22:46 -07:00
Diogo Monica 657150ca9b Working docker build/docker compose
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-14 15:46:21 -07:00
Aaron Lehmann c82440258f Add documentation for FindKeyByID function
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-14 14:06:52 -07:00
Aaron Lehmann e7e9ef4a0d Don't hardcode RSA algorithm
When we need to find a key from its ID, search all available signing
services. There should only be a few, so this shouldn't have much
overhead. This avoids the need to maintain a persistent mapping between
key ID and the responsible signing service.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-14 10:49:43 -07:00
Diogo Monica 321b155596 Godeps update, removed dependency on rufus
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-14 00:39:03 -07:00
Diogo Monica f03626a10e Refactored Rufus API
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-14 00:23:38 -07:00