Commit Graph

166 Commits

Author SHA1 Message Date
Riyaz Faizullabhoy 0369344a78 split client.go into delegations.go
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-02 17:10:07 -08:00
Riyaz Faizullabhoy 9c84547853 Add tests against old style changes and clear paths
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-02 17:01:35 -08:00
Riyaz Faizullabhoy 70ee4f8670 PoC broken down client api for delegations
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-02 17:01:35 -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 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
Riyaz Faizullabhoy a16e6b58b5 use only canonical IDs for display on delegation CLI commands, translate to TUF key IDs for metadata usage under the hood
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-29 16:00:42 -08:00
Riyaz Faizullabhoy 41643d4a9c make -1 read up to 100MB of data, use for non-timestamps. Reduce
timestamp to 1MB max

Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-28 10:17:17 -08:00
Riyaz Faizullabhoy a6159a45d1 ensure filestore GetMeta only returns up to size bytes. Standardize constant for max size
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-28 10:16:19 -08:00
HuKeping 3cd3614de6 Tiny refactor
Just to keep consistent with the others.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-01-25 15:14:08 +08:00
Riyaz Faizullabhoy 25a1e9aed7 change to ListRoles, and GetAllLoadedRoles
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-20 15:58:55 -08:00
Riyaz Faizullabhoy a052d9e105 client library for retrieving keys and signatures for all roles
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-20 12:00:09 -08:00
Ying Li 3c72ef762b Merge pull request #482 from docker/random-lint-fix
Add some comments about the notary constants, and other lint fixes.
2016-01-19 23:39:11 -08:00
Ying Li 6f2e851b29 Merge pull request #479 from docker/remove_to_lower
Do not lowercase role names when adding a change
2016-01-19 16:22:41 -08:00
Ying Li 2ff7bf6375 Add some comments about the notary constants, and other lint fixes.
It seems that `make vet` sometimes disagrees locally vs on CircleCI.  This
just fixes my local `make vet` complaints.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-19 15:55:47 -08:00
Ying Li a3b9a5543f Do not lowercase role names when adding a change
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-19 14:32:00 -08:00
Ying Li cf0bb5a9be Merge pull request #440 from docker/diogo-cli-adding-delegations
delegation command for notary-cli
2016-01-19 13:54:56 -08:00
Riyaz Faizullabhoy ca67f1e71a client library deletion functionality, and integration into remove cert
CLI

Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-19 11:18:33 -08:00
Riyaz Faizullabhoy 138d6cea09 Add, remove, and list delegation command. TUF changelist action change
for deletions (force vs. individual items)
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-18 16:24:45 -08:00
David Lawrence c0fb05584e fixing incorrect comments
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-15 11:30:32 -08:00
David Lawrence 9e80ad8158 remove certs.NewManager function
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-15 11:30:32 -08:00
David Lawrence a8b21cafe0 CertManager is completely removed
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-15 11:30:32 -08:00
Ying Li d4820c5756 Translate ErrMetaNotFound when updating, so long as it's on root, to ErrRepositoryNotExist.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-14 15:27:11 -08:00
Ying Li f57f2beb08 Factor marshalling a SignedRoot into JSON into TUF/data/root.go, and
add an injectable serializer (so we can test JSON marshalling/unmarshalling
error propagation).

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-14 10:51:24 -08:00
Ying Li b74f1835b7 Ensure that we do not unnecessarily re-sign/serialize a root.json file on publish
Adds additional tests to ensure that keys aren't unnecessarily created on error,
and that only the required keys to sign are used.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-14 10:51:24 -08:00
Diogo Mónica 26d3f3f92b Merge pull request #413 from endophage/fix_root_download
fixing bootstrapClient to prefer cached root
2016-01-13 15:48:39 -08:00
David Lawrence 06d23e14c9 add test for invalid remote URL
add offline store for use when we can't initialize a remote store
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-13 15:26:57 -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 6d72fe7fd1 adding comment to bootstrapClient
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-08 09:03:27 -08:00
David Lawrence d11f11748c when we download during bootstrapClient we should save the root to cache
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-08 09:03:03 -08:00
David Lawrence 762c997104 fixing bootstrapClient to prefer cached root
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-08 09:03:03 -08:00
Ying Li c1c0ccf4be Combine bootstrapClient and tuf/client's Client.Update into NotaryRepository.Update.
- it is easier to understand what's going on in the online functions of NotaryRepository
- we can test NotaryRepository.Update independently (although it'd be nice to have some way
  of ensuring that the actual public functions of NotaryRepository like ListTargets,
  GetTargetByName, and Publish actually calls Update.
- distinct error if the remote repo doesn't exist.

This also stops wrapping signed.ErrExpired in client.ErrExpired, and just passes
signed.ErrExpired on directly.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-07 16:58:46 -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
Ying Li 61bbf7be49 Change ListTargetes and GetTargetsByName to return TargetWithRole.
This object has both the target and the role in which the target was found.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-04 17:15:44 -08:00
Ying Li 9252d9d892 Update client.Target to include a RoleName, so we know where the target is when listed.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-04 10:49:54 -08:00
Diogo Mónica ffca6fb522 Merge pull request #388 from docker/cleanup
Rebased cleanup/remove PEM headers
2015-12-23 11:36:25 -08:00
David Lawrence fa788cb2a9 make x509 certs viable as delegated public key object
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-23 09:41:03 -08:00
Riyaz Faizullabhoy 98b7dd7daf fixes to notary for docker integration
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2015-12-22 16:53:31 -08:00
Ying Li 0892ebb13f Add checks to TUFRepo to fail on updating a target if there are no signing keys.
So UpdateDelegation, DeleteDelegation, AddTargets, RemoveTargets now
all check for the role existence, not metadata existence.  And they
also check the role's signing keys - there's no point in adding if
we can't sign.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-18 16:37:24 -08:00
Ying Li a1cbe5d43c Add test for, and fix bug with, publishing a bare repo not sending the targets file.
It should always be published the first time, like the root.json.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-18 16:37:24 -08:00
Ying Li c12958af36 Do not sign the actual targets metadata unless it's dirty.
Previously we were always signing it, but we can't do that anymore
because then delegated users won't be able to publish ever (they
probably don't have the target key).

Some other related changes: when role keys are rotated, that role
needs to be marked as dirty now in order to be re-signed and
published.

Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-18 16:37:24 -08:00
Ying Li 3ecba24410 When publishing, also publish all the dirty targets roles.
This is in addition to the canonical targets role, which always gets
re-signed and publish (we may want to revisit this later).

This makes some tests pass - still need to do fallback of roles
and publishing a created delegation role without necessarily
having the signing key for that role.

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 a2a4870512 adding comment about priority ordering and updating test for ListTargets with delegates to hit default no roles passed case
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-18 11:21:12 -08:00
David Lawrence 574b4d543d updating ListTargets delegate test to check iteration of children and correct (lack of) overwriting.
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-17 21:28:52 -08:00
David Lawrence 9307692b52 reverse priority order or roles for ListTargets and GetTargetsByName
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-17 16:33:52 -08:00
David Lawrence 594049b24f fixing download to continue if we get ErrMetaNotFound
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-17 15:53:57 -08:00
David Lawrence f72f799806 fixing up ListTargets and GetTargetByName to process prioritized roles more efficiently
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-17 14:56:05 -08:00
David Lawrence 4243b258b3 making GetTargetsByName work with delegations
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-17 10:46:41 -08:00
David Lawrence 4694178bbe download delegation test
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-17 10:09:34 -08:00
David Lawrence 377b72a54f updating list targets to list across multiple roles
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-17 10:09:34 -08:00