Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

Conversation

@krnowak
Copy link
Collaborator

@krnowak krnowak commented Mar 11, 2016

This PR:

  • Adds a new, "pubkey" insecure option, so we can temporarily (by creating a second keystore in /tmp) trust keys from HTTP(S). We need this for testing, because local ACI server uses an invalid certificate (apparently for example.com, not for localhost), so to be able to download anything from it, we need to pass a "tls" insecure option. But then, the keys from discovery weren't downloaded at all.
  • Adds a --simple-output boolean flag to all the commands that may fetch images (run, fetch, prepare), so we will print some simple messages about downloading stuff instead of progress bars. I added that because it was sometimes randomly botching the output from gexpect on semaphore and some strings weren't found. This is not a complete fix - there are bugs in gexpect too, that needs to be addressed or already were at upstream, I'll have to see.
  • Makes some small fixes and refactorings in some rkt functions and ACI test server, like actually sending ac-discovery-pubkeys meta tag with a path to the "pubkeys.gpg" from the uploaded file set.
  • Makes some minor fixes I spotted in the meantime, like deduplicating global flags documentation (ew!) or adding a missing --signature flag to the prepare command.
  • Adds the test. It has 108 iterations (generated, instead of written manually so it adds up to complexity a bit, sorry about that) which are basically all combinations of signatures (4), keys on the server (3), keys to be trusted (3) and trusting keys from HTTPS scenarios (3). See the message of the last commit for the details.

Fixes #2070.

@alban
Copy link
Member

alban commented Mar 14, 2016

Can you make independent PRs for the commits adding user-facing API? (--simple-output, pubkey) So they can be discussed separately.

@krnowak
Copy link
Collaborator Author

krnowak commented Mar 14, 2016

Will do.

@krnowak
Copy link
Collaborator Author

krnowak commented Mar 15, 2016

Will rebase this PR, when at least two first PRs are merged.

@alban alban added this to the v1.4.0 milestone Mar 18, 2016
@krnowak krnowak force-pushed the krnowak/trust-discovery-tests branch 2 times, most recently from b0473f0 to 1f8a151 Compare March 31, 2016 13:36
krnowak added 13 commits March 31, 2016 16:02
It makes no sense to go through the discovery process and then through
the trust process just to find out that fetching a signature resulted
in 404 or somesuch.
This adds a special file, "pubkeys.gpg", to test ACI server's fileset.
If it is available, the server will send the ac-discovery-pubkeys meta
tag too.
Asking the user whether the user really trusts the key can happen in
two situation - when running rkt trust or when running rkt fetch with
--trust-keys-from-https set to false. Split out the function replying
to the question from the function calling rkt trust. The new function
will be used when testing various trust scenarios during rkt fetch.

Also, changed the function a bit to take a boolean parameter telling
whether to answer yes or no to the question.
If the signature file already existed, gpg asks us to confirm that we
want to replace the old signature with the new one. We don't handle
the case, so we hang until the tests time out.

Fix it by deleting the signature file before creating a new one.
So we can pass a gpgkey instance instead of just an index.
This is to allow the signature file be called differently than image
filename + ".asc" suffix. Will be useful for generating wrong
signatures to be uploaded to test server to impersonate good ones.
Just a single place doing it, instead of getting the value of the
FUNCTIONAL_TMP environment variable.
The first two keys will be used as good and wrong key respectively in
the trust discovery test. But we will need a separate key for singing
stage1 image, so that the key does not interfere in the tests. Signing
the stage1 image is necessary since recently for stage1 images passed
to rkt via --stage1-path.
This basically tests all the combinations of signatures (missing,
signed wrong image with good key, signed wrong image with a wrong key,
good), keys (both to be trusted and on the server; missing, wrong or
good), trusting keys from https (rejecting the review, accepting the
review and actually trusting them).

It doesn't test the --signature parameter (which tells rkt to use some
local signature instead of the remote one), it probably could be done
in a separate test, to avoid complicating the test even more.

It is using stub stage1 image to get the 4-5x speedup, so even if
there are 108 combinations, it still should take less than a minute.
@krnowak krnowak force-pushed the krnowak/trust-discovery-tests branch from 1f8a151 to bf3dc24 Compare March 31, 2016 14:02
@alban
Copy link
Member

alban commented Apr 13, 2016

@krnowak The 3 PRs mentioned above are either merged or closed. Is there still something to do in this PR? If so, it needs a rebase.

@alban alban modified the milestones: v1.5.0, v1.4.0 Apr 13, 2016
@tmrts tmrts modified the milestones: v1.6.0, v1.5.0 Apr 28, 2016
@jonboulle
Copy link
Contributor

Ping

@jonboulle jonboulle modified the milestones: v1.7.0, v1.6.0 May 12, 2016
@alban alban modified the milestones: v1.8.0, v1.7.0, vfuture May 23, 2016
@alban
Copy link
Member

alban commented May 23, 2016

This task does not have a owner.

#2070 has milestone vfuture. Moving this the same.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: add more tests for rkt trust and signed images

5 participants