gsc icon indicating copy to clipboard operation
gsc copied to clipboard

GSC signing fails with syntax error for OpenSUSE distro

Open KiranSukhavasi opened this issue 8 months ago • 3 comments

Description of the problem and the error: All the workloads fails during gsc signing with syntax error with the commit 057184ca055ec385f6dde253ea12dddbcd821856

**[91m/bin/sh: -c: line 0: syntax error near unexpected token `&&'**

**/bin/sh: -c: line 0: `export PYTHONPATH="${PYTHONPATH:+$PYTHONPATH:}$(find /gramine/meson_build_output/lib64 -type d -path '*/site-packages')" &&       && gramine-sgx-sign       --key /gramine/app_files/gsc-signer-key.pem       --manifest /gramine/app_files/entrypoint.manifest       --output /gramine/app_files/entrypoint.manifest.sgx       ${passphrase:+--passphrase "$passphrase"}'
[0m**

Steps to reproduce: As per the steps mentioned in the url (https://github.com/gramineproject/gsc/tree/master/test), try to run any sample workload on suse distro, it fails after the gsc build and performing the gsc sign (./gsc sign-image ubuntu24.04-bash enclave-key.pem) with the above reported error.

Expected results: No errors should be thrown and we should be able to to do the build and sign the image properly.

Actual result:

+ ./gsc sign-image --remove-gramine-deps python-test enclave-key.pem
Signing graminized Docker image `gsc-python-test-unsigned` -> `gsc-python-test`...
Step 1/12 : FROM gsc-python-test-unsigned as unsigned_image

 ---> 57e7da88ec58
Step 2/12 : ARG BUILD_ID

 ---> Running in e31220615265
 ---> Removed intermediate container e31220615265
 ---> 770e48d153a9
Step 3/12 : LABEL build_id=$BUILD_ID

 ---> Running in fe04956e314f
 ---> Removed intermediate container fe04956e314f
 ---> 8482ed8b8db4
Step 4/12 : COPY gsc-signer-key.pem /gramine/app_files/gsc-signer-key.pem

 ---> 2ee60ca3a936
Step 5/12 : ARG passphrase

 ---> Running in bc49a8f8b3b1
 ---> Removed intermediate container bc49a8f8b3b1
 ---> dc44b97870bd
Step 6/12 : RUN export PYTHONPATH="${PYTHONPATH:+$PYTHONPATH:}$(find /gramine/meson_build_output/lib64 -type d -path '*/site-packages')" &&       && gramine-sgx-sign       --key /gramine/app_files/gsc-signer-key.pem       --manifest /gramine/app_files/entrypoint.manifest       --output /gramine/app_files/entrypoint.manifest.sgx       ${passphrase:+--passphrase "$passphrase"}

 ---> Running in 1b7e7e3fd6b3
[91m/bin/sh: -c: line 0: syntax error near unexpected token `&&'
/bin/sh: -c: line 0: `export PYTHONPATH="${PYTHONPATH:+$PYTHONPATH:}$(find /gramine/meson_build_output/lib64 -type d -path '*/site-packages')" &&       && gramine-sgx-sign       --key /gramine/app_files/gsc-signer-key.pem       --manifest /gramine/app_files/entrypoint.manifest       --output /gramine/app_files/entrypoint.manifest.sgx       ${passphrase:+--passphrase "$passphrase"}'
[0m
 ---> Removed intermediate container 1b7e7e3fd6b3
Failed to build a signed graminized Docker image `gsc-python-test`.

KiranSukhavasi avatar Apr 01 '25 17:04 KiranSukhavasi

@KiranSukhavasi: Thanks for reporting this issue!

@DukeDavis12: I think you might have missed updating this line: https://github.com/gramineproject/gsc/blob/67d82355821a427610dada4109ff25c7d7e97f45/templates/suse/Dockerfile.sign.template#L15 I'm curious why our internal CI didn't catch this. Shouldn't it validate all distros? cc @anjalirai-intel

kailun-qin avatar Apr 03 '25 02:04 kailun-qin

#237 @KiranSukhavasi Please validate the changes.

DukeDavis12 avatar Apr 03 '25 04:04 DukeDavis12

I'm curious why our internal CI didn't catch this. Shouldn't it validate all distros? cc @anjalirai-intel

Since this PR was going through multiple changes, we were only running ubuntu/debian distro tests.

jinengandhi-intel avatar Apr 03 '25 05:04 jinengandhi-intel

@KiranSukhavasi: Have you had a chance to validate https://github.com/gramineproject/gsc/pull/237? Does it resolve your issue?

@DukeDavis12, @jinengandhi-intel: Have we tested the fix internally w/ a SUSE setup?

kailun-qin avatar Jun 26 '25 01:06 kailun-qin

Hi Kailun, yes the fix is tested and it works.

jinengandhi-intel avatar Jun 26 '25 02:06 jinengandhi-intel