1
0
mirror of https://github.com/docker/docs.git synced 2026-11-05 00:14:17 +03:00
Commit Graph

246 Commits

Author SHA1 Message Date
Riyaz Faizullabhoy
d08ecc770f Update RethinkDB to 2.3.0, gorethink to v2
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-05-03 15:47:30 -07:00
Ying Li
3a313b1dc9 Convert all use of copyKeys to testutils.CopyKeys
Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-27 14:14:39 -07:00
Ying Li
ab7064ea12 Change minimum required version of metadata to be 1, not 0
Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-27 10:58:58 -07:00
Ying Li
04ec865b31 Update all the server validation and generation code to use the builder.
This means that the server cannot accept any roots not signed by an
x509 key whose GUN doesn't match the GUN being updated.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-27 10:58:58 -07:00
Ying Li
b2349a0385 Provide a nice SignAndSerialize testutil function to export metadata from a repo.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-20 16:59:04 -07:00
Ying Li
053c2a5a79 Remove a redundant ErrChecksumMismatch error in tuf/client, since we
already have a ErrMismatchedChecksum in tuf/data/errors.

Also, have the CheckHashes function take a role name so that the
ErrMismatchedChecksum error can include the role name.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-20 11:08:03 -07:00
Ying Li
cc5211cdf6 Fix server validation and client update tests to also test threshold when testing
root rotation with the previous root role.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-19 15:14:14 -07:00
Ying Li
839a1d076f Add support for thresholds, which means signed.VerifyRoot needs to be have just like
signed.VerifySignatures. So remove signed.VerifyRoot and just use signed.VerifySignatures
instead.  Also, to fix some tests, add an additional check for version when validating
metadata since versions can't be negative.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-19 15:14:14 -07:00
Ying Li
b941c10523 Update server validation test to assert that old root roles do not affect
the server validation requirements at all, just the previous root role
(as opposed to a single old key being required)

Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-19 15:14:14 -07:00
Ying Li
3aeae90290 storage/memory's UpdateMany should fail if versions are not higher
Signed-off-by: Ying Li <ying.li@docker.com>
2016-04-19 15:14:14 -07:00
David Lawrence
ae133606ad pass checksum to GetOrCreateSnapshot. One timestamp test now obsolete as we always regenerate a timestamp when regenerating a snapshot, other test has one error change because we now look for an explicit checksum, hence writing incorrect data to DB for the snapshot results in a rather than a
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-04-18 22:07:11 -07:00
Riyaz Faizullabhoy
db2e625341 Transaction-logic for rethink
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-18 17:41:06 -07:00
Riyaz Faizullabhoy
db5d1b6fb8 Write ack and read mode for linearizability on tuf_files table
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-18 15:06:29 -07:00
Riyaz Faizullabhoy
b04a5c00e0 Add more tests and restructure
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-15 10:25:22 -07:00
Riyaz Faizullabhoy
f3854dc390 Add unit tests, remove auth key, cleanup
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-14 19:38:05 -07:00
David Lawrence
edef1cd5c8 tweaking consistent store tests
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-04-14 19:38:04 -07:00
David Lawrence
92c17b754c make notary-signer tests work and add test for signer bootstrap
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-04-14 19:38:04 -07:00
Riyaz Faizullabhoy
29e5b7d449 Add docstrings to fix lint
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-14 19:38:04 -07:00
Riyaz Faizullabhoy
97dcdaf91f Use explicit string slices for secondary index lookup
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-14 19:38:04 -07:00
Riyaz Faizullabhoy
01a988a817 Empty result handling, and err checking
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-14 19:38:03 -07:00
David Lawrence
6ace616c34 bugfixes for rethink integration
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-04-14 19:38:03 -07:00
David Lawrence
fbe14c1a35 rethinkdb doesn't actually support composite primary keys
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-04-14 19:38:03 -07:00
David Lawrence
33f5255c8d need a passthrough bootstrap on TufMetaStore
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-04-14 19:38:03 -07:00
Riyaz Faizullabhoy
d95891e54f Caching logic for TufMetaStorage
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-14 19:38:02 -07:00
David Lawrence
b196a803e2 updating use of indices and queries
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-04-14 19:38:02 -07:00
Riyaz Faizullabhoy
30f356f940 Use consistent meta storage for server binary
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-14 19:38:02 -07:00
Riyaz Faizullabhoy
6d3b017c56 Consistent metastore walks from current timestamp to checksums of snapshot/other roles
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-14 19:38:02 -07:00
David Lawrence
b8c62731a6 adding bootstrapping and config update for notary server
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-04-14 19:38:02 -07:00
David Lawrence
045721250f rethink server implementation
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-04-14 19:38:02 -07:00
Miloslav Trmač
aa596338a6 Add an optionalKeys parameter to signed.Sign
Ordinarily we don't want to continue operating on signed data if the
role's threshold of signatures cannot be me and the signature is unsuable.

OTOH we want to keep signing root.json with all older keys if they are
available (to allow migration), but in that case a missing key is not a
fatal error.

So, split the keys passed to signed.Sign into primary and optional,
treating all current uses as primary and enforcing the role's threshold
only on primary keys.  Also update the single existing test which uses
a missing/unusable key to use the optionalKeys parameter.

Note that only the _presence_ of optionalKeys is optional; if an
optional key exists but signing using it fails, the function will fail.

This temporarily breaks the second ErrInsufficientSignatures check
(optional keys count against the role threshold), but that will be fixed
soon.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-04-13 11:48:36 -07:00
Miloslav Trmač
f23f2093e3 Create enough signatures as role's threshold requires
Tell signed.Sign how many signatures are necessary to sign a role, and
have it fail if it cannot create that many.

For most uses this does not make much of a difference because the
threshold tends to be 1 and signed.Sign was already failing if no key
could be found or if no signature could be created; only >1-threshold
roles now (correctly) fail in additional situations. But the knowledge
of a role’s threshold will be useful in a future commit.

Always use ErrInsufficientSignatures for this failure, whether this is
when loading the keys or actually using them (also fixing
ErrInsufficentSignature documentation to refer to signing and not
verification). ErrNoKeys is no longer returned by signed.Sign.

So, adjust the “snapshot key is not available” logic in
NotaryRepository.Publish accordingly, which also makes it more precise
(actually triggering only when no snapshot key is available).

Now that role's threshold is enforced when signing, update
TestValidateRootInvalidTimestampThreshold to create the second key
necessary to correctly sign the timestamp role.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-04-13 11:48:36 -07:00
Miloslav Trmač
a5da680e90 Modify signed.Sign to use a slice instead of varargs
This is a refactoring with no behavior change, but it will allow adding
more parameters to the function in the future.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-04-13 11:48:36 -07:00
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