Commit Graph

50 Commits

Author SHA1 Message Date
David Lawrence e09bdd5630 remove signatures that are no longer valid during signing, either because the key is no longer a valid signing key for the role, or the signature is invalid.
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)

Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-03-16 16:03:22 -07:00
David Lawrence cd0b43a6b8 Merge pull request #617 from docker/no-keys-canonical-id
Message canonical key ids on error
2016-03-14 15:18:46 -07:00
HuKeping 206d02ab4d [PATCH 4/8] Add sha512 when updating
Actually there are two way to implement this.

One is check the present hash algorithm first and then only update
what we have.

The other is update/add both sha256 and sha512 no matter whether we
have the hash of sha512 or not.

Personally I prefer the latter, for it brings much less change of the
code and will also not affect the validate of the old clients.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-03-11 10:44:46 +08:00
Riyaz Faizullabhoy 06ba32ea47 Message canonical key ids on error
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-09 21:30:46 -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 729bb88537 addressing review comments
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -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
Riyaz Faizullabhoy fe1c8ea1d8 More robust errors for visitor and walker, improve comments
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
Riyaz Faizullabhoy 22c220d4d2 RemoveTargets with walker
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
Riyaz Faizullabhoy 456e5054a8 Currently always validate role names and restrict paths while walking
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
Riyaz Faizullabhoy 5398bcf4fd AddTargets uses walk and visitor
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
Riyaz Faizullabhoy e279c99daf use walker for GetDelegationRole
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
Riyaz Faizullabhoy a7153aeccb WalkTargets on tuf repo, use in getting targets/roles
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-23 11:55:31 -08:00
Ying Li d8938f76e7 When downloading snapshot, return ErrNotLoaded if timestamp hasn't been loaded. Similarly for targets.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-22 19:16:32 -08:00
Riyaz Faizullabhoy 3a5fbf0033 remove path hash prefix from TargetsDelegations
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-18 17:40:50 -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
Riyaz Faizullabhoy c3c24be66b remove path restriction from getting delegations, use in future visitor
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-15 22:38:41 -08:00
Riyaz Faizullabhoy 10865d2310 addressing review comments
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-15 22:38:41 -08:00
Riyaz Faizullabhoy 1d9e375680 add delegation role methods, more tests
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-15 22:38:41 -08:00
Riyaz Faizullabhoy dcbdc258c1 update the path validation
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-15 22:38:41 -08:00
Riyaz Faizullabhoy d379f9918c add GetBaseRole and GetDelegationRole with path validation
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-02-15 22:38:41 -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 b7eea5f611 Refactor signed.Verify to no longer take a KeyDB, but a RoleWithKeys object.
Also removes several uncovered and unused functions (Unmarshal and UnmarshalTrusted)
of signed/verify.go.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-02-10 15:20:54 -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 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 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
Diogo Mónica 30c488b3b4 Merge pull request #393 from docker/path-fix
use path instead of filepath to express TUF roles
2016-01-04 19:26:13 -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
Riyaz Faizullabhoy 385bd5aa11 fix up style according to comments
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-01-04 16:20:19 -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
Ying Li 34055f8cf7 Code cleanups as per review, and after rebasing.
Signed-off-by: Ying Li <ying.li@docker.com>
2015-12-18 16:51:48 -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 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 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 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 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 5891805b29 addressing review
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-15 16:21:30 -08:00
David Lawrence 79b05d4c0a changelists for delegations
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-14 17:23:47 -08:00
David Lawrence fb5c9b28a4 low level tuf delegation primitives with full test coverage
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-14 10:11:47 -08:00
David Lawrence 1074897040 delete non-root keys from cryptoservice when they get rotated out
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:09:38 -08:00
David Lawrence 519a2ccbe8 removing all errors that aren't in use, fixing one place in memorystore that was using a different errorcode to all other stores, pushing errors into appropriate packages
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-12 01:08:49 -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 2833a88292 adding gotuf to notary
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-27 16:36:06 -07:00