veracruz-project / veracruz

Main repository for the Veracruz privacy-preserving compute project, an adopted project of the Confidential Compute Consortium (CCC).
https://veracruz-project.com
MIT License
192 stars 39 forks source link

Veracruz does not have a terminate server command that allows a graceful termination of server/enclave #220

Closed alexandref75 closed 2 years ago

alexandref75 commented 3 years ago

Veracruz nitro enclave does not shutdown after the Veracruz-client sends the shutdown command.

To Reproduce

Using the Veracruz-client and running this script:

#!/bin/bash
 ../veracruz-client/veracruz-client dual_policy.json -p linear-regression.wasm  --identity program_client_cert.pem --key program_client_key.pem
 ../veracruz-client/veracruz-client dual_policy.json --data input-0=linear-regression.dat --identity data_client_cert.pem --key data_client_key.pem
 ../veracruz-client/veracruz-client dual_policy.json --results linear-regression.wasm=output --identity data_client_cert.pem --key data_client_key.pem

The following result is obtained:

Loaded policy dual_policy.json c70d42325f5507e683b380e4aa544cbc895ece8a1980551158ea3f81906a036d
Connecting to veracruz_container_nitro_server_ubuntu:3014
Submitting <enclave>/linear-regression.wasm from linear-regression.wasm
Loaded policy dual_policy.json c70d42325f5507e683b380e4aa544cbc895ece8a1980551158ea3f81906a036d
Connecting to veracruz_container_nitro_server_ubuntu:3014
Submitting <enclave>/input-0 from linear-regression.dat
Loaded policy dual_policy.json c70d42325f5507e683b380e4aa544cbc895ece8a1980551158ea3f81906a036d
Connecting to veracruz_container_nitro_server_ubuntu:3014
Reading <enclave>/linear-regression.wasm into output
Shutting down enclave

Expected behaviour Shutdown of the enclave

dreemkiller commented 3 years ago

Is the problem that the Nitro enclave is not being shut down, or that veracruz_server is not being shutdown? If it's the Nitro enclave, can you show me the output of the nitro-cli describe-enclaves command?

alexandref75 commented 3 years ago
root@veracruz-nitro-server:/work/veracruz-server# nitro-cli describe-enclaves
[
  {
    "EnclaveName": "runtime_manager",
    "EnclaveID": "i-025482df71a632b67-enc17c0474f783b9a7",
    "ProcessID": 12,
    "EnclaveCID": 89,
    "NumberOfCPUs": 2,
    "CPUIDs": [
      1,
      3
    ],
    "MemoryMiB": 256,
    "State": "RUNNING",
    "Flags": "NONE",
    "Measurements": {
      "HashAlgorithm": "Sha384 { ... }",
      "PCR0": "89bad60af6e4bd934dc7705b7187b828631092c151b967c0b1638c5567234acd8b123cfdbdf122c7f4f2cf5397292413",
      "PCR1": "c35e620586e91ed40ca5ce360eedf77ba673719135951e293121cb3931220b00f87b5a15e94e25c01fecd08fc9139342",
      "PCR2": "8e9e5d20a8200e1bcd3e9ec1dfc2efe164cf5f639c101588c2bd0fc4bdf71d6ed77561eb00149bdfa88f040e63c2d48c"
    }
  }
]
dreemkiller commented 3 years ago

If the server is terminated, it should terminate the enclave. Have you seen otherwise?

dreemkiller commented 3 years ago

Have confirmed in conversation: terminating the server does terminate the enclave. The problem is the request_shutdown command, which resets the contents of the enclave to a somewhat pristine state, is probably misnamed.

gbryant-arm commented 2 years ago

Fixed in #389