Skip to content
This repository was archived by the owner on Aug 3, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
!/Cargo.toml
!/config.json
!/docker/entrypoint.sh
!/docker/enclave-key.pem
!/docker/cargo-config.toml
!/.env
!/lib
Expand Down
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SP1_BATCH_VK_HASH=4e8ed79204df0fec11c3bacb3c517e0f33783f9626cb2b6e0e1e46b519ae09
SP1_SHASTA_AGGREGATION_VK_HASH=69640eee59d46fae18ecadf92189b4b20b63eb206bf4034d5aaf2bcf68a8b53b

# SGX MRENCLAVE
SGX_MRENCLAVE=cc28d7121684a5141435a4eb660a2f44ad3fdd67c44f0c351e6c1c2d1c043a8f
SGX_MRENCLAVE=72258d3cae0e9901d0efc1f630064f1c44f11950bd25fee0b62ec8df84532da2

# SGXGETH MRENCLAVE
SGXGETH_MRENCLAVE=d8395bb1ae83b13c2a9d8430f09137ec179a424926aee9c0639cda70936305b9
SGXGETH_MRENCLAVE=398be8424f27802b38e6e8d3413bf6a0b187349e68522a218f5bfc00279006ac
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ perf.data.old
.vscode/

log.build.*
docker/enclave-key.pem

# Python
# -----------------------------------------------------------------------------------------
venv/
.venv/

23 changes: 18 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ RUN ego-go build -o gaiko-ego ./cmd/gaiko

# Sign with our enclave config and private key
COPY gaiko/ego/enclave.json .
COPY docker/enclave-key.pem private.pem
RUN ego sign && ego bundle gaiko-ego gaiko
ARG ENCLAVE_KEY_PUBLIC_SHA256
RUN --mount=type=secret,id=enclave_key,target=/run/secrets/enclave-key.pem \
set -e; \
test -n "${ENCLAVE_KEY_PUBLIC_SHA256}"; \
test -s /run/secrets/enclave-key.pem; \
test "$(openssl rsa -in /run/secrets/enclave-key.pem -pubout 2>/dev/null | openssl sha256 | awk '{print $2}')" = "${ENCLAVE_KEY_PUBLIC_SHA256}"; \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass the BuildKit secret through compose builds

This makes Dockerfile require both ENCLAVE_KEY_PUBLIC_SHA256 and the enclave_key BuildKit secret, but the existing docker/docker-compose*.yml build blocks for Dockerfile only set context/dockerfile (and sometimes ENABLE_SELF_REGISTER) and never provide that arg or secret. Any documented local flow such as docker compose build raiko will now fail at this first signing step (and the same requirement is repeated in the runtime stage), even when the user has docker/enclave-key.pem locally, because compose is not passing it as a build secret.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 5da6773: compose/CI builds no longer require a BuildKit secret because the Dockerfile generates a throwaway RSA-3072/e=3 key only when no secret/hash is supplied. Release builds still pass ENCLAVE_KEY_PUBLIC_SHA256 and fail if the secret is missing.

cp /run/secrets/enclave-key.pem private.pem; \
trap 'rm -f private.pem' EXIT; \
ego sign && \
ego bundle gaiko-ego gaiko
RUN ego uniqueid gaiko-ego 2>&1 | tee /tmp/gaiko_uniqueid.log
RUN ego signerid gaiko-ego

Expand Down Expand Up @@ -87,13 +95,18 @@ COPY --from=builder /opt/raiko/host/config/chain_spec_list_devnet.json /etc/raik
COPY --from=builder /opt/raiko/target/release/sgx-guest ./bin/
COPY --from=builder /opt/raiko/target/release/raiko-host ./bin/
COPY --from=builder /opt/raiko/target/release/raiko-setup ./bin/
COPY --from=builder /opt/raiko/docker/enclave-key.pem /root/.config/gramine/enclave-key.pem

ARG EDMM=0
ARG ENCLAVE_KEY_PUBLIC_SHA256
ENV EDMM=${EDMM}
WORKDIR /opt/raiko/bin
RUN gramine-manifest -Dlog_level=error -Ddirect_mode=0 -Darch_libdir=/lib/x86_64-linux-gnu/ ../provers/sgx/config/sgx-guest.local.manifest.template sgx-guest.manifest && \
gramine-sgx-sign --manifest sgx-guest.manifest --output sgx-guest.manifest.sgx && \
RUN --mount=type=secret,id=enclave_key,target=/run/secrets/enclave-key.pem \
set -e; \
test -n "${ENCLAVE_KEY_PUBLIC_SHA256}"; \
test -s /run/secrets/enclave-key.pem; \
test "$(openssl rsa -in /run/secrets/enclave-key.pem -pubout 2>/dev/null | openssl sha256 | awk '{print $2}')" = "${ENCLAVE_KEY_PUBLIC_SHA256}"; \
gramine-manifest -Dlog_level=error -Ddirect_mode=0 -Darch_libdir=/lib/x86_64-linux-gnu/ ../provers/sgx/config/sgx-guest.local.manifest.template sgx-guest.manifest && \
gramine-sgx-sign --key /run/secrets/enclave-key.pem --manifest sgx-guest.manifest --output sgx-guest.manifest.sgx && \
gramine-sgx-sigstruct-view "sgx-guest.sig" 2>&1 | tee /tmp/sgx_sigstruct.log


Expand Down
39 changes: 0 additions & 39 deletions docker/enclave-key.pem

This file was deleted.

18 changes: 17 additions & 1 deletion script/publish-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,27 @@ case "$proof_type" in
esac

echo "Build and push $image_name:$tag..."
docker buildx build . \
build_secret_args=()
if [ "$proof_type" = "0" ] || [ "$proof_type" = "tee" ]; then
enclave_key_path="${ENCLAVE_KEY_PATH:-docker/enclave-key.pem}"
if [ ! -s "$enclave_key_path" ]; then
echo "❌ Missing enclave signing key: $enclave_key_path"
echo "Set ENCLAVE_KEY_PATH=/path/to/enclave-key.pem or provide docker/enclave-key.pem locally."
exit 1
fi
enclave_key_public_sha256="$(openssl rsa -in "$enclave_key_path" -pubout 2>/dev/null | openssl sha256 | awk '{print $2}')"
build_secret_args=(
--secret "id=enclave_key,src=$enclave_key_path"
--build-arg "ENCLAVE_KEY_PUBLIC_SHA256=$enclave_key_public_sha256"
)
fi

DOCKER_BUILDKIT=1 docker buildx build . \
-f $target_dockerfile \
--load \
--platform linux/amd64 \
-t $image_name:latest \
"${build_secret_args[@]}" \
$build_flags \
--build-arg TARGETPLATFORM=linux/amd64 \
--progress=plain \
Expand Down
Loading