-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify image signature #13585
Verify image signature #13585
Conversation
@smarterclayton @miminar can you guys review this pls? |
d2b074a
to
c47f0ad
Compare
Which one is that? github can’t find it. FWIW some points to consider WRT the c-i-verify-image-signature branch:
|
Well, now I see it: “Manually add vendor/github.com/opencontainers/image-spec/specs-go/v1/ : I have no idea how to make Godeps copy this in it seems.” That commit is not “controversial”, it’s flat out wrong; I just couldn’t find a working solution quickly when preparing the prototype. Hopefully someone familiar with the OpenShift use of Godeps can find it trivial to do the right thing; if not, I’d have to do some digging. |
@mtrmac i made it so our commit checker won't scream, but I want to ask why you need to manually add those |
It’s not that I want to add them manually. This definitely should be done by using |
@mtrmac i think my question was more like if the |
@mtrmac I think I realized why this will not work:
This is what basically @smarterclayton would adding two extra packages to the build process acceptable? Note that those are disabled by a build tag that force it to build with Go openpgp instead... But we need to get them because godep sux :-( |
N/A? OpenShift does not currently, AFAICS, depend on the above-quoted package at all. This PR is adding the dependency; so I don’t know what newer/older is referring to. |
That does not quite explain why I wasn’t able to use godep for that, because I do have all the necessary headers to use |
(btw. I am waiting here for the 1.6 rebase to land and then do the godep restore one more time...) |
I figured it out, it can be squashed to the initial addition as the revision you used in Godeps.json includes
You do, but if our Jenkins or any Origin developer will do At this point, I will just wait for the rebase to land (maybe I will start rebasing this on top of kubernetes 1.6 rebase when it gets stable) and we target to merge this for origin 3.6 (after 1.6 rebase lands, so we don't mess the guys doing the rebase...) Meanwhile, are there any review comments on the current PR/approach that should be addressed (besides godeps), or is this good to go after we are unblocked on the rebase? @smarterclayton @soltysh @miminar PTAL as well, this is required from PM in 3.6 |
hack/common.sh
Outdated
@@ -187,6 +187,8 @@ os::build::internal::build_binaries() { | |||
version_ldflags=$(os::build::ldflags) | |||
|
|||
# Use eval to preserve embedded quoted strings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The eval
comment should be followed by the eval
statement.
// verifySignature verifies the image signature and returns the identity when the signature | ||
// is valid. | ||
func (o *VerifyImageSignatureOptions) verifySignature(pc *signature.PolicyContext, img *imageapi.Image, sigBlob []byte) (string, error) { | ||
// Pretend that this is the only signature of img, and see what the policy says. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought, this doesn't take into account any policy file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtrmac ^ i thought we are not going to require policy.json here at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvmd. this is referring to PolicyContext which we create in caller of this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought we are not going to require policy.json here at all.
This is up to you.
The code as is right now includes ed7bc58 , which uses policy.json
.
#13585 (comment) instead proposes another alternative, asking the user to provide a keyring and using only that one.
(The original PR was using the user’s default keyring by default; that’s plausible but not obviously the right thing to do: Habitual GPG users tend to have keyserver-options auto-key-retrieve
in ~/.gnupg/gpg.conf
, i.e. the default keyring contains various keys with varying levels of trust for email and such, which tends to have very little intersection with trust for running containers. The current containers/image API does not make it trivial to use the signature verification code with “all of ~/.gnupg
” as the set of trusted keys, hence the two proposed alternatives above.)
return "", errors.New("internal error: signature rejected but no error set") | ||
} | ||
if err != nil { | ||
return "", fmt.Errorf("signsture rejected: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
return "", fmt.Errorf("signsture rejected: %v", err) | ||
} | ||
|
||
// Because s.Content was the only signature used above, we now know that s.Content is acceptable, so untrustedInfo is good enough. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is outdated and doesn't make sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT this comment still applies: It was trying to say that we are calling an UntrustedSignatureInformation
function but presenting the key ID as a trusted value, and the comment justifies why this is a safe thing to do. (Feel free to leave it out if you think this does not need pointing out.)
// fakeDockerReference is containers/image/docker.Reference, except that only provides identity information. | ||
type fakeDockerReference struct{ ref reference.Named } | ||
|
||
// parseReference converts a string, which should not start with the ImageTransport.Name prefix, into an Docker ImageReference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseDockerReference
@@ -115,9 +112,6 @@ func (s imageStrategy) PrepareForUpdate(ctx kapi.Context, obj, old runtime.Objec | |||
if err = api.ImageWithMetadata(newImage); err != nil { | |||
utilruntime.HandleError(fmt.Errorf("Unable to update image metadata for %q: %v", newImage.Name, err)) | |||
} | |||
|
|||
// clear signature fields that will be later set by server once it's able to parse the content | |||
s.clearSignatureDetails(newImage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method doesn't seem to be used anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nuked.
func NewCmdVerifyImageSignature(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command { | ||
opts := &VerifyImageSignatureOptions{ErrOut: errOut, Out: out} | ||
cmd := &cobra.Command{ | ||
Use: fmt.Sprintf("%s IMAGE [--confirm]", name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should mention --expected-identity=…
since it's mandatory argument.
I'd prefer just %s IMAGE EXPECTED_IDENTITY [--confirm]
, but I'm repeating myself.
By default, this command will not record a signature condition back to the Image object but only | ||
print the verification status to the console. | ||
|
||
To record a new condition, you have to pass the "--confirm" flag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The help should mention that verifying single signature using different --public-key
will clear verification status from all the other image signatures not signed by this key.
And the same for expected-identity
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dump question, but can I verify just single image with this key? Is it possible to specify multiple public keys when validating multiple images?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read further, when only single image is verified at the time, how can I clear status from other images. Seems odd reading this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dump question, but can I verify just single image with this key?
The command works on single image. The problem is that the command can verify at most one signature at the time. The image can have multiple signatures though.
Is it possible to specify multiple public keys when validating multiple images?
Currently not but may be nice. I wouldn't make it a requirement for this PR though.
how can I clear status from other images
I think a script or oc observe
are your best options.
Seems odd reading this.
Agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to specify multiple public keys when validating multiple images?
That depends on what the verification mechanism will end up being (see #13585 (comment) ), but so far all of the alternatives (policy.json
, manually-created single-rule policy, manual SignatureMechanism
invocation) accept a GPG keyring, which can contain several public keys; any of the keys is equally acceptable. (When that keyring is specified for a command, all images verified using that command would use the same keyring and the same complete set of public keys; it is not a 1-1 image-key mapping.)
c47f0ad
to
4e34ccd
Compare
[test] interesting... it seems like just flakes. |
[test] |
[test] |
func NewCmdVerifyImageSignature(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command { | ||
opts := &VerifyImageSignatureOptions{ErrOut: errOut, Out: out} | ||
cmd := &cobra.Command{ | ||
Use: fmt.Sprintf("%s IMAGE EXPECTED_IDENTITY [--confirm]", name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The EXPECTED_IDENTITY
suggests that the identity is a positional argument (something passed without leading --option
on a fixed position). I like that, but the code below still defines --expected-identity
and expects len(args) == 1
which is wrong. To keep the help message as is, the --expected-identity
needs to go away and the identity needs to be fetched from args[1]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will "%s IMAGE --expected-identity=EXPECTED_IDENTITY [--confirm]"
do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mfojtik sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you hate positional args? 😄 I don't get it. 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@miminar if we ever want to add additional args with expected something, then we will have to keep adding to positional args which is ugly ;-) I want admins to know what they are doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just find --expected-identity=
too long to be given every time. This limits the usage of the tool really just to scripts. But it's just a subjective observation. I don't push you to any further changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes it long, but on the other hand it makes it really explicit on what are you expecting to be in the signature and it also helps understand what that flag is for. Otherwise it might look really strange to provide the name of the image (sha256:xxxxxxx) and then, again a name of the image...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left you some comments, the only part I didn't inspect carefully is the code verification. I guess there are more knowledgeable people to verify it.
"Rev": "c07f8fdceeda1517556602778a61ba94894e7c02" | ||
}, | ||
{ | ||
"ImportPath": "github.com/containers/storage/pkg/homedir", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get this part a separate commit, for clear history?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for hating me :-) sure it can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not about hating you, I ❤️ you man! It's about having clear history when and what was added 😉
Godeps/Godeps.json
Outdated
@@ -1964,6 +1964,10 @@ | |||
"Rev": "5cbbc6bafb45bd7ef10486b673deb3b81bb3b787" | |||
}, | |||
{ | |||
"ImportPath": "github.com/mtrmac/gpgme", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are planning on using fork, create one under openshift org.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not an OpenShift-specific fork; containers/image
and projectatomic/skopeo
use the same one. See proglottis/gpgme#6 for the full history behind creating it. Hopefully it will eventually go away.
If OpenShift wants to take over that fork and commit to maintaining it, sure, why not. I don’t see how OpenShift benefits (especially because OpenShift opts out of actually using anything in this package, using the containers_image_openpgp
build tag), but I’d be only too happy to hand over this responsibility :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I wasn't aware of the full story behind it.
|
||
var ( | ||
verifyImageSignatureLongDesc = templates.LongDesc(` | ||
Verifies the imported image signature using the local public key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imported where? Is this only against images from the internal registry, if so be explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clarified.
By default, this command will not record a signature condition back to the Image object but only | ||
print the verification status to the console. | ||
|
||
To record a new condition, you have to pass the "--confirm" flag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dump question, but can I verify just single image with this key? Is it possible to specify multiple public keys when validating multiple images?
By default, this command will not record a signature condition back to the Image object but only | ||
print the verification status to the console. | ||
|
||
To record a new condition, you have to pass the "--confirm" flag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read further, when only single image is verified at the time, how can I clear status from other images. Seems odd reading this.
}, | ||
} | ||
|
||
cmd.Flags().BoolVar(&opts.Confirm, "confirm", opts.Confirm, "If true, the result of the verification will be recorded to an image object.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest using record
here, rather than confirm. The former suggests that something has to be recorded from the operation, see --record
in oc apply
. Whereas confirm, suggests confirmation, that's not what happens here, you're not doing any dry run which needs to be then confirmed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@soltysh --record
records the command into an annotation. it will be confusing if it has different behavior for verification?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me --confirm
holds this type of confusion right now. Whereas --record
seems more reasonable. @openshift/cli-review wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--record=false: Record current kubectl command in the resource annotation.
This is clearely not this case, since --record
will do more than recording an annotation. We also have --confirm
for pruning and importing image stream, so I will want to keep it --confirm
just for the sake of consistency.... you spend too much time in kubectl world @soltysh :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me --confirm
+ verify
does not sound good enough. --confirm
for pruning is because the initial operation is dry-run, and you need to explicitly confirm it. Not sure how this applies to signature verification. I'm not saying --record
is the best option, I'm just arguing against using --confirm
. Maybe something else should be used here, that's why I asked @openshift/cli-review, we developers are soooo bad at naming things 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"record", "log", "post", "confirm"... No perfect option, IMO.
As a user I assume this is the default. Why do we need this option? I would rather add a "do not record status" flag later based on user feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One reason to include this option is if the user does not have privilege to write the verification status. I'm okay with not writing the status as long as we report that to the user.
Another use case is if someone has an incorrect public key. They would be annotating incorrect status.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Record is very specific to apply today.
Confirm is when we ask the user a question. Force is when we override a safety default. We're not doing either here. --save
is probably the closest to what you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with --save. Thinking through this, there are probably plenty of use cases to justify a --save=false default. Ignore my noise above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm taking --save
as our best option. thanks!
LastProbeTime: now, | ||
LastTransitionTime: now, | ||
Reason: "verified manually", | ||
Message: fmt.Sprintf("verified by user %s", o.CurrentUser), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verified by %q, would give use nice verified by 'userA'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also records quotes into API object ;-) i don't mind honestly, but I found no quotes nicer as they don't have to be escaped.
} | ||
|
||
// fakeDockerReference is containers/image/docker.Reference, except that only provides identity information. | ||
type fakeDockerReference struct{ ref reference.Named } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fake suggests it's used for testing, pick a different name, eg. identityOnlyDockerReference
, dummyDockerReference
. I think, I'm leaning towards the former.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you must be looking at outdating commit, this was removed already.
formatString(out, "\tType", s.Type) | ||
if s.IssuedBy == nil { | ||
// FIXME: Make this constant | ||
formatString(out, "\tStatus", "Unverified") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think <none
would make it more explicit and stand out more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it should be either "verified" or "unverified". Any image that was not verified manually is "unverified"... "<none>" might be misleading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like using the negation - generally we try to have status constants that are significantly different from each other. The constants are what are important - why not simply output the conditions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smarterclayton I thought we want to have clear message about "verified vs. unverified" image. Returning only conditions gives a person who is familiar with them clue about the verification status but I don't think it will make it obvious.
`) | ||
) | ||
|
||
type VerifyImageSignatureOptions struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are needed, preferably unit and cmd, but at least one is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will have to be a follow up and we have to rely on QE manual testing of this for now.
having a test for this will require infra changes (need a gpg key, skopeo installed, copying signed image, genering public key, etc..)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sigh.... I'm ok with a followup (at least partially) + QE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue created...
2967181
to
479caf0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One godep I'd suggest to turn into a openshift fork + the flag naming is my only objections. All the rest lgtm.
Godeps/Godeps.json
Outdated
@@ -1964,6 +1964,10 @@ | |||
"Rev": "5cbbc6bafb45bd7ef10486b673deb3b81bb3b787" | |||
}, | |||
{ | |||
"ImportPath": "github.com/mtrmac/gpgme", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not addressed.
cmd.Flags().BoolVar(&opts.Confirm, "confirm", opts.Confirm, "If true, the result of the verification will be recorded to an image object.") | ||
cmd.Flags().BoolVar(&opts.Remove, "remove", opts.Remove, "If set, all signature verifications will be removed from the given image.") | ||
cmd.Flags().StringVar(&opts.PublicKeyFilename, "public-key", opts.PublicKeyFilename, "A path to a public GPG key to be used for verification.") | ||
cmd.Flags().StringVar(&opts.ExpectedIdentity, "expected-identity", opts.ExpectedIdentity, "An expected image docker reference to verify.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"--expected-identity" isn't clear enough to me.
"--image-name", "--image-reference" or just "--name" works better IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--expect-name
would be correct, if the thing being compared is the "name" of the image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the perspective of the end user, they know project/imagestream==name. I believe that's the value we expect here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for the format, of the value, this is ordinarily a hostname/ns…/repo:tag
, but it also may be a hostname/ns…/repo@algo:digest
.
For internally created images the value would ordinarily semantically match project/imagestream, ± details of the syntax.
For externally imported images, the expected identity and the imagestream name would, in general, not match; the expected identity of a RHEL image imported into the imagestream, when verifying the Red Hat signature, is registry.access.redhat.com/…/rhel:$something
, not mycluster.example.com/myproject/baseimage:$somethingelse
.
hack/common.sh
Outdated
@@ -234,7 +236,7 @@ os::build::internal::build_binaries() { | |||
if [[ ${#nonstatics[@]} -gt 0 ]]; then | |||
GOOS=${platform%/*} GOARCH=${platform##*/} go install \ | |||
-pkgdir "${OS_OUTPUT_PKGDIR}/${platform}" \ | |||
-tags "${OS_GOFLAGS_TAGS-} ${!platform_gotags_envvar:-}" \ | |||
-tags "${common_gotags} ${OS_GOFLAGS_TAGS-} ${!platform_gotags_envvar:-}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code at this level shouldn't have to know about specific tags. You need to set this in build-cross / build-go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
ace87fc
to
f64d637
Compare
@mtrmac @miminar ok, I wrote a simple helper that will retrieve the manifest from the registry. It will use the bearer token/username from the user running the command (which makes using The latest version is also not using the DefaultPolicy(nil), so I believe it should really do some level of verification of the image identity/signature... I really hesistate to make this command more complex by using containers/image docker transport/etc. For the current scope of this command, this is only intended for local (managed) images only (iow. only images managed by openshift registry)... |
pkg/image/util/manifest.go
Outdated
|
||
// GetImageManifestFromRegistry retrieves the image manifest from the registry using the basic | ||
// authentication using the image ID. | ||
func GetImageManifestFromRegistry(registry *url.URL, repositoryName, imageID, username, password string) ([]byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you name it like GetImageManifestByIDFromRegistry()
since it doesn't support tags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
285f8b8
to
f247cc0
Compare
[test] |
as a follow ups:
|
Evaluated for origin test up to 8d19047 |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/1110/) (Base Commit: 13b90e2) |
lgtmed by @miminar per IRC [merge] |
flake: #13942 [merge] |
[merge] flake: #14044 |
Evaluated for origin merge up to 8d19047 |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/561/) (Base Commit: 8508081) (Image: devenv-rhel7_6212) |
@aweiteka FYI |
Fresh version of: #12616 based on @mtrmac branch (rebased and polished to complain with the origin commit format).
This version is based on the containers/image and not just bundling the opengpg support for origin.
Trello: https://trello.com/c/BIJBu7qi/788-5-images-fill-in-the-metadata-signature-fields-when-a-signature-is-valid