Open Enclave extension for Visual Studio Code
A Visual Studio Code extension supporting Open Enclave, including development, debugging, emulators, and deployment!
For more information on the technology, see here.
Getting started
Ensure that the requirements are met.
Install the Microsoft Open Enclave extension.
Create a new Open Enclave solution.
You can use the Microsoft Open Enclave: New Open Enclave Solution
command (commands can be found using F1 or CTRL-Shift-P)
to create a new Open Enclave solution.
You will be prompted to:
- Select a folder for your solution.
- On Linux, you will have the option to create a Standalone project or an Azure IoT Edge Module
project. Otherwise, you will only have the option to create an Azure IoT Edge Module project.
- If you choose an Azure IoT Edge Module project, you will be prompted to provide your container repository.
- You will be prompted to provide a name for your host/enclave.
A new solution will be created in the folder you've selected. That solution will contain both the host
and enclave as well as the required EDL file. If you've chosen to build an Azure IoT Edge Module, the host will include
some code that implements the required Azure IoT Hub communication.
Note: On Windows, you can use the Windows Subsystem for Linux and the
Visual Studio Code Remote-Development extension to utilize
Standalone projects on a Windows desktop. In this case, you will need to install the requirements in
the subsystem.
Standalone projects
Build your Open Enclave solution.
The underlying system used to build is CMake.
There will be configure and build tasks for each target: ARMv7-A, AArch64/ARMv8-A, and TrustBoxEdge(LS1012a). The
configure task will invoke CMake to create the required build files. This is only required to be run once.
The build task will do the actual compiling and linking.
- F1 or CTRL-Shift-P
- Select
Tasks: Run Task
- Select
Build for QEMU ARMv7-A | AArch64/ARMv8-A | TrustBoxEdge(LS1012a)
Debug your Open Enclave solution.
Debugging your standalone project's enclave is easy. Please ensure that all of the QEMU dependencies are installed
in your development environment.
Set breakpoints in the files you wish to debug. Breakpoints in the enclave may only be added before
the emulator (QEMU) starts or when the debugger is already broken inside the enclave.
Choose the architecture you are interested in debugging by navigating to the Visual
Studio Debug
view (CTRL-Shift-D) and selecting either (gdb) Launch QEMU (ARMv7-A)
,
(gdb) Launch QEMU (AArch64/ARMv8-A)
, or (gdb) Launch QEMU (TrustBoxEdge(LS1012a))
from the debug configuration dropdown.
You can simply hit F5
. This will run cmake configuration, run the build, start QEMU, and load
the host and enclave symbols into an instance of the debugger.
Open the Terminal view
Log into QEMU using root
(no password is required)
Start the host process by entering /mnt/host/bin/<solution-name>
Note: The debugger has been configured to break at TA_InvokeCommandEntryPoint. This will happen once when the enclave starts and once for each ECALL.
Azure IoT Edge projects
Build your Open Enclave solution.
Ubuntu containers are used to configure and build. The build task will invoke docker and leverage project
dockerfiles. The build the Azure IoT Edge Module:
- Right click on
modules/<solution-name>/module.json
- Select
Build IoT Edge Module Image
- Select
trustboxedge-ls1012a
, arm32v7-qemu
or aarch64-qemu
from the Platform picker
Deploy your Open Enclave solution.
Deploying your Azure IoT Edge Module project is fairly simple:
- Right click on
modules/<solution-name>/module.json
- Select
Build and Push IoT Edge Module Image
- Select
trustboxedge-ls1012a
, arm32v7-qemu
or aarch64-qemu
from the Platform picker
Azure IoT Edge deployment template files have been provided. To create
a new deployment configuration based on the current settings in module.json
:
- Select the desired platform:
- F1 or CTRL-Shift-P
- Select
Azure IoT Edge: Set Default Target Platform for Edge Solution
- Choose from
trustboxedge-ls1012a
, arm32v7-qemu
or aarch64-qemu
- Right click on
deployment.template.json
(or deployment.debug.template.json
)
- Select
Generate IoT Edge Deployment Manifest
. This will generate or replace the apppropriate deployment json file in the config
folder.
Once your deployment json has been created in the config
folder, you can deploy
to an Azure Edge device by:
- Navigating to the
config
folder
- Right clicking on
deployment.*.json
- Selecting
Create Deployment for Single Device
or Create Deployment at Scale
.
To set up an actual device to receive a deployment, you can follow these instructions.
Check your system for Open Enclave requirements.
You can use the Microsoft Open Enclave: Check System Requirements
command (commands can be found using F1 or CTRL-Shift-P)
to validate your system.
The command will query whether the required tools and the required versions are present on your system. Any unmet
requirements will be presented in a Visual Studio Code warning window.
Note: as long as unmet requirements are found, this requirements check will run whenever the extension is activated automatically.
Requirements
Build and run extension from source code
For development of this extension, or running from source code directly
To run the extension from this repository, following these instructions:
- Clone this repository
git clone --recursive https://github.com/microsoft/openenclave --branch feature.new_platforms
.
- Navigate to
new_platforms\vscode-extension
in the cloned folder.
- Run npm to install the dependencies:
npm install
(see the requirements section for npm installation link).
- Start VSCode:
code .
.
- Start the extension using
F5
.
Data/Telemetry
This project collects usage data and sends it to Microsoft to help improve our products and services. Read our
privacy statement to learn more. If you don't wish to send usage
data to Microsoft, you can set the telemetry.enableTelemetry
setting to false
. Learn more in the
Visual Studio Code FAQ.
Known Issues
- Building SGX enclaves is not currently supported.
- We've had reports that downloading the SDK from git can be slow from within the extension. To work around any issue, you can run these commands
Linux:
rm -rf /home/$USER/.config/Code/User/globalStorage/ms-iot.msiot-vscode-openenclave/1.0.3/3rdparty/openenclave
git clone --recursive --branch feature.new_platforms https://github.com/Microsoft/openenclave /home/$USER/.config/Code/User/globalStorage/ms-iot.msiot-vscode-openenclave/1.0.3/3rdparty/openenclave
Windows (from CMD prompt):
rmdir /S /Q %APPDATA%\Code\User\globalStorage\ms-iot.msiot-vscode-openenclave\1.0.3\3rdparty\openenclave
git clone --recursive --branch feature.new_platforms https://github.com/Microsoft/openenclave %APPDATA%\Code\User\globalStorage\ms-iot.msiot-vscode-openenclave\1.0.3\3rdparty\openenclave
- The Visual Studio Code global data directory is used to download the Open Enclave SDK. You can specify where this directory exists for Visual
Studio Code by using the --user-data-dir command line switch.
Release Notes
1.0.10
Public Preview
1.0.1
Prototyping and developing :)