This repository contains a collection of tools and commands used for managing the lifecycle of enclaves. The Nitro CLI needs to be installed on the parent instance, and it can be used to start, manage, and terminate enclaves.
The Nitro Enclaves kernel driver is available in the upstream Linux kernel starting with the v5.10 kernel for x86_64 and starting with the v5.16 kernel for arm64. The codebase from the 'drivers/virt/nitro_enclaves' directory in this GitHub repository is similar to the one merged into the upstream Linux kernel.
The Nitro Enclaves kernel driver is currently available in the following distro kernels:
x86_64
aarch64
The following packages need to be installed or updated to have the Nitro Enclaves kernel driver available in the mentioned distros:
Amazon Linux 2 - "kernel" (amzn2-core) for the v4.14 kernel, "kernel" (amzn2extra-kernel-5.4) for the v5.4 kernel, "kernel" (amzn2extra-kernel-5.10) for the v5.10 kernel
Amazon Linux 2022 - "kernel" for the v5.10+ kernels
CentOS Stream - "kernel" for the v4.18+ kernels
Fedora - "kernel" for the v5.10+ kernels
openSUSE Tumbleweed - "kernel-default" for the v5.10+ kernels
Red Hat Enterprise Linux - "kernel" for the v4.18+ kernels
SUSE Linux Enterprise Server - "kernel-default" for the v5.14+ kernels
Ubuntu - "linux-aws" and "linux-modules-extra-aws" for the v5.4, v5.8 and v5.11+ kernels
Out-of-tree driver build can be done using the Makefile in the 'drivers/virt/nitro_enclaves' directory.
nitro-cli-config -i -m 256 -t 2
You are now ready to go.
A set of steps options to install on distros the Nitro CLI from GitHub sources can be found in the docs directory:
The user guide for the Nitro Enclaves CLI can be found at https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave-cli.html.
Ensure that your EC2 instance was created with enclave support enabled and that your system (and container if applicable) has read/write access to /dev/nitro_enclaves
.
Ensure that your Linux system (and container if applicable) has Linux hugepages available.
The AWS Nitro Enclaves CLI package is currently available for:
The enclaves do not have access to a physical disk, just a RAM filesystem. One can configure the disk space by changing memory size or by using kernel command line arguments.
The init.c
file keeps the default configuration for each volume. The below example shows
the default options for /tmp
.
{ OpMount, .mount = { "tmpfs", "/tmp", "tmpfs", MS_NODEV | MS_NOSUID | MS_NOEXEC } },
To modify the memory allocated to this volume, another parameter is needed
{ OpMount, .mount = { "tmpfs", "/tmp", "tmpfs", MS_NODEV | MS_NOSUID | MS_NOEXEC, "size=100%" } },
Note that the parameter size
specifies only the maximum allocated size.
After modifying the configuration, the file needs to be recompiled using make init
and moved to
/usr/share/nitro_enclaves/blobs/init
.
This library is licensed under the Apache 2.0 License.
The components of the Nitro Enclaves CLI are organized as follows (all paths are relative to the Nitro Enclaves CLI's root directory):
'blobs': Binary blobs providing pre-compiled components needed for the building of enclave images:
'build': An automatically-generated directory which stores the build output for various components (the CLI, the command executer etc.)
'bootstrap': Various useful scripts for CLI environment configuration, namely:
'docs': Useful documentation
'drivers': The source code of the kernel modules used by the CLI in order to control enclave behavior, containing:
'eif_loader': The source code for the EIF loader, a module which ensures that an enclave has booted successfully
'enclave_build': A tool which builds EIF files starting from a Docker image and pre-existing binary blobs (such as those from 'blobs')
'examples': Basic examples of enclaves. One example is the hello world enclave.
'include': The header files exposed by the Nitro Enclaves kernel module used by the Nitro CLI
'samples': A collection of CLI-related sample applications. One sample is the command executer - an application that enables a parent instance to issue commands to an enclave (such as transferring a file, executing an application on the enclave etc.)
'src': The Nitro CLI implementation, divided into 3 components:
'tests': Various unit and integration tests for the CLI
'tools': Various useful configuration files used for CLI and EIF builds
'vsock_proxy': The implementation of the Vsock - TCP proxy application, which is used to allow an enclave to communicate with an external service through the parent instance
'ci_entrypoint.sh': The script which launches the CLI continuous integration tests
'scripts/run_tests.sh': The continuous integration test suite for the CLI across all supported platforms
If you discover a potential security issue in nitro-cli, we ask that you notify AWS Security via our vulnerability reporting page. Please do not create a public GitHub issue.