Asylo
|
Asylo is an open and flexible framework for developing enclave applications. Asylo lets you take advantage of a range of emerging trusted execution environments (TEEs), including both software and hardware isolation technologies.
Asylo provides:
Asylo is under active development. We want to expand Asylo's capabilities to meet more developers' needs. To do this, we plan to add support for more backends, libraries, and languages.
The Asylo project documentation can be found at asylo.dev.
The asylo-examples
repository contains a working Bazel workspace with example source code that can be used as a template for starting a new project.
There are several ways of getting support with Asylo:
asylo
tag.Asylo provides a custom Docker image that contains all required dependencies, as well as Asylo's custom toolchain, which is required for compiling enclave applications for various enclave backends.
See the Dockerfile for an in-depth view of what's inside the container image.
See this guide for additional details on how to pull images from Google's Container Registry.
Some of Asylo's tests require IPv6 to be enabled in your Docker daemon. See this guide for how to enable IPv6.
hello_world
exampleTo run the hello_world
example, first use the following set of commands to grab the asylo-examples
repository source code:
Next, use Docker to build and run the hello_world
application, using a simulated enclave backend:
You can also set NAMES
to a comma-separated list of names and see the enclave's entry-point get invoked for each name.
In the above example, we use the following Docker flags:
-it
is used to allocate an interactive terminal in which the command is run.--rm
is used to automatically delete the temporary container after the command completes so that unnecessary images don't persist on disk.-v
is used to map local files to paths inside the container./opt/my-project
./root/.cache/bazel
, enabling incremental builds between bazel
invocations.-w
is used to set the working directory in the container so that bazel run
command is executed in the example project.If using the Intel SGX hardware backend (see the Manual Installation guide), the following Docker flags are needed to propagate the necessary capabilities from the host:
--device=/dev/isgx
gives the container access to the SGX device that is used to interact with the SGX hardware features.-v /var/run/aesmd/aesm.socket:/var/run/aesmd/aesm.socket
allows the container to access the Architectural Enclave Service Manager (AESM) daemon running on the host.In the above example, we use the following Bazel flag:
--names="${NAMES}"
is the argument passed to the //hello_world:hello_world_sgx_sim
target.Note: The example source code includes an additional Bazel configuration file, .bazelrc
, at the root of the source tree. Remember to copy the contents of this file into the .bazelrc
file at the root of any future Bazel workspaces that use Asylo's toolchain.
You can follow the steps above to build your own enclave application instead. You can use the example code in MY_PROJECT
as a template for a new project, or simply change MY_PROJECT
to point to your own Bazel project instead.
You can get an interactive terminal (instead of running a single command) by omitting the bazel run ...
part of the docker
invocation. For instance, to run the hello_world
example as above but in an interactive terminal, run:
This opens a terminal inside the Docker container. From this terminal, you can run Bazel as usual:
To run our regression test suite, first clone the Asylo repository to a directory of your choice:
The regression test suite includes tests that unit-test code directly as well as tests that run inside a simulated enclave environment. You can run it with the following command:
See Docker flags for a breakdown of the flags used in this command. Note that in this command we also use -v
to map the Asylo SDK source files to /opt/asylo/sdk
.
If you don't want to use the Asylo Docker image, you can manually install Asylo and its dependencies instead. See https://github.com/google/asylo/blob/master/INSTALL.md "INSTALL.md" for detailed installation steps.
The following examples assume that the Asylo SDK was installed at ASYLO_SDK
, which can be a directory of your choice.
hello_world
exampleTo run the hello_world
example, first use the following set of commands to grab the asylo-examples
repository source code:
Next, use Bazel to build and run the hello_world
application, which uses a simulated SGX enclave backend:
Refer to Bazel flags and workspace settings for an explanation of the flags and workspace configuration used in this example.
You can follow the steps above to build your own enclave application instead. You can use the examples code in MY_PROJECT
as the start of your own project, or simply change MY_PROJECT
to point to your own Bazel project instead.
If you haven't already, use the following commands to clone the Asylo source code repository and copy it to a directory of your choice:
The regression test suite includes tests that unit-test code directly as well as tests that run inside a simulated enclave environment. You can run it with the following command:
This repository contains source code for the Asylo framework. The framework supports C++17 applications (from release 0.4) and a Bazel build environment.
The following packages contain source code that may be of particular interest to users of the Asylo framework as well as those looking to contribute to Asylo development.
Asylo is released under the Apache 2.0 license.
This is not an officially supported Google product.
Asylo's support for various enclave backend technologies does not constitute an endorsement of those technologies or the security properties therein. Users of Asylo should perform due diligence in evaluating whether a backend technology meets the security requirements of their application. Users are advised to use defense-in-depth measures to protect their sensitive applications.