Skip to content

Question: problems setting up Marblerun Quickstart SGX on local machine #327

@vdae

Description

@vdae

Hello, edgelessys team,

I'm having problems trying to set up sgx enabled marblerun in a local minikube cluster for running the emojivoto example.

My System runs Ubuntu LTS 20.04 and supports SGX and FLC (output from Gramines is-sgx-available tool):

SGX supported by CPU: true
SGX1 (ECREATE, EENTER, ...): true
SGX2 (EAUG, EACCEPT, EMODPR, ...): true
Flexible Launch Control (IA32_SGXPUBKEYHASH{0..3} MSRs): true
SGX extensions for virtualizers (EINCVIRTCHILD, EDECVIRTCHILD, ESETCONTEXT): false
Extensions for concurrent memory management (ETRACKC, ELDBC, ELDUC, ERDINFO): false
CET enclave attributes support (See Table 37-5 in the SDM): false
Key separation and sharing (KSS) support (CONFIGID, CONFIGSVN, ISVEXTPRODID, ISVFAMILYID report fields): false
Max enclave size (32-bit): 0x80000000
Max enclave size (64-bit): 0x1000000000
EPC size: 0x5e00000
SGX driver loaded: true
AESMD installed: true
SGX PSW/libsgx installed: true

Local Intel PCCS and AESMD services (sgx-aesm-service and sgx-dcap-pccs from intel sgx apt repo) are running and all other libsgx-* packages from apt are installed. “USE_SECURE_CERT”=FALSE is set in /etc/sgx_default_qcnl.conf. System is on the latest BIOS, so the TCB should not be a Problem.

The minikube cluster is set up like the one from your tf-training repo:

minikube start --mount --mount-string /var/run/aesmd/:/var/run/aesmd --memory 24576

minikube ssh
sudo mkdir /dev/sgx
sudo ln -s /dev/sgx_enclave /dev/sgx/enclave
sudo ln -s /dev/sgx_provision /dev/sgx/provision

minikube kubectl -- apply -f https://github.com/jetstack/cert-manager/releases/download/v1.3.3/cert-manager.yaml
minikube kubectl -- apply -k https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/sgx_plugin/overlays/epc-nfd/?ref=v0.23.0

When checking with kubectl the sgx device plugin is running, and marblerun precheck validates this:

user@nuc:~$ minikube kubectl -- describe node | grep sgx.intel.com
                    nfd.node.kubernetes.io/extended-resources: sgx.intel.com/epc
  sgx.intel.com/enclave:    110
  sgx.intel.com/epc:        98566144
  sgx.intel.com/provision:  110
  sgx.intel.com/enclave:    110
  sgx.intel.com/epc:        98566144
  sgx.intel.com/provision:  110
  sgx.intel.com/enclave    1           1
  sgx.intel.com/epc        10Mi        10Mi
  sgx.intel.com/provision  1           1
  
user@nuc:~$ marblerun precheck
  Cluster supports SGX on 1 node
  To install MarbleRun run [marblerun install]

I tried both, starting marblerun using the --dcap-qpl intel flag, and without:

When running marblerun install --dcap-secure-cert FALSE --dcap-qpl intel the coordinator fails when invoking main:

[meshentry] invoking premain
[meshentry] invoking main
{"level":"info","ts":1670679324.0814278,"caller":"coordinator/run.go:53","msg":"starting coordinator","version":"0.6.1","commit":"2233c5e5892faf16d63f26e6439a1cfc15e8cd81"}
{"level":"info","ts":1670679324.0814278,"caller":"coordinator/run.go:84","msg":"creating the Core object"}
{"level":"info","ts":1670679324.0814278,"caller":"core/core.go:137","msg":"loading state"}
{"level":"info","ts":1670679324.085428,"caller":"core/core.go:175","msg":"No sealed state found. Proceeding with new state."}
{"level":"info","ts":1670679324.0934281,"caller":"core/core.go:331","msg":"generating quote"}
[get_platform_quote_cert_data ../qe_logic.cpp:378] Error returned from the p_sgx_get_quote_config API. 0xe019
{"level":"fatal","ts":1670679324.169431,"caller":"coordinator/run.go:91","msg":"Cannot create Coordinator core","error":"failed to get quote: OE_PLATFORM_ERROR","stacktrace":"main.run\n\tgithub.com/edgelesssys/marblerun/cmd/coordinator/run.go:91\nmain.main\n\tgithub.com/edgelesssys/marblerun/cmd/coordinator/enclavemain.go:29\nmain.invokemain\n\tgithub.com/edgelesssys/marblerun/cmd/coordinator/invokemain.go:15\n_cgoexp_2210a7c57b2b_invokemain\n\t_cgo_gotypes.go:42\nruntime.cgocallbackg1\n\truntime/cgocall.go:314\nruntime.cgocallbackg\n\truntime/cgocall.go:233\nruntime.cgocallback\n\truntime/asm_amd64.s:971"}
[erthost] loading enclave ...
[erthost] entering enclave ...
ERROR: dcap_quoteprov: [ERROR]: [QPL] Failed to get quote config. Error code is 0xb006
ERROR: quote3_error_t=SGX_QL_NETWORK_ERROR
 (oe_result_t=OE_PLATFORM_ERROR) [openenclave-src/host/sgx/sgxquote.c:oe_sgx_qe_get_target_info:706]
ERROR: SGX Plugin _get_report(): failed to get ecdsa report. OE_PLATFORM_ERROR (oe_result_t=OE_PLATFORM_ERROR) [openenclave-src/enclave/sgx/attester.c:_get_report:324]

When running marblerun install --dcap-secure-cert FALSE (so it should be using the azure qpl) the coordinator starts, but the marbles fail:

Coordinator log:

When marble tries to register:

{"level":"info","ts":1670681725.410313,"caller":"core/marbleapi.go:55","msg":"Received activation request","MarbleType":"web"}
{"level":"info","ts":1670681725.6423116,"caller":"zap/options.go:212","msg":"finished unary call with code Unauthenticated","grpc.start_time":"2022-12-10T14:15:25Z","system":"grpc","span.kind":"server","grpc.service":"rpc.Marble","grpc.method":"Activate","peer.address":"172.17.0.1:41097","error":"rpc error: code = Unauthenticated desc = invalid quote","grpc.code":"Unauthenticated","grpc.time_ms":235.998}
{"level":"info","ts":1670681725.6743114,"caller":"zap/grpclogger.go:92","msg":"[transport]transport: loopyWriter.run returning. connection error: desc = \"transport is closing\"","system":"grpc","grpc_log":true}
ERROR: dcap_quoteprov: [ERROR]: HTTP error (404)
ERROR: dcap_quoteprov: [ERROR]: Encountered CURL error 22 in curl_easy_perform
ERROR: dcap_quoteprov: [ERROR]: curl error thrown, error code: 16: curl_easy_perform
ERROR: dcap_quoteprov: [ERROR]: Error fetching TCB Info: 57371
ERROR: Failed to get certificate quote verification collateral information. OE_QUOTE_PROVIDER_CALL_ERROR (oe_result_t=OE_QUOTE_PROVIDER_CALL_ERROR) [openenclave-src/common/sgx/endorsements.c:oe_get_sgx_endorsements:405]

Marble log:

EGo v0.3.2 (7aa02feec03da36f984a335ddd58c85cac5cedaa)
[erthost] loading enclave ...
[erthost] entering enclave ...
[PreMain] 2022/12/10 14:09:21 starting PreMain
[PreMain] 2022/12/10 14:09:21 fetching env variables
[PreMain] 2022/12/10 14:09:21 loading TLS Credentials
[PreMain] 2022/12/10 14:09:21 loading UUID
[PreMain] 2022/12/10 14:09:21 found UUID: 92ae931e-d476-4784-adf4-df4f8bffcd31
[PreMain] 2022/12/10 14:09:21 generating CSR
[PreMain] 2022/12/10 14:09:21 generating quote
Azure Quote Provider: libdcap_quoteprov.so [ERROR]: Could not retrieve environment variable for 'AZDCAP_DEBUG_LOG_LEVEL'
[PreMain] 2022/12/10 14:09:22 activating marble of type web
panic: rpc error: code = Unauthenticated desc = invalid quote
goroutine 17 [running, locked to thread]:
main.ert_ego_premain(0x7fbbc17bf368, 0x7fbbc17bf360, 0x41, 0x7fbbc2d88430, 0x7fbbc2d88390)
 ego/premain/main.go:31 +0x27b

To check the qpl I tried running Intels QuoteGenerationSample and it's working, but this is running on the host os and not in the minikube cluster.

sgx_qe_set_enclave_load_policy is valid in in-proc mode only and it is optional: the default enclave load policy is persistent: 
set the enclave load policy as persistent:succeed!

Step1: Call sgx_qe_get_target_info:succeed!
Step2: Call create_app_report:succeed!
Step3: Call sgx_qe_get_quote_size:succeed!
Step4: Call sgx_qe_get_quote:succeed!cert_key_type = 0x5
sgx_qe_cleanup_by_policy is valid in in-proc mode only.

 Clean up the enclave load policy:succeed!

The ego remote attestation sample is working locally, too (using the ego snap).

Do you have any ideas what could cause these problems?
Looking forward to your reply.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions