From 52f4f7ed431934987ee9b16d200870158321809b73a1e32f922c037d81daa5ca Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Wed, 24 Nov 2021 14:12:54 +0000 Subject: [PATCH] custom README.md OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/aws-nitro-enclaves-cli?expand=0&rev=11 --- aws-nitro-enclaves-cli.spec | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/aws-nitro-enclaves-cli.spec b/aws-nitro-enclaves-cli.spec index b24c1b0..75a6c2c 100644 --- a/aws-nitro-enclaves-cli.spec +++ b/aws-nitro-enclaves-cli.spec @@ -65,6 +65,48 @@ System group %ne_system_group for Nitro Enclaves. %autosetup -p1 -a1 %build +tee README.md <<'_EOR_' +Nitro Enclaves are "secondary VMs" running in an EC2 instance. +The "primary VM" releases some of its memory and cpu, which is then used by the enclaves. +This is done by nitro-enclaves-allocator.service, which uses +%_sysconfdir/nitro_enclaves/allocator.yaml as configuration file. +This systemd service has to be enabled manually, and started: + systemctl enable nitro-enclaves-allocator + systemctl start nitro-enclaves-allocator + +This command has to be used to run an existing Enclave Image File: + nitro-cli run-enclave --eif-path /path/to/file.eif --cpu-count 2 --memory 512 + +How to build and run an example enclave: + zypper in -y docker + systemctl enable docker + systemctl start docker + docker pull opensuse/leap + tee Dockerfile <<_EOF_ +FROM opensuse/leap +ENV HELLO="Hello from the enclave side!" +COPY hello.sh /bin/hello.sh +CMD ["/bin/hello.sh"] +_EOF_ + tee hello.sh <<'_EOF_' +#!/bin/sh +# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 +count=123 +while test $count -gt 0; do + printf "[%4d] $HELLO\n" $count + count=$((count-1)) + sleep 5 +done +_EOF_ + chmod -v 555 *.sh + docker build -t hello-enclave:1.0 ./ + nitro-cli build-enclave --docker-uri hello-enclave:1.0 --output-file hello.eif + nitro-cli run-enclave --eif-path hello.eif --cpu-count 2 --memory 512 --debug-mode + sleep 1 + nitro-cli console --enclave-id $(nitro-cli describe-enclaves | jq -r ".[0].EnclaveID") + +_EOR_ %install mkdir .cargo cp %{SOURCE2} .cargo/config