gramineproject / gramine

A library OS for Linux multi-process applications, with Intel SGX support
GNU Lesser General Public License v3.0
602 stars 201 forks source link

ra-tls-mbedtls client invalid certificate #570

Closed VogelIBR closed 2 years ago

VogelIBR commented 2 years ago

Description of the problem

The ra-tls-mbedtls example does not work for me both with EPID and DCAP. See the output below.

For the DCAP example I had to build and specify the LD_PATH of libra_tls_verify_dcap.so myself since it doesn't seem to be provided by the gramine installed through ubuntu. But that seems to be a unrelated problem I assume.

Steps to reproduce

  1. Install gramine on ubuntu
  2. Clone gramine project; checkout 1.1 with git checkout v1.1
  3. Generate rsa key openssl genrsa -3 -out "$HOME"/.config/gramine/enclave-key.pem 3072
  4. make SGX=1 SGX_SIGNER_KEY=~/.config/gramine/enclave-key.pem
  5. gramine-sgx server epid
  6. run client ./client epid 1deaf12d5caa694ce2958df7e3ab86b492658173a76247198bc9ff4a30a9a22c 6dbfdcaa4e7439d34752207bb323fb25c074746c27a018fdb729cb49ab46eb82 0 0

System info:

uname -a
Linux ssgx7 5.13.0-40-generic #45~20.04.1-Ubuntu SMP Mon Apr 4 09:38:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

cat /proc/sys/vm/mmap_min_addr
65536

Expected results

Normal output from both server and client.

Actual results

EPID

EPID build:

vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$  make SGX=1 SGX_SIGNER_KEY=~/.config/gramine/enclave-key.pem 
gramine-manifest \
    -Dlog_level=error \
    -Darch_libdir=/lib/x86_64-linux-gnu \
    -Dra_client_spid= \
    -Dra_client_linkable=0 \
    server.manifest.template > server.manifest
cc src/server.c -O2 -fPIE -I./mbedtls/include  -pie -ldl -Wl,-rpath,/usr/lib/x86_64-linux-gnu -lmbedcrypto_gramine -lmbedtls_gramine -lmbedx509_gramine -o server
gramine-sgx-sign \
    --key /ibr/home/vogel/.config/gramine/enclave-key.pem \
    --manifest server.manifest \
    --output server.manifest.sgx
Attributes:
    size:        0x10000000
    thread_num:  4
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0x6
    attr.xfrm:   0x3
    misc_select: 0x0
SGX remote attestation:
    DCAP/ECDSA
Memory:
    000000001fefd000-0000000020000000 [REG:R--] (manifest) measured
    000000001fedd000-000000001fefd000 [REG:RW-] (ssa) measured
    000000001fed9000-000000001fedd000 [TCS:---] (tcs) measured
    000000001fed5000-000000001fed9000 [REG:RW-] (tls) measured
    000000001fe95000-000000001fed5000 [REG:RW-] (stack) measured
    000000001fe55000-000000001fe95000 [REG:RW-] (stack) measured
    000000001fe15000-000000001fe55000 [REG:RW-] (stack) measured
    000000001fdd5000-000000001fe15000 [REG:RW-] (stack) measured
    000000001fdc5000-000000001fdd5000 [REG:RW-] (sig_stack) measured
    000000001fdb5000-000000001fdc5000 [REG:RW-] (sig_stack) measured
    000000001fda5000-000000001fdb5000 [REG:RW-] (sig_stack) measured
    000000001fd95000-000000001fda5000 [REG:RW-] (sig_stack) measured
    000000001f971000-000000001f9bd000 [REG:R-X] (code) measured
    000000001f9bd000-000000001fd95000 [REG:RW-] (data) measured
    0000000010000000-000000001f971000 [REG:RWX] (free)
Measurement:
    1deaf12d5caa694ce2958df7e3ab86b492658173a76247198bc9ff4a30a9a22c
gramine-sgx-get-token --output server.token --sig server.sig
Attributes:
    mr_enclave:  1deaf12d5caa694ce2958df7e3ab86b492658173a76247198bc9ff4a30a9a22c
    mr_signer:   6dbfdcaa4e7439d34752207bb323fb25c074746c27a018fdb729cb49ab46eb82
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0000000000000006
    attr.xfrm:   0000000000000007
    mask.flags:  ffffffffffffffff
    mask.xfrm:   fffffffffff9ff1b
    misc_select: 00000000
    misc_mask:   ffffffff
    modulus:     e5e7a210e89ceb31653ea6db2472ed5b...
    exponent:    3
    signature:   962ba43bd359c2e4cf44ca1652f87f67...
    date:        2022-05-06
cc src/client.c -O2 -fPIE -I./mbedtls/include  -pie -ldl -Wl,-rpath,/usr/lib/x86_64-linux-gnu -lmbedcrypto_gramine -lmbedtls_gramine -lmbedx509_gramine -o client
gramine-manifest \
    -Dlog_level=error \
    -Darch_libdir=/lib/x86_64-linux-gnu \
    client.manifest.template >client_epid.manifest
gramine-sgx-sign \
    --key /ibr/home/vogel/.config/gramine/enclave-key.pem \
    --manifest client_epid.manifest \
    --output client_epid.manifest.sgx
Attributes:
    size:        0x10000000
    thread_num:  4
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0x6
    attr.xfrm:   0x3
    misc_select: 0x0
SGX remote attestation:
    DCAP/ECDSA
Memory:
    000000001fefd000-0000000020000000 [REG:R--] (manifest) measured
    000000001fedd000-000000001fefd000 [REG:RW-] (ssa) measured
    000000001fed9000-000000001fedd000 [TCS:---] (tcs) measured
    000000001fed5000-000000001fed9000 [REG:RW-] (tls) measured
    000000001fe95000-000000001fed5000 [REG:RW-] (stack) measured
    000000001fe55000-000000001fe95000 [REG:RW-] (stack) measured
    000000001fe15000-000000001fe55000 [REG:RW-] (stack) measured
    000000001fdd5000-000000001fe15000 [REG:RW-] (stack) measured
    000000001fdc5000-000000001fdd5000 [REG:RW-] (sig_stack) measured
    000000001fdb5000-000000001fdc5000 [REG:RW-] (sig_stack) measured
    000000001fda5000-000000001fdb5000 [REG:RW-] (sig_stack) measured
    000000001fd95000-000000001fda5000 [REG:RW-] (sig_stack) measured
    000000001f971000-000000001f9bd000 [REG:R-X] (code) measured
    000000001f9bd000-000000001fd95000 [REG:RW-] (data) measured
    0000000010000000-000000001f971000 [REG:RWX] (free)
Measurement:
    3a4949dbf0fd01de7d4885b8f89dea27696c780381427a26d764b62a80a9e267
gramine-sgx-get-token --output client_epid.token --sig client_epid.sig
Attributes:
    mr_enclave:  3a4949dbf0fd01de7d4885b8f89dea27696c780381427a26d764b62a80a9e267
    mr_signer:   6dbfdcaa4e7439d34752207bb323fb25c074746c27a018fdb729cb49ab46eb82
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0000000000000006
    attr.xfrm:   0000000000000007
    mask.flags:  ffffffffffffffff
    mask.xfrm:   fffffffffff9ff1b
    misc_select: 00000000
    misc_mask:   ffffffff
    modulus:     e5e7a210e89ceb31653ea6db2472ed5b...
    exponent:    3
    signature:   17ee653897c7f9fd5a012415fa9ba014...
    date:        2022-05-06

Server output:

vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$ gramine-sgx server epid 
-----------------------------------------------------------------------------------------------------------------------
Gramine detected the following insecure configurations:

  - sgx.debug = true                           (this is a debug enclave)
  - loader.insecure__use_cmdline_argv = true   (forwarding command-line args from untrusted host to the app)
  - sgx.allowed_files = [ ... ]                (some files are passed through from untrusted host without verification)

Gramine will continue application execution, but this configuration must not be used in production!
-----------------------------------------------------------------------------------------------------------------------

  . Creating the RA-TLS server cert and key... ok
  . Bind on https://localhost:4433/ ... ok
  . Seeding the random number generator... ok
  . Setting up the SSL data.... ok
  . Waiting for a remote connection ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -80

Last error was: -80 - NET - Connection was reset by peer

  . Waiting for a remote connection ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -80

Last error was: -80 - NET - Connection was reset by peer

  . Waiting for a remote connection ...

Client EPID output:

vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$ ./client epid 1deaf12d5caa694ce2958df7e3ab86b492658173a76247198bc9ff4a30a9a22c 6dbfdcaa4e7439d34752207bb323fb25c074746c27a018fdb729cb49ab46eb82 0 0
[ using our own SGX-measurement verification callback (via command line options) ]
  - ignoring ISV_PROD_ID
  - ignoring ISV_SVN

  . Seeding the random number generator... ok
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Loading the CA root certificate ... ok
  . Installing RA-TLS callback ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -0x2800

Last error was: -10240 - X509 - Input invalid

vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$ ./client epid 0 0 0 0
[ using our own SGX-measurement verification callback (via command line options) ]
  - ignoring MRENCLAVE
  - ignoring MRSIGNER
  - ignoring ISV_PROD_ID
  - ignoring ISV_SVN

  . Seeding the random number generator... ok
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Loading the CA root certificate ... ok
  . Installing RA-TLS callback ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -0x2800

Last error was: -10240 - X509 - Input invalid

DCAP

DCAP Build

vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$ make app dcap SGX=1 SGX_SIGNER_KEY=~/.config/gramine/enclave-key.pem 
gramine-manifest \
    -Dlog_level=error \
    -Darch_libdir=/lib/x86_64-linux-gnu \
    -Dra_client_spid= \
    -Dra_client_linkable=0 \
    server.manifest.template > server.manifest
cc src/server.c -O2 -fPIE -I./mbedtls/include  -pie -ldl -Wl,-rpath,/usr/lib/x86_64-linux-gnu -lmbedcrypto_gramine -lmbedtls_gramine -lmbedx509_gramine -o server
gramine-sgx-sign \
    --key /ibr/home/vogel/.config/gramine/enclave-key.pem \
    --manifest server.manifest \
    --output server.manifest.sgx
Attributes:
    size:        0x10000000
    thread_num:  4
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0x6
    attr.xfrm:   0x3
    misc_select: 0x0
SGX remote attestation:
    DCAP/ECDSA
Memory:
    000000001fefd000-0000000020000000 [REG:R--] (manifest) measured
    000000001fedd000-000000001fefd000 [REG:RW-] (ssa) measured
    000000001fed9000-000000001fedd000 [TCS:---] (tcs) measured
    000000001fed5000-000000001fed9000 [REG:RW-] (tls) measured
    000000001fe95000-000000001fed5000 [REG:RW-] (stack) measured
    000000001fe55000-000000001fe95000 [REG:RW-] (stack) measured
    000000001fe15000-000000001fe55000 [REG:RW-] (stack) measured
    000000001fdd5000-000000001fe15000 [REG:RW-] (stack) measured
    000000001fdc5000-000000001fdd5000 [REG:RW-] (sig_stack) measured
    000000001fdb5000-000000001fdc5000 [REG:RW-] (sig_stack) measured
    000000001fda5000-000000001fdb5000 [REG:RW-] (sig_stack) measured
    000000001fd95000-000000001fda5000 [REG:RW-] (sig_stack) measured
    000000001f971000-000000001f9bd000 [REG:R-X] (code) measured
    000000001f9bd000-000000001fd95000 [REG:RW-] (data) measured
    0000000010000000-000000001f971000 [REG:RWX] (free)
Measurement:
    1deaf12d5caa694ce2958df7e3ab86b492658173a76247198bc9ff4a30a9a22c
gramine-sgx-get-token --output server.token --sig server.sig
Attributes:
    mr_enclave:  1deaf12d5caa694ce2958df7e3ab86b492658173a76247198bc9ff4a30a9a22c
    mr_signer:   6dbfdcaa4e7439d34752207bb323fb25c074746c27a018fdb729cb49ab46eb82
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0000000000000006
    attr.xfrm:   0000000000000007
    mask.flags:  ffffffffffffffff
    mask.xfrm:   fffffffffff9ff1b
    misc_select: 00000000
    misc_mask:   ffffffff
    modulus:     e5e7a210e89ceb31653ea6db2472ed5b...
    exponent:    3
    signature:   962ba43bd359c2e4cf44ca1652f87f67...
    date:        2022-05-06
cc src/client.c -O2 -fPIE -I./mbedtls/include  -pie -ldl -Wl,-rpath,/usr/lib/x86_64-linux-gnu -lmbedcrypto_gramine -lmbedtls_gramine -lmbedx509_gramine -o client
gramine-manifest \
    -Dlog_level=error \
    -Darch_libdir=/lib/x86_64-linux-gnu \
    client.manifest.template >client_dcap.manifest
gramine-sgx-sign \
    --key /ibr/home/vogel/.config/gramine/enclave-key.pem \
    --manifest client_dcap.manifest \
    --output client_dcap.manifest.sgx
Attributes:
    size:        0x10000000
    thread_num:  4
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0x6
    attr.xfrm:   0x3
    misc_select: 0x0
SGX remote attestation:
    DCAP/ECDSA
Memory:
    000000001fefd000-0000000020000000 [REG:R--] (manifest) measured
    000000001fedd000-000000001fefd000 [REG:RW-] (ssa) measured
    000000001fed9000-000000001fedd000 [TCS:---] (tcs) measured
    000000001fed5000-000000001fed9000 [REG:RW-] (tls) measured
    000000001fe95000-000000001fed5000 [REG:RW-] (stack) measured
    000000001fe55000-000000001fe95000 [REG:RW-] (stack) measured
    000000001fe15000-000000001fe55000 [REG:RW-] (stack) measured
    000000001fdd5000-000000001fe15000 [REG:RW-] (stack) measured
    000000001fdc5000-000000001fdd5000 [REG:RW-] (sig_stack) measured
    000000001fdb5000-000000001fdc5000 [REG:RW-] (sig_stack) measured
    000000001fda5000-000000001fdb5000 [REG:RW-] (sig_stack) measured
    000000001fd95000-000000001fda5000 [REG:RW-] (sig_stack) measured
    000000001f971000-000000001f9bd000 [REG:R-X] (code) measured
    000000001f9bd000-000000001fd95000 [REG:RW-] (data) measured
    0000000010000000-000000001f971000 [REG:RWX] (free)
Measurement:
    3a4949dbf0fd01de7d4885b8f89dea27696c780381427a26d764b62a80a9e267
gramine-sgx-get-token --output client_dcap.token --sig client_dcap.sig
Attributes:
    mr_enclave:  3a4949dbf0fd01de7d4885b8f89dea27696c780381427a26d764b62a80a9e267
    mr_signer:   6dbfdcaa4e7439d34752207bb323fb25c074746c27a018fdb729cb49ab46eb82
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0000000000000006
    attr.xfrm:   0000000000000007
    mask.flags:  ffffffffffffffff
    mask.xfrm:   fffffffffff9ff1b
    misc_select: 00000000
    misc_mask:   ffffffff
    modulus:     e5e7a210e89ceb31653ea6db2472ed5b...
    exponent:    3
    signature:   17ee653897c7f9fd5a012415fa9ba014...
    date:        2022-05-06

Server DCAP output

vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$ gramine-sgx server dcap
-----------------------------------------------------------------------------------------------------------------------
Gramine detected the following insecure configurations:

  - sgx.debug = true                           (this is a debug enclave)
  - loader.insecure__use_cmdline_argv = true   (forwarding command-line args from untrusted host to the app)
  - sgx.allowed_files = [ ... ]                (some files are passed through from untrusted host without verification)

Gramine will continue application execution, but this configuration must not be used in production!
-----------------------------------------------------------------------------------------------------------------------

  . Creating the RA-TLS server cert and key... ok
  . Bind on https://localhost:4433/ ... ok
  . Seeding the random number generator... ok
  . Setting up the SSL data.... ok
  . Waiting for a remote connection ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -30592

Last error was: -30592 - SSL - A fatal alert message was received from our peer

  . Waiting for a remote connection ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -30592

Last error was: -30592 - SSL - A fatal alert message was received from our peer

  . Waiting for a remote connection ...

Client DCAP output

vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$ ./client dcap 1deaf12d5caa694ce2958df7e3ab86b492658173a76247198bc9ff4a30a9a22c 6dbfdcaa4e7439d34752207bb323fb25c074746c27a018fdb729cb49ab46eb82 0 0
libra_tls_verify_dcap.so: cannot open shared object file: No such file or directory
User requested RA-TLS verification with DCAP but cannot find lib
vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$ LD_LIBRARY_PATH=/ibr/home/vogel/tmp/gramine/build/Pal/src/host/Linux-SGX/tools/ra-tls/ ./client dcap 1deaf12d5caa694ce2958df7e3ab86b492658173a76247198bc9ff4a30a9a22c 6dbfdcaa4e7439d34752207bb323fb25c074746c27a018fdb729cb49ab46eb82 0 0
[ using our own SGX-measurement verification callback (via command line options) ]
  - ignoring ISV_PROD_ID
  - ignoring ISV_SVN

  . Seeding the random number generator... ok
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Loading the CA root certificate ... ok
  . Installing RA-TLS callback ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -0x3000

Last error was: -12288 - X509 - A fatal error occurred, eg the chain is too long or the vrfy callback failed

vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$ LD_LIBRARY_PATH=/ibr/home/vogel/tmp/gramine/build/Pal/src/host/Linux-SGX/tools/ra-tls/ ./client dcap 0 0 0 0
[ using our own SGX-measurement verification callback (via command line options) ]
  - ignoring MRENCLAVE
  - ignoring MRSIGNER
  - ignoring ISV_PROD_ID
  - ignoring ISV_SVN

  . Seeding the random number generator... ok
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Loading the CA root certificate ... ok
  . Installing RA-TLS callback ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -0x3000

Last error was: -12288 - X509 - A fatal error occurred, eg the chain is too long or the vrfy callback failed
dimakuv commented 2 years ago

What is the Intel CPU you're using? Is this a Skylake, CoffeeLake, Icelake, etc.?

Some Intel CPUs support only EPID, some Intel CPUs support only DCAP.

Also, it is illegal to install both EPID- and DCAP-specific Intel SGX PSW packages (which I presume you've done).

Finally, you're writing:

For the DCAP example I had to build and specify the LD_PATH of libra_tls_verify_dcap.so myself since it doesn't seem to be provided by the gramine installed through ubuntu

This is correct. The current latest Gramine package for Ubuntu (v1.1) does not come with DCAP libraries provided. This will be fixed in the next release (v1.2).

But how did you get libra_tls_verify_dcap.so then? You manually performed the build steps of git-cloned Gramine sources via meson build -Ddcap=enabled ... + sudo ninja build install?

In general, I would recommend to just check out the latest master version of Gramine from GitHub and manually build and install it, with the -Ddcap=enabled option. This will make sure to install Gramine with DCAP supported.

VogelIBR commented 2 years ago

I am using Intel(R) Xeon(R) E-2176G CPU which seems to be Coffee Lake.

But how did you get libra_tls_verify_dcap.so then? You manually performed the build steps of git-cloned Gramine sources via meson build -Ddcap=enabled ... + sudo ninja build install?

Yes I build it myself, but I did not install it. I made it available to the client with LD_LIBRARY_PATH=/ibr/home/vogel/tmp/gramine/build/Pal/src/host/Linux-SGX/tools/ra-tls/ ./client ...

dimakuv commented 2 years ago

Yes I build it myself, but I did not install it.

Hm, that's brittle and clearly not as it's supposed to be.

Please try to install Gramine in a manual way. Please refer to https://gramine.readthedocs.io/en/latest/devel/building.html#id2. Note that this step is done after you git-cloned Gramine and cded into the cloned directory. Don't forget to add -Ddcap=enabled to the meson build command.

VogelIBR commented 2 years ago

This is the output of the clients with gramine at f34f093cdc781a25d9fb4b27a7b5149b616e0da8 setup as meson setup build/ --buildtype=release -Ddirect=enabled -Dsgx=enabled -Ddcap=enabled

vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$ ./client epid 0 0 0 0 
[ using our own SGX-measurement verification callback (via command line options) ]
  - ignoring MRENCLAVE
  - ignoring MRSIGNER
  - ignoring ISV_PROD_ID
  - ignoring ISV_SVN

  . Seeding the random number generator... ok
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Loading the CA root certificate ... ok
  . Installing RA-TLS callback ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -0x2800

Last error was: -10240 - X509 - Input invalid
vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$ ./client dcap 0 0 0 0 
[ using our own SGX-measurement verification callback (via command line options) ]
  - ignoring MRENCLAVE
  - ignoring MRSIGNER
  - ignoring ISV_PROD_ID
  - ignoring ISV_SVN

  . Seeding the random number generator... ok
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Loading the CA root certificate ... ok
  . Installing RA-TLS callback ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -0x3000

Last error was: -12288 - X509 - A fatal error occurred, eg the chain is too long or the vrfy callback failed
vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$ gramine-sgx client_dcap dcap 0 0 0 0
Gramine is starting. Parsing TOML manifest file, this may take some time...
-----------------------------------------------------------------------------------------------------------------------
Gramine detected the following insecure configurations:

  - sgx.debug = true                           (this is a debug enclave)
  - loader.insecure__use_cmdline_argv = true   (forwarding command-line args from untrusted host to the app)
  - loader.insecure__use_host_env = true       (forwarding environment vars from untrusted host to the app)
  - sgx.allowed_files = [ ... ]                (some files are passed through from untrusted host without verification)

Gramine will continue application execution, but this configuration must not be used in production!
-----------------------------------------------------------------------------------------------------------------------

[ using our own SGX-measurement verification callback (via command line options) ]
  - ignoring MRENCLAVE
  - ignoring MRSIGNER
  - ignoring ISV_PROD_ID
  - ignoring ISV_SVN

  . Seeding the random number generator... ok
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Loading the CA root certificate ... ok
  . Installing RA-TLS callback ... ok
  . Performing the SSL/TLS handshake...[get_driver_type /home/sgx/jenkins/ubuntuServer2004-release-build-trunk-216/build_target/PROD/label/Builder-UbuntuSrv20/label_exp/ubuntu64/linux-trunk-opensource/psw/urts/linux/edmm_utility.cpp:116] Failed to open Intel SGX device.
[get_driver_type /home/sgx/jenkins/ubuntuServer2004-release-build-trunk-216/build_target/PROD/label/Builder-UbuntuSrv20/label_exp/ubuntu64/linux-trunk-opensource/psw/urts/linux/edmm_utility.cpp:116] Failed to open Intel SGX device.
 failed
  ! mbedtls_ssl_handshake returned -0x3000

Last error was: -12288 - X509 - A fatal error occurred, eg the chain is too long or the vrfy callback failed
vogel@ssgx7:/opt/gramine/CI-Examples/ra-tls-mbedtls$ gramine-sgx client_epid epid 0 0 0 0
Gramine is starting. Parsing TOML manifest file, this may take some time...
-----------------------------------------------------------------------------------------------------------------------
Gramine detected the following insecure configurations:

  - sgx.debug = true                           (this is a debug enclave)
  - loader.insecure__use_cmdline_argv = true   (forwarding command-line args from untrusted host to the app)
  - loader.insecure__use_host_env = true       (forwarding environment vars from untrusted host to the app)
  - sgx.allowed_files = [ ... ]                (some files are passed through from untrusted host without verification)

Gramine will continue application execution, but this configuration must not be used in production!
-----------------------------------------------------------------------------------------------------------------------

[ using our own SGX-measurement verification callback (via command line options) ]
  - ignoring MRENCLAVE
  - ignoring MRSIGNER
  - ignoring ISV_PROD_ID
  - ignoring ISV_SVN

  . Seeding the random number generator... ok
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Loading the CA root certificate ... ok
  . Installing RA-TLS callback ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -0x2800

Last error was: -10240 - X509 - Input invalid
dimakuv commented 2 years ago

Please try to build & install Gramine, as I recommended above. You're basically using two different versions: your core Gramine is v1.1, but your RA-TLS DCAP library is the master version. Combining two versions leads to unpredictable results.

VogelIBR commented 2 years ago

Please try to build & install Gramine, as I recommended above. You're basically using two different versions: your core Gramine is v1.1, but your RA-TLS DCAP library is the master version. Combining two versions leads to unpredictable results.

Oh sorry I didn't make that clear. The output from above is with gramine installed as you recommended it. It's the output after apt remove gramine-dcap, and then building gramine from master at commit https://github.com/gramineproject/gramine/commit/f34f093cdc781a25d9fb4b27a7b5149b616e0da8. Build and install steps were meson setup build/ --buildtype=release -Ddirect=enabled -Dsgx=enabled -Ddcap=enabled and sudo ninja -C build/ install.

dimakuv commented 2 years ago

Sorry, that was my blunder. I forgot to update this GitHub page today, so I had the stale messages still :)

It's hard to say what goes wrong in this ra-tls-mbedtls example. I'm afraid you need to verify your installation of the SGX PSW + DCAP software stack. You should start here, if you haven't done it already: https://www.intel.com/content/www/us/en/developer/articles/guide/intel-software-guard-extensions-data-center-attestation-primitives-quick-install-guide.html

VogelIBR commented 2 years ago

Looking at the output again, is this correct?

gramine-sgx-sign \
    --key /ibr/home/vogel/.config/gramine/enclave-key.pem \
    --manifest client_epid.manifest \
    --output client_epid.manifest.sgx
Attributes:
    size:        0x10000000
    thread_num:  4
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0x6
    attr.xfrm:   0x3
    misc_select: 0x0
SGX remote attestation:
    DCAP/ECDSA

Why would it use DCAP for RA when generating the client_epid?


Anyways I tried the whole setup from scratch again with the same outcome.

Installing only epid:

echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | sudo tee /etc/a    pt/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
sudo apt-get update
sudo apt-get install libsgx-epid libsgx-quote-ex

Installing gramine dependencies

sudo apt-get install -y autoconf bison build-essential gawk \
    python3 python3-click python3-jinja2 wget
sudo pip3 install meson
sudo apt-get install -y libcurl4-openssl-dev libprotobuf-c-dev \
    protobuf-c-compiler python3-pip python3-protobuf
python3 -m pip install toml>=0.10

Building and installing gramine from master

sudo ninja -C build/ install
meson setup build/ --buildtype=release -Ddirect=enabled -Dsgx=enabled

And again I get (also same when running it simply as ./client)

$ gramine-sgx client_epid epid 0 0 0 0
Gramine is starting. Parsing TOML manifest file, this may take some time...
Detected a huge manifest, preallocating 64MB of internal memory.
-----------------------------------------------------------------------------------------------------------------------
Gramine detected the following insecure configurations:

  - sgx.debug = true                           (this is a debug enclave)
  - loader.insecure__use_cmdline_argv = true   (forwarding command-line args from untrusted host to the app)
  - loader.insecure__use_host_env = true       (forwarding environment vars from untrusted host to the app)
  - sgx.allowed_files = [ ... ]                (some files are passed through from untrusted host without verification)

Gramine will continue application execution, but this configuration must not be used in production!
-----------------------------------------------------------------------------------------------------------------------

[ using our own SGX-measurement verification callback (via command line options) ]
  - ignoring MRENCLAVE
  - ignoring MRSIGNER
  - ignoring ISV_PROD_ID
  - ignoring ISV_SVN

  . Seeding the random number generator... ok
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Loading the CA root certificate ... ok
  . Installing RA-TLS callback ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -0x2800

Last error was: -10240 - X509 - Input invalid

while the Intel SDX RemoteAttestation sample works

Details (using details as its quite quite long) ``` vogel@ssgx8:/opt/intel/sgxsdk/SampleCode/RemoteAttestation$ LD_LIBRARY_PATH=sample_libcrypto/ ./app First round, we will try ECDSA algorithm. Call sgx_get_extended_epid_group_id success. MSG0 body generated - 4 bytes: { 0x0, 0x0, 0x0, 0x0 } Sending msg0 to remote attestation service provider. Sent MSG0 to remote attestation service. Call sgx_select_att_key_id success. Call sgx_create_enclave success. Call enclave_init_ra success. Call sgx_ra_get_msg1_ex success. MSG1 body generated - 68 bytes: { 0xf5, 0xde, 0x99, 0x9b, 0x7c, 0x8, 0x4a, 0x9b, 0xe8, 0x27, 0x85, 0x1e, 0xbe, 0xbe, 0xd3, 0x9e, 0xee, 0x35, 0x45, 0xc4, 0x81, 0xe6, 0x57, 0x19, 0xcc, 0x20, 0x28, 0x33, 0xd1, 0x1f, 0x4, 0x1, 0x4, 0xc9, 0x76, 0xfe, 0x41, 0x9f, 0xee, 0xf, 0xde, 0x1b, 0xc9, 0x6a, 0x42, 0x3e, 0x43, 0x6e, 0xe0, 0x38, 0x36, 0x66, 0xc1, 0x99, 0xee, 0x46, 0x4b, 0xcd, 0x1b, 0xcc, 0x92, 0xab, 0xd7, 0x26, 0x0, 0x0, 0x0, 0x0 } Sending msg1 to remote attestation service provider.Expecting msg2 back. Sent MSG1 to remote attestation service provider. Received the following MSG2: 176 bytes: { 0x2, 0x0, 0x0, 0xa8, 0x0, 0x0, 0x0, 0x0, 0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 0x79, 0xa7, 0x38, 0x72, 0xf2, 0xb8, 0xd6, 0xbe, 0x18, 0x91, 0x7f, 0xf7, 0xb5, 0xd3, 0xe5, 0x64, 0x9b, 0x12, 0x18, 0xaf, 0x39, 0x29, 0x6c, 0x24, 0x19, 0x38, 0x29, 0xb, 0xc6, 0xac, 0xc, 0x62, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x58, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 0xed, 0xbf, 0x2f, 0x21, 0x57, 0x80, 0x86, 0x9c, 0xe, 0xb6, 0x86, 0xf1, 0x62, 0xcb, 0x2a, 0x33, 0x3a, 0x25, 0x42, 0xb6, 0xc7, 0x56, 0x56, 0x4, 0x34, 0x83, 0xe0, 0x77, 0x61, 0xc4, 0xb0, 0x85, 0x83, 0x67, 0x33, 0x57, 0xfe, 0xdd, 0x1, 0x2d, 0xfb, 0x85, 0x8c, 0xba, 0xa9, 0x99, 0x19, 0x6d, 0x0, 0x0, 0x0, 0x0 } A more descriptive representation of MSG2: RESPONSE TYPE: 0x2 RESPONSE STATUS: 0x0 0x0 RESPONSE BODY SIZE: 168 MSG2 gb - 64 bytes: { 0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 0x79, 0xa7, 0x38, 0x72, 0xf2, 0xb8, 0xd6, 0xbe, 0x18, 0x91, 0x7f, 0xf7, 0xb5, 0xd3, 0xe5, 0x64, 0x9b, 0x12, 0x18, 0xaf, 0x39, 0x29, 0x6c, 0x24, 0x19, 0x38, 0x29, 0xb, 0xc6, 0xac, 0xc, 0x62 } MSG2 spid - 16 bytes: { 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x58, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } MSG2 quote_type : 1 MSG2 kdf_id : 1 MSG2 sign_gb_ga - 64 bytes: { 0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 0x71, 0xfd, 0x73, 0x66, 0xd7, 0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, 0xb4, 0xc6, 0xa, 0xcc, 0x1f, 0x40, 0x3, 0x3a, 0xbd, 0x8f, 0x7f, 0xe0, 0x0, 0xb3, 0x77, 0xb3, 0xe6, 0xcb, 0x4d, 0xde, 0xf1, 0x65, 0x3a, 0x5d, 0x42, 0x8e, 0xe2, 0xe7, 0x25, 0x49, 0x5b, 0x4e, 0x3a, 0x13, 0x13, 0x22, 0xc9, 0x7, 0xc6, 0xa9, 0x74, 0x35, 0x50, 0x11, 0xe2, 0xeb, 0xa2, 0xb0, 0x56, 0x15, 0xe9, 0xf5, 0x9b, 0xbd, 0x99, 0xdc, 0x91, 0x9c, 0xf4, 0x2a, 0x51, 0xdd, 0xc1, 0x16, 0x19, 0x6d, 0x39, 0x89, 0xb0, 0xeb, 0x1, 0x88, 0xc, 0x44, 0x1d, 0x20, 0xd0, 0x82, 0x5b, 0x53, 0xfc, 0x8a, 0x23, 0xa1, 0x4b, 0xa4, 0x6d, 0x18, 0x46, 0xda, 0x28, 0x6, 0x12, 0x3, 0x5, 0x1, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0 } Attestation Report: id: 0x12345678. status: 0. revocation_reason: 0. pse_status: 0. Enclave Report: Signature Type: 0x2 Signature Basename: ÷L© ³¯9³Pl ÷'çó¯¤däe attributes.flags: 0x7 attributes.xfrm: 0x7 mr_enclave: 59440138f8002d1dec8a7d238b7ed719b4061393011c78b4131e78d0ea23e70a mr_signer: 60277ad2fdfc57e980e876e7f878ac1909880ea5380795a7e8ea98b157841f85 isv_prod_id: 0x0 isv_svn: 0x0 Sent MSG3 successfully. Received an attestation result message back . ATTESTATION RESULT RECEIVED - 145 bytes: { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x97, 0x9e, 0xb9, 0x5a, 0xdd, 0x14, 0x17, 0xf2, 0xfa, 0xad, 0xfa, 0xd7, 0x66, 0x73, 0xfd, 0x71, 0x57, 0xf4, 0xe9, 0x8d, 0xee, 0xaf, 0x42, 0x5e, 0xbb, 0x8a, 0x4c, 0xd4, 0x84, 0xdc, 0x83, 0x6a, 0x8, 0x70, 0xd, 0xf2, 0x42, 0x8b, 0x2b, 0xee, 0x42, 0xb0, 0x85, 0xe5, 0xbf, 0x99, 0xc5, 0x22, 0xf8, 0x37, 0xf7, 0xee, 0xb6, 0x2c, 0xd5, 0x8c, 0x37, 0xa2, 0xd2, 0x51, 0xed, 0x45, 0xf9, 0x65, 0x90, 0x85, 0xea, 0x5a, 0x1e, 0xc, 0x4, 0xa1, 0xf5, 0xfc, 0x54, 0x3e, 0x92, 0x40, 0x48, 0x13, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2e, 0x7b, 0xf8, 0xd5, 0x80, 0x2f, 0xed, 0xa0, 0x96, 0x11, 0x66, 0x42, 0xeb, 0x29, 0xa4, 0xf4 } Secret successfully received from server. Remote attestation success! Call enclave_ra_close success. Second round, we will try EPID algorithm. Call sgx_get_extended_epid_group_id success. MSG0 body generated - 4 bytes: { 0x0, 0x0, 0x0, 0x0 } Sending msg0 to remote attestation service provider. Sent MSG0 to remote attestation service. Call sgx_select_att_key_id success. Call sgx_create_enclave success. Call enclave_init_ra success. Call sgx_ra_get_msg1_ex success. MSG1 body generated - 68 bytes: { 0x71, 0x74, 0xc6, 0xd0, 0x4c, 0xbf, 0x93, 0xe1, 0x6f, 0xab, 0x99, 0xbd, 0x86, 0x4f, 0x91, 0x3c, 0x77, 0xfd, 0x81, 0x7, 0x6e, 0x5, 0xad, 0x27, 0x8b, 0xcc, 0x30, 0x4a, 0xe1, 0x1, 0x16, 0xc4, 0x91, 0xfb, 0x72, 0x8f, 0xe2, 0xc8, 0xaf, 0xb4, 0x6, 0x9e, 0x72, 0x81, 0x1a, 0x26, 0x9, 0x1e, 0x5e, 0x7f, 0xe, 0x46, 0x89, 0xd3, 0x3e, 0x17, 0x5c, 0xc5, 0xd3, 0x88, 0x38, 0x76, 0xfa, 0x7b, 0x0, 0x0, 0x0, 0x0 } Sending msg1 to remote attestation service provider.Expecting msg2 back. Sent MSG1 to remote attestation service provider. Received the following MSG2: 176 bytes: { 0x2, 0x0, 0x0, 0xa8, 0x0, 0x0, 0x0, 0x0, 0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 0x79, 0xa7, 0x38, 0x72, 0xf2, 0xb8, 0xd6, 0xbe, 0x18, 0x91, 0x7f, 0xf7, 0xb5, 0xd3, 0xe5, 0x64, 0x9b, 0x12, 0x18, 0xaf, 0x39, 0x29, 0x6c, 0x24, 0x19, 0x38, 0x29, 0xb, 0xc6, 0xac, 0xc, 0x62, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x58, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 0x39, 0x6e, 0xbd, 0xa4, 0x4b, 0x98, 0x93, 0xd0, 0xff, 0xd9, 0x53, 0xfc, 0x2f, 0xf0, 0xb2, 0x7c, 0x78, 0x38, 0xad, 0x4a, 0x56, 0x2a, 0x3d, 0xc0, 0xf, 0xa0, 0x7c, 0xaa, 0xf8, 0x2, 0x9a, 0x3c, 0x41, 0x4a, 0x7, 0x6c, 0xf9, 0xec, 0xcf, 0x1d, 0x77, 0x5f, 0x4f, 0x5b, 0xee, 0xc9, 0x28, 0x7c, 0x0, 0x0, 0x0, 0x0 } A more descriptive representation of MSG2: RESPONSE TYPE: 0x2 RESPONSE STATUS: 0x0 0x0 RESPONSE BODY SIZE: 168 MSG2 gb - 64 bytes: { 0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 0x79, 0xa7, 0x38, 0x72, 0xf2, 0xb8, 0xd6, 0xbe, 0x18, 0x91, 0x7f, 0xf7, 0xb5, 0xd3, 0xe5, 0x64, 0x9b, 0x12, 0x18, 0xaf, 0x39, 0x29, 0x6c, 0x24, 0x19, 0x38, 0x29, 0xb, 0xc6, 0xac, 0xc, 0x62 } MSG2 spid - 16 bytes: { 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x58, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } MSG2 quote_type : 1 MSG2 kdf_id : 1 MSG2 sign_gb_ga - 64 bytes: { 0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 0x39, 0x6e, 0xbd, 0xa4, 0x4b, 0x98, 0x93, 0xd0, 0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76, 0xef, 0xb9, 0xff, 0x92, 0x72, 0xf3, 0xe9, 0x79, 0xc8, 0x9b, 0xee, 0xdc, 0x6a, 0x44, 0x6a, 0xe3, 0x49, 0xbe, 0xa3, 0x19, 0x8d, 0xa4, 0x8e, 0xa0, 0xf2, 0x7b, 0xce, 0x35, 0x64, 0x2c, 0x37, 0xb5, 0xb9, 0x72, 0x56, 0x17, 0x4d, 0x6d, 0x52, 0xa7, 0x4f, 0x30, 0xfa, 0x8c, 0x85, 0xe0, 0x12, 0x6d, 0xbd, 0x7a, 0x97, 0x93, 0x30, 0x9d, 0x12, 0x0, 0x6c, 0xc8, 0x1a, 0x1c, 0xc5, 0xf, 0x65, 0xa8, 0x6e, 0xed, 0x74, 0xab, 0x37, 0xed, 0x8a, 0x80, 0x3c, 0xca, 0xc3, 0xc2, 0xd8, 0x65, 0xb6, 0x1e, 0x29, 0xff, 0xee, 0xc6, 0x9f, 0xcd, 0x55, 0x58, 0x6, 0x49, 0xa5, 0xcc, 0x7f, 0x25, 0xc4, 0x43, 0xf1, 0x4d, 0x62, 0xf2, 0xda, 0x95, 0x7d, 0x44, 0xcb, 0xd, 0xca, 0x4b, 0xd, 0xd1, 0xe2, 0xe9, 0x64, 0x35, 0x22, 0x41, 0x9b, 0x8f, 0xa9, 0x53, 0x67, 0x55, 0x8f, 0x98, 0x1, 0xfe, 0xd1, 0xf6, 0x7b, 0xe5, 0xec, 0xfa, 0x6e, 0x61, 0xd0, 0xe2, 0xe4, 0xbf, 0x9b, 0x97, 0x97, 0xf9, 0x31, 0xb2, 0xdb, 0xf7, 0x85, 0xad, 0x26, 0x78, 0xc8, 0xe1, 0x42 } Attestation Report: id: 0x12345678. status: 0. revocation_reason: 0. pse_status: 0. Enclave Report: Signature Type: 0x0 Signature Basename: attributes.flags: 0x7 attributes.xfrm: 0x7 mr_enclave: 59440138f8002d1dec8a7d238b7ed719b4061393011c78b4131e78d0ea23e70a mr_signer: 60277ad2fdfc57e980e876e7f878ac1909880ea5380795a7e8ea98b157841f85 isv_prod_id: 0x0 isv_svn: 0x0 Sent MSG3 successfully. Received an attestation result message back . ATTESTATION RESULT RECEIVED - 145 bytes: { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x97, 0x9e, 0xb9, 0x5a, 0xdd, 0x14, 0x17, 0xf2, 0xfa, 0xad, 0xfa, 0xd7, 0x66, 0x73, 0xfd, 0x71, 0x57, 0xf4, 0xe9, 0x8d, 0xee, 0xaf, 0x42, 0x5e, 0xbb, 0x8a, 0x4c, 0xd4, 0x84, 0xdc, 0x83, 0x6a, 0x8, 0x70, 0xd, 0xf2, 0x42, 0x8b, 0x2b, 0xee, 0x42, 0xb0, 0x85, 0xe5, 0xbf, 0x99, 0xc5, 0x22, 0xf8, 0x37, 0xf7, 0xee, 0xb6, 0x2c, 0xd5, 0x8c, 0x37, 0xa2, 0xd2, 0x51, 0xed, 0x45, 0xf9, 0x65, 0x22, 0xe1, 0x92, 0x5f, 0x31, 0x76, 0xdb, 0x44, 0x95, 0x71, 0x82, 0xa2, 0x3a, 0xbd, 0x78, 0xe9, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcf, 0x10, 0x71, 0x54, 0x13, 0xdb, 0x9e, 0x81, 0xe2, 0x7, 0x7f, 0x87, 0xf6, 0x52, 0x17, 0x54 } Secret successfully received from server. Remote attestation success! Call enclave_ra_close success. Enter a character before exit ... ```
dimakuv commented 2 years ago

Looks like your machine supports both EPID and DCAP.

Ok, please start with EPID flows (since you already installed them on the machine).

Why would it use DCAP for RA when generating the client_epid?

That's because you seem to forgot to specify RA_CLIENT_SPID=12345678901234567890123456789012 RA_CLIENT_LINKABLE=0 make app epid ... environment variables during application build.

When you register at Intel EPID attestation internet webpage, you'll get your SPID and EPID key (and also you'll choose the "linkable"/"unlinkable" version). You need to specify these SGX EPID parameters when you build and run the SGX application.

Please read the README carefully: https://github.com/gramineproject/gramine/blob/master/CI-Examples/ra-tls-mbedtls/README.md

VogelIBR commented 2 years ago

Thanks a lot. I got it to run now.

One last thing: I had to specify loader.pal_internal_mem_size = "64M" for both server and client for them to run.

gramine-sgx server native
Gramine is starting. Parsing TOML manifest file, this may take some time...
Detected a huge manifest, preallocating 64MB of internal memory.
error: Too small `loader.pal_internal_mem_size`, need at least 64MB because the manifest is large
dimakuv commented 2 years ago

One last thing: I had to specify loader.pal_internal_mem_size = "64M" for both server and client for them to run.

Yes, these memory sizes depend on how many files you have in your default system paths (I don't want to go into details here). So it looks like your system has a lot of stuff installed. On my local system, I don't need to add this environment option (the default size of internal memory is enough for my system).