gramineproject / gsc

Gramine Shielded Containers (Docker integration)
BSD 3-Clause "New" or "Revised" License
44 stars 34 forks source link

Future direction of Graphene Shielded Containers #13

Open vahldiek opened 4 years ago

vahldiek commented 4 years ago

Description of the problem

The first version of Graphene Shielded Containers (PR gramineproject/graphene#1430) is limited in scope and we've frozen the feature list. This issue lists limitations and possible future features, and should serve as a discussion forum for others to highlight which features are a priority.

Security issues:

Minor features:

Major features:

dimakuv commented 3 years ago

Some thoughts on this list, coming from January 2021 (after GSC rework):

GSC uses insecure environment variables

This is not even true. GSC doesn't do anything about environment variables (which is a bug). in Graphene, there must be one of the following manifest options: loader.insecure__use_host_env = 1 or loader.env.[ENVIRON] = "[VALUE]" / loader.env_src_file = "file:file_with_serialized_envs" (see https://graphene.readthedocs.io/en/latest/manifest-syntax.html#environment-variables). However, none of these options are specified in the GSC template manifest, check https://github.com/oscarlab/graphene/blob/master/Tools/gsc/templates/entrypoint.manifest.template.

This means that the final Graphenized Docker image created by GSC has no environment variables other than hard-coded LD_LIBRARY_PATH and PATH. So, currently this part is completely broken in GSC. We need to implement the above options, similar to how command-line arguments are treated (see https://graphene.readthedocs.io/en/latest/manifest-syntax.html#command-line-arguments). In particular, secure ENV variables should be extracted via inspecting the original Docker image.

Refactor tests

GSC has a test/ subdir. It uses a Makefile that got really ugly and convoluted over the years: https://github.com/oscarlab/graphene/blob/master/Tools/gsc/test/Makefile. I suggest to remove this Makefile (and maybe also https://github.com/oscarlab/graphene/blob/master/Tools/gsc/Makefile) and instead do the same with a simple Python/bash script.

dimakuv commented 3 years ago

https://github.com/oscarlab/graphene/pull/2195 -- secure environment variables were added to GSC.

pravinrajr9 commented 2 years ago

Does GSC support remote attestation? Can we convert gramine shielded container images to oci compliant and run using cri-o/containerd apart from docker?

dimakuv commented 2 years ago

Does GSC support remote attestation?

Yes, you can look at this pending PR on how it can be done: https://github.com/gramineproject/gsc/pull/11. At some point, we'll merge this PR as an example in GSC.

Can we convert gramine shielded container images to oci compliant and run using cri-o/containerd apart from docker?

There is no such tooling in GSC currently. Note that GSC itself creates a normal Docker image. So if there are some tools to make normal Docker images OCI compliant, then one can use such tools. (I'll be honest, I don't know much about the exact details of what "OCI compliant" means, so I may be wrong in my comment.)

mythi commented 2 years ago

and run using cri-o/containerd apart from docker?

FWIW, I've run GSC images using both runc and kata-runtime in k8s using containerd CRI.

pravinrajr9 commented 2 years ago

Thats awesome, thanks

pravinrajr9 commented 2 years ago

Is there a way, where can we use container images based out of image other than ubuntu as base image. I see limitation mentioned over here https://gramine.readthedocs.io/projects/gsc/en/latest/#dependency-on-ubuntu Here it says "GSC can simply be extended to support other distributions by providing a template for this distribution in templates/" Is there any example for this.

dimakuv commented 2 years ago

You can check this work in progress, for CentOS/RHEL support: https://github.com/gramineproject/gsc/pull/43

dimakuv commented 2 years ago

UPDATE:

Detect scripts as entrypoints and correctly change the entrypoint to the script interpreter

This was fixed some time ago with https://github.com/gramineproject/gramine/pull/722, and is available in Gramine v1.3.