33 lines
1002 B
Bash
Executable File
33 lines
1002 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
script_dir=$(dirname "$0")
|
|
cd "${script_dir}/.."
|
|
|
|
occlum-cargo build --release
|
|
strip target/x86_64-unknown-linux-musl/release/hacker-challenge
|
|
|
|
cat > challenge.yaml <<EOF
|
|
includes:
|
|
- base.yaml
|
|
targets:
|
|
- target: /bin
|
|
copy:
|
|
- files:
|
|
- ../target/x86_64-unknown-linux-musl/release/hacker-challenge
|
|
- target: /lib
|
|
copy:
|
|
- files:
|
|
- /opt/occlum/toolchains/dcap_lib/musl/libocclum_dcap.so.0.1.0
|
|
EOF
|
|
|
|
rm -rf challenge_instance && mkdir challenge_instance && cd challenge_instance
|
|
occlum init && rm -rf image
|
|
cp ../scripts/Occlum.json ./
|
|
copy_bom -f ../challenge.yaml --root image --include-dir /opt/occlum/etc/template
|
|
# TODO: "--enable-edmm Y" must be only for platforms that support SGX2
|
|
# TODO: make sure the bundle needs SGX2 to run since SGX1 is vulnerable to https://x.com/PratyushRT/status/1828183761055330373
|
|
occlum build --sign-key ../scripts/signing_key.pem
|
|
occlum package challenge.tar.gz
|
|
mv challenge.tar.gz ../scripts/challenge.tar.gz
|