Proposal for support for runtime composefs validation#28658
Draft
alexlarsson wants to merge 4 commits intocontainers:mainfrom
Draft
Proposal for support for runtime composefs validation#28658alexlarsson wants to merge 4 commits intocontainers:mainfrom
alexlarsson wants to merge 4 commits intocontainers:mainfrom
Conversation
If this is set to `check`, then we validate the image manifest against the policy every time we run the container. If instead it is set to `require` then we do the same, but we also fail if there is no policy for the image. Also, we take care to validate the actual manifest data that we decode in image.Inspect(), so that we can trust the ImageData, like the annotations.
This is a small script that rewrites a manifest to add the fs-verity annotations, converts to zstd::chunked, signs it with cosign and pushes it to a repo.
Member
I think we would like this yes, especially as we know that not everyone will use quadlet files in /usr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the automotive sphere, we're interested in having some level of runtime validation. For the rootfs we already get this from bootc using composefs. However, if we're also using containers in /var/lib/containers, those are not protected by this. However, containers/storage already (optionally) supports composefs, so we should be able to do something similar for podman.
Here is what this MR, and the related changes in container-libs does:
--security-opt signature=[check,require]. If this is set, then the signature for the manifest is validated atpodman runtime, which allows us to trust the manifest data, like the annotations.verity=require(which requires all files in the mount to be backed by a file with a fs-verity digest from the composefs blob).--security-opt verity=enforceis passed topodman run, then podman looks at the per-layer annotations in the image manifest (which we ideally trust due to a signature) forio.containers.composefs.digestkeys, where you can give a list of allowable fs-verity digests. These are then forwarded to the overlayfs driver which validates this at mount time.With the above, we can have a pretty robust validation of the container at runtime. There are some weak points:
All of these are fixable in a controlled environment. For example, if you have a read-only /usr and /etc like bootc, and you ship a quadlet file in /usr that has the right arguments, then you can have some trust in that the right code is running, and you can do "podman pull" to get a new image version, keeping this trust.
I have an example signed image with annotations at https://quay.io/repository/alexl42/centos-verity. See the description there for the public key used. With I can run a validated image:
You can also see how it works with an unsigned and no-verity image:
Or if i tweak the composefs blob:
I don't expect this PR to just be necessarily merged as is, but I'd like to bring this up for discussion. We'd like a feature like this in automotive, is that reasonable? Is the approach reasonable? Is the interface reasonable?
Discussion points:
Some minor notes: