-
Notifications
You must be signed in to change notification settings - Fork 83
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
Build enclave image without Docker daemon from local docker archive #235
Comments
On further investigation there is actually a further reason the
There are a few ways this could be fixed. It might make sense to allow users to simply configure the env vars, and cmd themselves. That would be a useful as a feature in its own right. I am happy to open a PR adding those options to the CLI if there is interest. |
Our LinuxKit also has an additional feature which doesn't seem to be merged: linuxkit/linuxkit#3446 and needs to be rebased. @neacsu do you know what is missing for upstreaming the feature? Are there any changes we would need to do in the codebase to support it? |
I ran into that today when I was making these changes. I rebased one of the commits from that PR onto develop: https://github.com/m10io/linuxkit I also made some preliminary changes here: https://github.com/m10io/aws-nitro-enclaves-cli/tree/cmd-env-params I can clean those up and open a PR if there is interest |
The patch there is actually the first version from the PR, and the one that works with the current codebase from @petreeftime The PR hasn't got more traction since I last addressed the required changes. I will try to ping the maintainers. The changes to @sphw Thanks for taking an interest in this. The proposal to specify cmd and env separately sounds good. It would definitely be nice to have a way of doing things based only on Docker format and not necessarily on the Docker daemon. In that sense, we should try to integrate the |
We had a similar problem. We're using
|
We see a 3 issues in that ticket:
|
Hello, |
We've run into this issue while trying to build a docker image.tar file into an enclave image. @shtaked
This is quite tricky to setup in my experience.
This would be the ideal solution for us. We currently don't have a good way of automating these builds while there continues to be a dependency on a docker daemon. |
Update from our side:
|
Thanks for the updates, sounds great! |
@shtaked We are currently using Docker v1 images built using Nix. I'm not 100% sure where Nix's support for OCI images is at. If it doesn't exist yet, I can commit to adding it to |
@shtaked hey, do you have any updates on this work? We're still blocked by this issue at the moment. Thanks! |
Again would like to point out that the eif images may be built without the involvement of Docker at all. Similar to @sphw we use Nix as well, and have been building images for production use for quite a while now. There's no need for Docker or OCI indirection, you can just use a plain initrd that wraps a folder. See #235 (comment) for details |
@exFalso How do you handle the signature part of the eif? This signature is critical for us. |
You can just unpack the layers into the rootfs folder if you really want to start from a docker image. That's basically what the aws tooling does as well, but for some reason it jumps through many hoops to do it. By signatures do you mean the built-in way of signing the images (with PCR8 and whatnot)?
(Sidenote: I don't quite understand the benefit of this signature scheme btw. Attestation will verify the image hash already, which you can sign out of bands if you really want to. Having it as a built-in would only really make sense if there was specific nitro functionality tied to the signature similar to SGX MRSIGNER, e.g. sealing capabilities tied to the signing key.) |
Thanks that's helpful, well the benefit for us of the signature (and then the PCR8 check) is that we trust the environment building the image but we don't trust the rest of the infrastructure. In other words, we want to prevent an operator on the infrastructure to launch a rogue eif. |
Yes, the process to build from a docker container is a bit complex and can be simplified for sure, but just using |
Yeah, reproducibility was precisely why we ended up not using Docker at all and creating the initrd directly. Dockerfiles in particular almost encourage users to create non-reproducible images by downloading non-pinned stuff from the internet. If you do have e.g. a find root -exec touch -h --date=@1 {} +
(cd root && find * .[^.*] -print0 | sort -z | cpio -o -H newc -R +0:+0 --reproducible --null | gzip -n > $out) which will also normalize the uid/gid. |
Hey all, I'm also running into this limitation - it would be awesome to build EIFs in our CI using the native nitro-cli tooling. Is this still a feature that is being looked into? |
Hi all, We ran into this limitation and we decided to go with @exFalso 's approach above, and decided to build the enclaves 'from scratch' with aws/aws-nitro-enclaves-image-format directly, rather than using the Nitro CLI. This uses Nix instead of Docker, so you don't need the daemon nor other privileged builders, and you do not need Docker images (but you can tweak it to use TARs if you do want that). You get some other benefits, like the possibility of using your own Kernel or init process (with the Nitro CLI, hard-to-reproduce binaries are used instead) We made these efforts open-source at monzo/aws-nitro-util. We are using this to build enclaves in production. |
Hi @cottand, Congratulations on your new project initiative! We're excited to see the added value that aws-nitro-util brings for Nitro Enclaves users. Nowadays, @foersleo has been hard at work enabling reproducible builds on aws-nitro-enclaves-sdk-bootstrap. Once this fantastic effort is complete, all the blobs distributed via aws-nitro-enclaves-cli-devel package will be reproducible and verifiable. |
What
Right now, you need a running Docker daemon to build an enclave image. The LinuxKit version currently included attempts to pull the image using the Docker daemon. linuxkit/linuxkit#3573 now lets LinuxKit pull the images directly without the need for a Docker daemon.
Why
As part of our enclave support, we (M10 Networks) want to be able to build enclave images entirely in a Dockerfile. We distribute all of our services through Docker images, and all of the builds are entirely performed inside of Dockerfiles. While possible to change this for Nitro, I don't think it should be necessary with a simple change.
How
To supply this functionality, more or less out of the box, all that would be required would be to update the included LinuxKit to one of the latest builds. This would then allow users to use skopeo, or a similar tool, to transfer their local image into LinuxKit's cache located at
~/.linuxkit/cache
themselves.A more user-friendly follow on would be to allow the users to simply pass in a path to their own Docker image archive. At that point, the CLI would need to copy the image into the LinuxKit cache.
As a temporary workaround for our use case, I can simply replace the LinuxKit binary in
/usr/share/nitro_enclaves/blobs
with my own. I think this use case is common enough that it should either be supported through easier means or documented in some wayThe text was updated successfully, but these errors were encountered: