Commit Graph

214 Commits

Author SHA1 Message Date
Ying Li
7404f4ff55 Embed SignedCommon in Root, Snapshot, and Timestamp, as it's already
embedded in Targets.  This way we can easily get a SignedCommon object
out after calling RootFromSigned, etc.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-07 17:27:13 -07:00
Ying Li
15908298bd Use require, not assert, in server/... tests.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-04 17:18:53 -07:00
HuKeping
67b0ec3771 Use constant for snapshot
Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-28 17:21:24 +08:00
Ying Li
e8cdc32f0b Clean up after rebase and address review comments
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-23 13:24:52 -07:00
Ying Li
210eab829f Error (and add tests for this) if the root in the server store is corrupt
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-23 13:24:52 -07:00
Ying Li
3b80293a0c Add test cases generating a timestamp from previous timestamps
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-23 13:24:52 -07:00
Ying Li
433a298a8b Simplify the validateRoot logic in server validators
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-23 13:24:52 -07:00
Ying Li
c0796f17ef Rename 'validateSnapshot' to 'loadAndValidateSnapshot' since it loads now
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-23 13:24:52 -07:00
Ying Li
d3bb063fb2 Update the server to generate the timestamp on update, just like snapshot.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-23 13:24:52 -07:00
Ying Li
1b919fac35 Change GetOrCreateSnapshot to only create a new snapshot if the old is expired.
This is in preparation for the server validation automatically generating a snapshot
when an update is applied.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-23 13:24:52 -07:00
Ying Li
49be037bdd Change GetOrCreateTimestamp to only create a new timestamp if the old is expired.
This is in preparation for the server validation automatically generating a timestamp
when an update is applied.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-23 13:24:52 -07:00
David Lawrence
9ff2558f81 unifying timestamp generation code so server/timestamp/timestamp.go isn't going its own unique version
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-03-23 13:24:52 -07:00
David Lawrence
bfee37d471 update top level Signed.Signed to be a *json.RawMessage
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-03-18 16:18:53 -07:00
Riyaz Faizullabhoy
9ecd899e25 Removing key import and gun from cryptoservice
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-18 11:31:03 -07:00
Ying Li
e25746dac3 Use a CacheControlHandler that wraps other handlers instead
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-14 17:19:13 -07:00
Ying Li
e1397f4b03 Use updated-at for last modification date for getting current metadata
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-14 17:18:18 -07:00
Ying Li
9b022a9cda Modify server handler to set cache headers based upon a cache configuration object
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-14 17:18:18 -07:00
Ying Li
802673fc9d Add cache control headers to Getting metadata
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-14 17:18:18 -07:00
Ying Li
8768c12901 Return the creation date for GetChecksum and GetCurrent from the server database store.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-14 17:18:18 -07:00
HuKeping
6cd6b4726c [MISC 1/4] Tiny refactor
Reduce function "snapshotExpired" in a simpler form and replace the
literal string by the constants defined in the data package.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-11 16:43:44 +08:00
HuKeping
4d9e2e5e16 [PATCH 7/8] Update the server side
Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-11 10:45:01 +08:00
Ying Li
d45b9f86ef Fix mispelling of 'occur'
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-07 17:22:41 -08:00
Ying Li
c720c56a70 Move all imports of sqlite3 to tests only
Signed-off-by: Ying Li <ying.li@docker.com>
2016-03-01 14:56:53 -05:00
David Lawrence
cb2dd07edc the server was not setting the longer snapshot expiry time. When generating a timestamp it was also retriving the snapshot directly from the database and only validating the checksum still matched what was in the timestamp. Due to the addition of consistent downloads, this mean a new snapshot never got generated. It is necessary for GetOrCreateTimestamp to call GetOrCreateSnapshot to ensure a new snapshot is generated as and when required
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-02-24 15:51:31 -08:00
Riyaz Faizullabhoy
bde878cdb6 changing API for updating delegations
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:57:08 -08:00
Riyaz Faizullabhoy
06e34e825a walk for updating/creating delegations, validate changes to paths
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
Ying Li
314cfb9a17 Add targets metadata validation to the targets data structure
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-22 19:16:32 -08:00
Ying Li
36ea1f6901 Add root metadata validation to the root data structure
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-22 19:16:32 -08:00
David Lawrence
d1ac37fd33 addressing review comments
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-02-17 16:31:48 -08:00
David Lawrence
1db128778d completely removing KeyDB
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-02-16 21:11:13 -08:00
Riyaz Faizullabhoy
b46391ee8f Remove RoleWithKeys
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-16 10:07:00 -08:00
Ying Li
ac265186ee Rename repo.GetRole to repo.GetRoleWithNames and use the Keys data structure more.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-11 09:51:08 -08:00
Ying Li
3b3cc3f152 Update server handlers to pass the RoleWithKeys to signed.Verify instead of KeyDB.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-10 15:21:05 -08:00
David Lawrence
c07c7b49c2 removing last vestiges of target download code
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-02-02 11:39:17 -08:00
David Lawrence
905cbb7852 Merge pull request #531 from endophage/metrics_url
update metrics endpoint
2016-02-02 10:33:40 -08:00
David Lawrence
f26a5c3c57 update metrics endpoint
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-02-02 09:52:43 -08:00
David Lawrence
637a2331d4 client side of consistent downloads
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-29 16:52:58 -08:00
Jessica Frazelle
a64db12c04 change url from jfrazelle/go to docker/go
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2016-01-26 08:43:38 -08:00
David Lawrence
d38d7ceb89 moving checksum after role in urls. We're breaking with spec for an easier to manage filename system
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-24 10:38:55 -08:00
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
David Lawrence
6f7acb6ddf adding server logic for clients to request consistent TUF files
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
Diogo Mónica
e8e4155005 Merge pull request #438 from endophage/db_sha256_column
adding sha256 column to tuf_files database table
2016-01-13 15:48:29 -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
David Lawrence
5a9e06fe5c adding sha256 column to tuf_files database table
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-11 17:31:01 -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