check status of provision script

This commit is contained in:
Dmitry Shmulevich 2018-10-01 16:39:26 -07:00
Родитель bd2123c431
Коммит f487a96775
3 изменённых файлов: 19 добавлений и 17 удалений

Просмотреть файл

@ -12,14 +12,18 @@ cd /opt/azure/acc/
OE_PKG_BASE="PACKAGE_BASE_URL"
function error_exit() {
echo $1
echo "failed" > /opt/azure/acc/completed
exit 1
}
# Check to see this is an openenclave supporting hardware environment
retrycmd_if_failure 10 10 120 curl -fsSL -o oesgx "$OE_PKG_BASE/oesgx"
chmod a+x ./oesgx
./oesgx | grep "does not support"
if [ $? -eq 0 ] ; then
echo "This hardware does not support open enclave"
exit -1
error_exit "This hardware does not support open enclave"
fi
# Configure apt to use clang-7
@ -35,10 +39,12 @@ wget -qO - https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add
echo "deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/intel-sgx.list
wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add -
export DEBIAN_FRONTEND=noninteractive
# Update pkg repository
retrycmd_if_failure 10 10 120 apt update
if [ $? -ne 0 ]; then
exit 1
error_exit "apt update failed"
fi
# Add public packages:
@ -55,14 +61,13 @@ PACKAGES="$PACKAGES az-dcap-client"
retrycmd_if_failure 10 10 120 apt-get -y install $PACKAGES
if [ $? -ne 0 ]; then
exit 1
error_exit "apt-get install failed"
fi
# Install OE package
retry_get_install_deb 10 10 120 "$OE_PKG_BASE/open-enclave-0.4.0-Linux.deb"
if [ $? -ne 0 ]; then
exit 1
error_exit "failed to install OE SDK package"
fi
systemctl disable aesmd
@ -71,13 +76,13 @@ systemctl stop aesmd
# Install SGX driver
retrycmd_if_failure 10 10 120 curl -fsSL -O https://download.01.org/intel-sgx/dcap-1.0/sgx_linux_x64_driver_dcap_36594a7.bin
if [ $? -ne 0 ]; then
exit 1
error_exit "failed to download SGX driver"
fi
chmod a+x ./sgx_linux_x64_driver_dcap_36594a7.bin
./sgx_linux_x64_driver_dcap_36594a7.bin
if [ $? -ne 0 ]; then
exit 1
error_exit "failed to install SGX driver"
fi
# Indicate readiness
touch /opt/azure/acc/completed
echo "ok" > /opt/azure/acc/completed

Просмотреть файл

@ -20,12 +20,9 @@ tempdir="$(mktemp -d)"
trap "rm -rf \"${tempdir}\"" EXIT
cp -r /opt/openenclave/share/openenclave/samples/ $tempdir
# build and run helloworld
for sample in helloworld remote_attestation; do
echo "verifying $sample"
cd $tempdir/samples/$sample
make
make run
done
# build and run samples
cd $tempdir/samples
make
make run
echo "open-enclave validation succedded"

Просмотреть файл

@ -104,4 +104,4 @@
"storageUri": "[concat('https://', parameters('diagnosticsStorageAccountName'), '.blob.core.windows.net/')]"
}
},
"linuxExtCommand": "[if(equals(parameters('oeSDKIncluded'), 'yes'), '/bin/bash -c \"secs=600; SECONDS=0; while (( SECONDS < secs )); do if [ -e /opt/azure/acc/completed ]; then /opt/azure/acc/validate.sh; exit $? ; fi; echo waiting for validation; sleep 20; done; echo validation timeout; exit 1;\"', '/bin/bash -c \"exit 0\"')]"
"linuxExtCommand": "[if(equals(parameters('oeSDKIncluded'), 'yes'), '/bin/bash -c \"secs=600; SECONDS=0; while (( SECONDS < secs )); do if [ -e /opt/azure/acc/completed ]; then if [ $(cat /opt/azure/acc/completed) == ok ]; then /opt/azure/acc/validate.sh; exit $? ; else echo provision failed; exit 1; fi; fi; echo waiting for validation; sleep 20; done; echo validation timeout; exit 1; \"', '/bin/bash -c \"exit 0\"')]"