The Wayback Machine - https://web.archive.org/web/20200907021238/https://github.com/opencontainers/image-spec/pull/775
Skip to content
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

Proposal to add Encrypted Layer Mediatype #775

Open
wants to merge 2 commits into
base: master
from

Conversation

@lumjjb
Copy link

lumjjb commented Apr 27, 2019

This is a first draft of modifications to the OCI spec on Encrypted Container Images. Work around this has been on-going for quite a while (since the start of the issue). The current design is based on the discussions we've had in the issue and with the runtime implementation in containerd.

Abstract

We would like to propose a new media type for encrypted layers of a container image. This addition would facilitate the ecosystem for encrypted container images. This allows users with stricter trust requirements to be able ensure end-to-end encryption from build to runtime. In addition, it allows users to use a centralized managed repository (i.e. Docker Hub) without any risk of their images being compromised.

Issue Details

Based on the discussion of #747

Signed-off-by: Brandon Lum lumjjb@gmail.com

layer.md Outdated

When using the `+enc` mediatype, the layer data blobs are encrypted with a symmetric encryption algorithm (i.e. AES_128_GCM, AES_128_CBC, etc.) according to the [IANA Registry](https://www.iana.org/assignments/aead-parameters/aead-parameters.xhtml).

Details of the algorithms and protocols used in the encryption of the data blob are defined in a JSON object below. We note that:

This comment has been minimized.

@stevvooe

stevvooe Jun 5, 2019

Contributor

If I'm understanding this correctly, this structure ends up in the annotations below. It might be helpful to describe the annotations first, then their contents.

I also think for annotations, they need to be added to the annotations.md.

This comment has been minimized.

@lumjjb

lumjjb Jun 10, 2019

Author

EDIT: Updated to reflect introduction of annotations with link to annotations.md before metadata explanation.

Agreed on adding to annotations.md.

@lumjjb lumjjb force-pushed the lumjjb:encryption branch 2 times, most recently from f135fa9 to 6c6d3dc Aug 16, 2019
@mrunalp
Copy link
Contributor

mrunalp commented Sep 12, 2019

@vbatts ptal

@lumjjb
Copy link
Author

lumjjb commented Sep 17, 2019

@vbatts As per our conversation a couple days ago, Based on the RFC6838 and RFC6839.

A specification like nondistributable layers would work:

  • application/vnd.oci.image.layer.enc.tar.v1
  • application/vnd.oci.image.layer.enc.tar.gzip.v1

The other way to do this is to have one encrypted layer mediatype application/vnd.oci.image.layer.enc.v1 and specify the original underlying mediatype in an annotation. But i'm unsure if this may make handling on the runtimes a bit more difficult.

cc: @estesp @dmcgowan @crosbymichael @mrunalp @mtrmac @vrothberg

@dmcgowan
Copy link
Member

dmcgowan commented Sep 17, 2019

I don't think reproducing what was done for nondistributable layers is a good idea. Runtimes end up having to special case these since they are hard to interpret. For example vnd.oci.image.layer. may indicate that an object should be treated as a layer, but then .tar.v1 indicates it is a tar. What is sandwiched in between those is some important metadata. In the nondistributable case it is just a hint of how an artifact is distributed, in the encrypted case, it is a requirement for how the tar must be processed. I think we really need to format the content types in a way that indicates how they should be processed, ensuring that modifications on those types are wrapping. Personally I like using + to indicate encoding (whether that is encryption or formatting). I think we should discuss at an upcoming OCI weekly meeting about these types and their relation to RFC6838.

@lumjjb lumjjb force-pushed the lumjjb:encryption branch from 5d1a0e1 to b433f02 Sep 30, 2019
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
@lumjjb lumjjb force-pushed the lumjjb:encryption branch from b433f02 to fbdd040 Sep 30, 2019
@lumjjb
Copy link
Author

lumjjb commented Oct 1, 2019

Updated based on discussions from OCI weekly dev discussion to move from +enc to +encrypted. We agreed on using suffixes on mediatypes and having these defined on top of artifacts.

@lumjjb
Copy link
Author

lumjjb commented Oct 9, 2019

@mikebrow Responding to #791 (comment) in this thread instead since it is more specific to encryption details.

The main integration points for Encrypted Container Images are:

  • The specification and libraries to perform encryption/decryption
  • Container runtimes
  • The build toolchain
  • Registry
  • Kubernetes Integration

Do let me know if there's something specific you are looking for and I can provide a direct link.

The specification and libraries to perform encryption/decryption

The definition of encryption indication and how encryption metadata is defined in:

The implementation to perform encryption and decryption of this spec is in:

  • https://github.com/containers/ocicrypt
    • func EncryptLayer(ec *config.EncryptConfig, encOrPlainLayerReader io.Reader, desc ocispec.Descriptor) (io.Reader, EncryptLayerFinalizer, error)
    • func DecryptLayer(dc *config.DecryptConfig, encLayerReader io.Reader, desc ocispec.Descriptor, unwrapOnly bool) (io.Reader, digest.Digest, error)

Container Runtimes

Current implementations for containerd stack

Current implementations for RedHat stack

Registry

Current docker distribution supports: https://github.com/docker/distribution. Tested with v2.7.1.

Build toolchain

The plan for this is to have docker CLI, skopeo and buildah. In the meantime, we also support encryption of images in containerd via imgcrypt ctr client.

Current implementations for RedHat stack

Current implementations for containerd stack

Kubernetes Integration

KEP: Add ImageDecryptSecrets

With KEP implementation in 1.17, containerd-cri and cri-o will need to add support the new API changes.

It is important to note that kubernetes integration is not required to use encrypted container images. i.e. in cri-o you are able to specify a directory containing keys.

cc: @stefanberger, @harche

@vbatts
Copy link
Member

vbatts commented Mar 4, 2020

@lumjjb ok, finally discussing this in the weekly call.
Since this encrypted layer discussion has begun, the https://github.com/opencontainers/artifacts has come along. To a large degree, this is another mimetype/mediaType that would be documented there, and allowed as an extension to the image-spec.

There is a lot of good work here in the PR, that should transfer to something like a README for these mime-types in the artifacts repo.
Does this make sense?

@lumjjb
Copy link
Author

lumjjb commented Mar 5, 2020

@lumjjb ok, finally discussing this in the weekly call.

Awesome, sounds good.. I will come by the next OCI call on Wednesday.

There is a lot of good work here in the PR, that should transfer to something like a README for these mime-types in the artifacts repo.
Does this make sense?

Yup! I will create an encryption.md PR to the artifacts repo, and I suppose it would be an edit pointing to that file from opencontainers/artifacts#13 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
5 participants
You can’t perform that action at this time.