Commit Graph

91 Commits

Author SHA1 Message Date
David Lawrence adfbe6938e cleaning up logging
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-24 10:38:55 -08:00
David Lawrence 27961b010e negative tests for get by checksum
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-24 10:38:55 -08:00
David Lawrence 4738760794 get by checksum
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-24 10:38:55 -08:00
Ying Li 200fefbff8 EmptyRepo needs to take a GUN in order to generate a valid cert.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-18 10:46:06 -08:00
Ying Li 0bbf979cf4 Change testutils.EmptyRepo() to use a cert as the root.json root key.
This involves making it use ECDSA keys since we can't generate ED25519 certs.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-15 19:11:17 -08:00
Riyaz Faizullabhoy 8d0ff6c996 Pass original invalid version storage error details into standardized errors
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-14 09:57:36 -08:00
HuKeping 5968823ace Log: improve error logging
When pushing an image to Distribution server with Notary enabled at the
first time, client will try to get the root.json and it will fail since
there is nothing in Notary yet.

This patch enhances the error message by adding the error detail.
- "404 GET notary-distribution:5678/busybox:root"

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-01-13 10:33:14 +08:00
Ying Li cf4b77b760 Revert "switching out to consistently use canonical json for all marshalling of TUF data"
This reverts commit f417c834c4.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-08 14:53:09 -08:00
David Lawrence 11795a4573 rename data.ValidRoles to data.BaseRoles
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-07 17:38:52 -08:00
David Lawrence d52dbde683 removing the ability to configure role names. It adds a lot of complexity without adding much value. If somebody wants custom role names they can implement it at the display level
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-07 17:38:05 -08:00
David Lawrence f417c834c4 switching out to consistently use canonical json for all marshalling of TUF data
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-06 11:15:27 -08:00
Riyaz Faizullabhoy dbb8c1065f use path instead of filepath to express TUF roles
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-04 16:23:02 -08:00
Ying Li 2900423fa2 Minor error message changes
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-22 16:29:28 -08:00
Ying Li 7592a029ef Do not create the delegation metadata when the delegation is created.
Only create it when a target is added to it, or other delegations
are added to it, or when getting a child delegation.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-18 16:37:24 -08:00
David Lawrence d3a54cab25 the empty string should be used in delegation Paths to indicate a role can sign anything
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-18 16:10:43 -08:00
David Lawrence e0dd8c82bf removing TODO for delegated roles on server
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-16 22:00:58 -08:00
David Lawrence ad0582ae9c test that a child role gets removed from the update if it doesn't exist in the parent
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-16 19:27:04 -08:00
David Lawrence a27e4f7471 moving comment about sorting for clarity
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-16 16:44:12 -08:00
David Lawrence 38d2175087 tests for new validation code
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-16 15:06:48 -08:00
David Lawrence 63ecf5f92f server side delegations support in validation and snapshot generation
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-16 15:06:05 -08:00
David Lawrence 8bca542c17 restructuring validateUpdate to get rid of prepRepo
removing attempt in server/snapshot/snapshot.go to regenerate
metadata for roles in snapshot.

Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-11 16:20:20 -08:00
Diogo Mónica ec78a03045 Merge pull request #356 from HuKeping/refactor-mainhandler
Refactor a little to reduce indentation
2015-12-11 11:46:26 -08:00
Miloslav Trmač da7c87f9dc Fix (make vet)
server/handlers/default_test.go:353: GetCurrent passes Lock by value: handlers.failStore contains github.com/docker/notary/server/storage.MemStorage contains sync.Mutex
tuf/store/httpstore_test.go:208: github.com/docker/notary/tuf/validation.ErrBadRoot composite literal uses unkeyed fields

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2015-12-11 19:59:16 +01:00
HuKeping b78823e5c3 Refactor a little to reduce indentation
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-12-11 15:48:09 +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
Ying Li fb9afbc5d8 Server propogates validation failures in the 400 response.
Previously, it just said that the update was invalid, but not why.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-09 15:10:17 -08:00
Ying Li 3aa13e6645 Move validation errors to tuf, since that is the expected server interface.
Also make the validation errors serializable as JSON.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-09 14:04:44 -08:00
Ying Li 4208945fc1 Move the notary errors HTTP errors into the server package.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-09 11:22:49 -08:00
Ying Li 45c740b6b8 Add an invalid update error to the server errors.
This would represent a validation error on the updates, as opposed to
a malformed upload error.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-09 11:16:35 -08:00
Ying Li d59ae2d90f Add the handler for GET-ting a snapshot key.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-07 15:13:58 -08:00
David Lawrence 09a6fa07a1 some tests for the handlers
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-07 12:55:09 -08:00
David Lawrence 91c9b61edb update GetHandler to use new snapshot code
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-07 12:55:09 -08:00
David Lawrence b0c7ef5b88 addressing @cyli's comments
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-07 12:55:09 -08:00
David Lawrence cae5940c70 generate snapshots server side
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-07 12:55:09 -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
David Lawrence a1ec8c69e0 unify the timestamp handler with the handler for getting other tuf metadata
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-02 15:50:54 -08: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 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
Ying Li 7dc0dbec84 Remove the cryptoservice argument to sign
Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-29 16:34:21 -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
David Lawrence 21ee24bc30 fixing vet error in existing notary code
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-27 16:37:41 -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
David Lawrence 8a996f417a updating godeps and notary for some syntax changes in gotuf brought on by golint
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-20 23:56:35 -07:00
Diogo Mónica 52b064b6a6 Merge pull request #174 from docker/logging
Change logging to use contexts effectively
2015-08-10 10:31:21 -07:00
David Lawrence 6616bed616 validation tests
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-08-06 17:38:37 -07:00
David Lawrence 0ece438313 server side validation during updates
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-08-05 14:00:07 -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
David Lawrence f7ca3ef62e make key algorithm configurable for local development with in memory ed25519 crypto service
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-30 11:53:39 -07:00
Diogo Monica b9dd9efe12 Adding default timestamp key to be ECDSA
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-27 17:35:30 -07:00