-
Notifications
You must be signed in to change notification settings - Fork 546
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
Does webhook pull images for the sidecar and/ or multiple image repos #1653
Comments
Great question! We're currently working on adding support to ClusterImagePolicy, which will allow multiple ways to validate the containers. So, to answer your question in couple of different ways (note the code is currently in flux, but hopefully these pointers give enough of an idea):
So, here's the current design document on what we're working on implementing and are hoping to have this buttoned up in the next week or so: Once that lands, you can create policies based on the image (glob/regex) and have finer level of control on how to validate images. I thought there was one issue tracking what to do about debug containers, but I can't find it right now. Hope this helps :) |
In my use case, some container are injected as sidecar by other webhook like Istio operator and we have no control where image comes from and we can't sign them either. So in your new policy can I specify some image can skip the validation. Or give warning instead of failure. |
@adubey8 By default, the admission controller only validates the resources deployed on namespaces with the label |
As we mentioned this is not on the namespace level. We want to verify the image signature but unfortunately other application will inject sidecar pod. And we have no control on that part and injected sidecar pod signature. So we want to skip validation on the sidecar pod. |
Sorry about the tardy reply, went to reply and totes spaced. I think we're going to have to start implementing some sort of ability to specify policy at the ClusterImagePolicy level that would allow to say for example how many verified signatures an image needs (and in your case you would then be able to say 0). @hectorj2f @adubey8 Does that make sense? I'd rather look at adding some policy behaviour rather than just say something like, do not expect any. Thoughts? |
@vaikas Yes, it makes sense, we definitely need to be able to declare some policy behaviour. Another option could be to only validate the images for which a policy matches, and warn when there are not policies matching the image name defined in the CIP. |
I think we should start the policy discussion, and see how it may look sooner rather than later :) |
Yes, I 100% agree. |
@adubey8 We've added support for policy behauvior definition in cosigned. However we require, at least, images within a namespace to match at least a signature of the defined. To ignore specific pods within a namespace, we might need to add a label or annotation to ignore those pods during the validation. It isn't an ideal solution, but I cannot think of better options without polluted the rest of the logic. |
I think the label / annotation is not ideal, since a bad actor could then just slap that label on their pod and bypass the policy checks. Naively I think we might want to have to define an explicit CIP that would match that image (or a class of images) and in that policy you could specify somehow (flag, field, etc.) that if an image matches, it's not checked. |
tl;dr: I believe you can sign public images yourself, store it in a remote signature repository, and then just have cosigned validate public images using your remote signature repository. Hmm, maybe I misremembered how signatures are pushed using COSIGN_REPOSITORY, but a quick test showed that I can sign a public image using a remote signature location using:
It would only push a signature to a remote signature location and not to the source image location. Therefore, should be possible for users to take a public sidecar image, such as I was able to verify my signing of a public image by storing it in a separate signature repository like so:
Then the ClusterImagePolicy (CIP) authority can be configured to match that image, specify the remote source and then it would still validate.
I understand this is a different request compared to just ignoring the image/pod, but this is a potential workaround. There is more overhead on your end since you would have to always sign the public sidecar images whenever it changes. However, it is a more secure approach as you also then validate that the correct expected public sidecar image is used. |
Yep, that's mosdef now doable because we now have all the pieces for it, woot woot! |
Thanks @DennyHoang, it sounds like a workaround.
@vaikas I don't disagree in terms of security. But the same theory could be applied against bad actors removing the label from the namespace |
Yup, that's facts. Guess that part depends on how well the namespaces are locked down vs. deploying pods. So much to document lol :) |
I'm hesitant to consider this a workaround, but rather something to be formalized into a feature. @DennyHoang 's instructions above does require a number of steps (5, to be exact ;-) ). Would it be worth focusing here to tighten up the feature? I'd also be interested in @adubey8 's thoughts. I've never been way stoked on an "ignore" feature, and the compromise of sidecar pods like envoy could have devastating impact - they're mos def worth protecting. |
Another thought, that could avoid user PKI issues, should we add a feature or workflow to make it easier to sign public images against the transparent log? |
It's not unusual for certain Unix tools, like GPG or SSH to require specific permissions on their config files. I wonder if there is an analog here, where the admission controller could reflect on namespace RBAC and fail to admit with an Event if the namespace RBAC is too permissive? |
Just thinking little more, the label issue is problematic since 2/3 containers in the pod do have signatures and it's only the last sidecar that does not have it, so either the label would have to say something like this particular container does not get blocked. |
Some additional perspective from the customer and product side:
Given that there are a couple of solutions here, is it possible to say that we don't need to resolve this in order to bump up to |
Using the authority that could be using the 'Warn' mode with the webhook is another possible way to handle this? So, instead of a block, it's a warn. |
+1 |
Just a thought, but would it be possible to add something similar to the static validator feature that is offered by Connaisseur ? It would potentially look like this: spec:
images:
- regex: istio/*
authorities:
- name: "Allow all Istio Service Mesh Images"
static:
approve: true |
@vaikas @hectorj2f I guess this document needs some update since the name had been changed from cosigned to policy. https://docs.google.com/document/d/1gBLEOOHWOmvHVsoJbgGU74GdwA6CGxMRp3MAeEB50l4/edit# |
@hectorj2f I read through the entire chain. It seems a very good feature to have. Looking forward to the release, since we need a solution to exclude or just warn for the images that are from public repo |
@hectorj2f Can you please let me know when this feature will be available? |
Sorry for the tardy reply, was OOO. So, I like the Wonder if that may also satisfy the requirements for: Depending on what is meant by logging. |
@vaikas @hectorj2f Let me explain a scenario why we need " warn " or " allow-but-warn " Let's consider two images
CASE 1: I cannot use ClusterImagePolicy for image2 if I have a wildcard like this azurecr.io/** . Because it will stop the image2 from getting deployed
CASE 2: Also, I cannot use the static check in this case since it will match the wildcard and pass all the images or fail all the images. My understanding is static overrides the key.
CASE 3: I want something that checks and allows the ones that are signed and warn if it's not signed but still allows it.
Why I am asking is enterprise organizations will have thousands of images. It will be super hard to co-ordinate and adapt to this image signing. We should have capabilities that allow if the image is signed and allow-but-warn if the image is not signed. So we can have a common rule that can handle the thing initially. Over the period of time app team will start seeing this warning and have their image signed |
Yes for sure :) We agree lol |
I have images deployed from multiple source in one cluster+namespace.
For example I have three images:
As you may notice I have control over first two images so I can put them in one repo and deploy. But I have no control over the third image as it is knative image. Will webhook allow all three images to be deployed? If yes, how? What config changes need to be made?
The text was updated successfully, but these errors were encountered: