Commit Graph

1309 Commits

Author SHA1 Message Date
Ying Li b51d1e8cf8 Root is always on disk unless restored from backup.
(In which case if Yubikey is available, it will only be on the Yubikey and not on disk.)

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-25 13:37:39 -08:00
Riyaz Faizullabhoy 20648f18e9 Merge pull request #497 from HuKeping/work-branch
Tiny refactor
2016-01-25 09:21:06 -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
David Lawrence 3c874f3080 Merge pull request #474 from endophage/consistent
Consistent TUF Files
2016-01-24 11:10:31 -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
Diogo Mónica 341bd335f5 Merge pull request #475 from docker/repo-info-lib
get all current role information for a repo
2016-01-22 16:31:28 -08:00
Ying Li 08deb7f8ef Merge pull request #484 from docker/update-when-server-error-tests
Add tests for when the server 404's or 50X's when updating
2016-01-22 15:37:45 -08:00
Ying Li 499d5a7c0c Add an extra targets/b delegation chain to the tests.
Also, shorten some of the options (do not specify false, since that's default).

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-21 16:34:53 -08:00
Diogo Mónica e579f101e7 Merge pull request #486 from endophage/fix_offline
tokenAuth should also 'succeed' if we get a 401
2016-01-21 13:36:49 -08:00
Ying Li e79839b216 Add better error reporting for update tests.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-21 13:23:30 -08:00
Ying Li dde9531b4a Fix an error where we get a JSON syntax error on server 404 or 50X.
We were testing to see if the cached metadata was nil, but we actually
set it to an empty data.Signed object, but didn't always set it to nil
if we failed to get local metadata.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-21 13:23:30 -08:00
Ying Li 36684a3290 Use cached timestamp if we get a 404 when updating timestamp.
We use the cached timestamp for all other errors, so this makes the
error consistent.  The only special metadata is the root.json, where a 404
signifies that the repository doesn't exist.  Also update the message
when a cached timestamp is used.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-21 13:23:16 -08:00
David Lawrence 6389c8cf75 tokenAuth should also 'succeed' if we get a 401, which will result in attempting futher authentication later
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-21 11:44:00 -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
Ying Li 803205d8bf Update and add tests for what happens if the remote repo 404's or 500's on root.json.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-20 14:41:54 -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
Diogo Mónica 60e6d254b3 Merge pull request #477 from docker/swizzler
Update tests while messing up metadata
2016-01-20 11:05:34 -08:00
Ying Li df53f51b0b Refactor swizzler to not produce a repo itself, but to just take some initial metadata.
Updated the testutils/repo.go utility to be able to produce a repository with delegations
and to export metadata from said repo instead.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-20 10:02:14 -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
Diogo Mónica b6b5acb0a1 Merge pull request #469 from endophage/fixing_468
Offline operation when server not reachable
2016-01-19 17:18:19 -08:00
Ying Li 1404aa9dad Remove client update tests for which it seems like the user is actively sabotaging themselves.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-19 16:32:34 -08:00
Ying Li edc30ffdb9 Skip the longer client update tests if testing in short mode.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-19 16:28:52 -08:00
Ying Li ea0a64eeab Add a few tests for updating when the local repo is corrupt.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-19 16:28:52 -08:00
Ying Li 4838a90640 Refactor metadata changers into a helper fuzzer object in testutils package.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-19 16:27:01 -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
David Lawrence 33fee1d356 test for returning nil roundtripper from tokenAuth
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-19 15:47:12 -08:00
David Lawrence 46682b71eb if we can't connect to the server when setting up, return a nil roundtripper. Check roundtripper when initializing HTTPStore and substitute an OfflineStore if it is nil.
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2016-01-19 14:34:50 -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 4f8d28ad7f Add tests for updating replacing corrupted local cache
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-19 14:07:46 -08:00
Ying Li b4d3ac881d Add a RemoveMeta function to the MetadataStore interface (useful for testing).
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-19 14:07:29 -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 732b85008e Merge pull request #454 from docker/delete-repo-data
client library and cli deletion functionality
2016-01-19 13:38:45 -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
Ying Li 8dac9fd0cd Merge pull request #478 from HuKeping/minor
Comments: minor typo
2016-01-19 09:46:56 -08:00
HuKeping b044b65f4b Comments: minor typo
Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-01-19 20:33:36 +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
Diogo Mónica e451f635e8 Merge pull request #471 from docker/test_repo_root_cert
Change testutils.EmptyRepo() to use a cert as the root.json root key.
2016-01-18 14:14:06 -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
David Lawrence 560ffd0483 Merge pull request #472 from HuKeping/timestamp2snapshot
Fix a wrong function call
2016-01-18 10:01:32 -08:00
Ying Li aaefd545cf Merge pull request #473 from HuKeping/consistent
Keep a consistent coding style
2016-01-18 09:56:44 -08:00
HuKeping fdc0f04268 Keep code style consistent
GetLeafCerts and GetIntermediaCerts are similiar and a consistent
implementation will be more friendly to those people who wants to read
the code.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-01-18 19:58:02 +08:00
HuKeping ef3932d6b1 Fix a wrong function call
Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-01-18 19:27:28 +08:00
Diogo Mónica 5b90639f75 Merge pull request #465 from docker/test_dropping_keys_in_tufkeys
Test dropping keys in tuf_keys
2016-01-15 19:11:26 -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
Ying Li dd0223f7cf Fix pretty-print keys to not print "." if there is no GUN.
Signed-off-by: Ying Li <ying.li@docker.com>
2016-01-15 18:54:47 -08:00