Skip to content
This repository was archived by the owner on Jan 27, 2022. It is now read-only.

Commit b445a2e

Browse files
committed
Gramin Integration with Avalon
1 parent cf762fd commit b445a2e

13 files changed

Lines changed: 84 additions & 71 deletions

File tree

docker/compose/avalon-fib-gsgx.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,4 @@ services:
1818
graphene-python-workload:
1919
image: gsc-avalon-fibonacci-workload-dev
2020
devices:
21-
- "/dev/gsgx:/dev/gsgx"
22-
- "/dev/isgx:/dev/isgx"
23-
volumes:
24-
- /var/run/aesmd/aesm.socket:/var/run/aesmd/aesm.socket
21+
- "/dev/sgx_enclave:/dev/sgx_enclave"

docs/graphene-workload-tutorial/create_workload.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
os.path.join("src","my_workload.py.template"),
4646
os.path.join("tests","test_work_orders.json.template"),
4747
"workload.json.template",
48-
"Makefile.template"
48+
"Makefile.template",
49+
"setup.py.template"
4950
}
5051

5152
IN_DIR = "workload"

docs/graphene-workload-tutorial/workload/avalon-workload-gsgx.yaml.template

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,4 @@ services:
1818
graphene-python-workload:
1919
image: gsc-avalon-{{ my_workload }}-workload-dev
2020
devices:
21-
- "/dev/gsgx:/dev/gsgx"
22-
- "/dev/isgx:/dev/isgx"
23-
volumes:
24-
- /var/run/aesmd/aesm.socket:/var/run/aesmd/aesm.socket
21+
- "/dev/sgx_enclave:/dev/sgx_enclave"

docs/graphene-workload-tutorial/workload/compose/graphene-sgx.yaml.template

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,4 @@ services:
1818
process-work-order:
1919
image: gsc-avalon-{{ my_workload }}-workload-dev
2020
devices:
21-
- "/dev/gsgx:/dev/gsgx"
22-
- "/dev/isgx:/dev/isgx"
23-
volumes:
24-
- /var/run/aesmd/aesm.socket:/var/run/aesmd/aesm.socket
21+
- "/dev/sgx_enclave:/dev/sgx_enclave"

docs/graphene-workload-tutorial/workload/graphene_sgx/build_gsc_workload.sh.template

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,13 @@ if [ "$GSC_IMAGE_EXISTS" = "yes" ]; then
3838
fi
3939

4040
# Manifest files
41-
MANIFEST_FILE_DIR="${TCF_HOME}/tc/graphene/python_worker/graphene_sgx/manifest"
42-
MANIFEST_FILES="python.manifest
43-
sh.manifest
44-
gcc.manifest
45-
collect2.manifest
46-
ld.manifest"
47-
# Generate list of manifest files
48-
LIST_MANIFEST_FILES=""
49-
for f in $MANIFEST_FILES
50-
do
51-
FILE_NAME=${MANIFEST_FILE_DIR}/$f
52-
if [ ! -f $FILE_NAME ]; then
53-
echo "ERROR:Manifest file $FILE_NAME doesn't exist"
54-
exit
55-
fi
56-
LIST_MANIFEST_FILES+=${MANIFEST_FILE_DIR}/$f
57-
LIST_MANIFEST_FILES+=" "
58-
done
59-
echo $LIST_MANIFEST_FILES
41+
42+
MANIFEST_FILE="${TCF_HOME}tc/graphene/python_worker/graphene_sgx/manifest/avalon.manifest"
43+
echo $MANIFEST_FILE
6044

6145
# Build image
6246
echo "Build unsigned GSC image"
63-
./gsc build --insecure-args $IMAGE_NAME $LIST_MANIFEST_FILES
47+
sudo ./gsc build --insecure-args $IMAGE_NAME $MANIFEST_FILE
6448

6549
# Generate signing key if it doesn't exists
6650
SIGN_KEY_FILE=enclave-key.pem
@@ -70,4 +54,7 @@ fi
7054

7155
# Sign image to generate final GSC image
7256
echo "Generate Signed GSC image"
73-
./gsc sign-image $IMAGE_NAME $SIGN_KEY_FILE
57+
sudo ./gsc sign-image $IMAGE_NAME $SIGN_KEY_FILE
58+
59+
# Retrieve SGX-related information from graphenized image using gsc info-image
60+
# sudo ./gsc info-image $IMAGE_NAME
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python
2+
3+
# Copyright 2020 Intel Corporation
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
import sys
18+
19+
# This should only be run with python3
20+
if sys.version_info[0] < 3:
21+
print('ERROR: must run with python3')
22+
sys.exit(1)
23+
24+
from setuptools import setup, find_packages
25+
26+
setup(name='avalon_python_{{ my_workload }}_workload',
27+
version=0.6,
28+
description='Avalon python workload for Graphene',
29+
author='Hyperledger Avalon',
30+
url='https://github.com/hyperledger/avalon',
31+
packages=find_packages(),
32+
data_files=[],
33+
entry_points={}
34+
)

enclave_manager/Dockerfile-graphene

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ COPY ./enclave_manager/Makefile-graphene /project/avalon/enclave_manager/
167167
COPY ./enclave_manager/avalon_enclave_manager/*.py /project/avalon/enclave_manager/avalon_enclave_manager/
168168
COPY ./enclave_manager/avalon_enclave_manager/${ENCLAVE_TYPE} /project/avalon/enclave_manager/avalon_enclave_manager/${ENCLAVE_TYPE}
169169
COPY ./enclave_manager/avalon_enclave_manager/wpe_common /project/avalon/enclave_manager/avalon_enclave_manager/wpe_common
170-
COPY ./wpe_mr_enclave.txt /project/avalon/
170+
# COPY ./wpe_mr_enclave.txt /project/avalon/
171171

172172

173173
WORKDIR /project/avalon/enclave_manager

examples/graphene_apps/python_workloads/fibonacci/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ build :
3232
install:
3333
@echo INSTALLING WHEEL FILE =================
3434
pip3 install $(WHEEL_FILE)
35-
3635
clean:
3736
if pip3 uninstall --yes $(WHEEL_FILE); then echo UNINSTALLED $(WHEEL_FILE) WHEEL FILE ; fi
3837
rm -rf build deps dist *.egg-info

examples/graphene_apps/python_workloads/fibonacci/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ https://creativecommons.org/licenses/by/4.0/
6060

6161
- To run fibonacci workload as a docker container in Graphene-SGX environment and to use a test application to send work order requests, execute the following command from [fibonacci](https://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_workloads/fibonacci) directory.
6262

63-
`docker-compose -f docker-compose.yaml -f compose/graphene-sgx.yaml up`
63+
`docker-compose -f docker-compose.yaml -f compose/graphene-wpe-sgx.yaml up`
6464

6565
Above command will run test work orders listed in file [*test_fib_work_orders.json*](http://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_workloads/fibonacci/tests/test_fib_work_orders.json).
6666

examples/graphene_apps/python_workloads/fibonacci/graphene_sgx/build_gsc_fibonacci_workload.sh

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
# Avalon python worker docker image name.
2020
IMAGE_NAME=avalon-fibonacci-workload-dev
21+
echo "Building GSC image $IMAGE_NAME started"
2122
# Graphenized docker image name for python worker.
2223
GSC_IMAGE_NAME=gsc-$IMAGE_NAME
2324

@@ -38,29 +39,13 @@ if [ "$GSC_IMAGE_EXISTS" = "yes" ]; then
3839
fi
3940

4041
# Manifest files
41-
MANIFEST_FILE_DIR="${TCF_HOME}/tc/graphene/python_worker/graphene_sgx/manifest"
42-
MANIFEST_FILES="python.manifest
43-
sh.manifest
44-
gcc.manifest
45-
collect2.manifest
46-
ld.manifest"
47-
# Generate list of manifest files
48-
LIST_MANIFEST_FILES=""
49-
for f in $MANIFEST_FILES
50-
do
51-
FILE_NAME=${MANIFEST_FILE_DIR}/$f
52-
if [ ! -f $FILE_NAME ]; then
53-
echo "ERROR:Manifest file $FILE_NAME doesn't exist"
54-
exit
55-
fi
56-
LIST_MANIFEST_FILES+=${MANIFEST_FILE_DIR}/$f
57-
LIST_MANIFEST_FILES+=" "
58-
done
59-
echo $LIST_MANIFEST_FILES
42+
43+
MANIFEST_FILE="./avalon.manifest" #"${TCF_HOME}tc/graphene/python_worker/graphene_sgx/manifest/python.manifest"
44+
echo $MANIFEST_FILE
6045

6146
# Build image
6247
echo "Build unsigned GSC image"
63-
./gsc build --insecure-args $IMAGE_NAME $LIST_MANIFEST_FILES
48+
sudo ./gsc build --insecure-args $IMAGE_NAME $MANIFEST_FILE
6449

6550
# Generate signing key if it doesn't exists
6651
SIGN_KEY_FILE=enclave-key.pem
@@ -70,13 +55,7 @@ fi
7055

7156
# Sign image to generate final GSC image
7257
echo "Generate Signed GSC image"
73-
./gsc sign-image $IMAGE_NAME $SIGN_KEY_FILE
74-
75-
# Extract enclave info from GSC image
76-
./gsc info-image $GSC_IMAGE_NAME > gsc-info.toml
77-
78-
# Extract mrenclave corresponding to python and persist to file
79-
python3 $TCF_HOME/scripts/mr_enclave.py
58+
sudo ./gsc sign-image $IMAGE_NAME $SIGN_KEY_FILE
8059

81-
# Move MRENCLAVE file to TCF_HOME
82-
mv wpe_mr_enclave.txt $TCF_HOME
60+
# Retrieve SGX-related information from graphenized image using gsc info-image
61+
# sudo ./gsc info-image $IMAGE_NAME

0 commit comments

Comments
 (0)