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
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