edgebitio / enclaver

Open source toolkit created to enable easy adoption of software enclaves
https://edgebit.io/enclaver
Apache License 2.0
137 stars 12 forks source link

Capture and log the nitro-cli log files on error #171

Closed crawford closed 1 year ago

crawford commented 1 year ago

When nitro-cli encounters an error, it saves additional logs to the disk. Because this happens in a container, those files are lost as soon as the supervisor exits. Instead, try to parse those log paths from the output of nitro-cli and log the contents.

Here's an example of that output: ``` INFO enclaver::run > no egress defined, no egress proxy will be started INFO enclaver::run > starting enclave ERROR enclaver::nitro_cli > nitro-cli failed (exit status: 39) ERROR enclaver::nitro_cli > stderr: [ E26 ] Insufficient memory requested. User provided `memory` is 154 MB, but based on the EIF file size, the minimum memory should be 1540 MB For more details, please visit https://docs.aws.amazon.com/enclaves/latest/user/cli-errors.html#E26 If you open a support ticket, please provide the error log found at "/var/log/nitro_enclaves/err2023-10-27T00:11:04.029215503+00:00.log" Failed connections: 1 [ E39 ] Enclave process connection failure. Such error appears when the enclave manager fails to connect to at least one enclave process for retrieving the description information. For more details, please visit https://docs.aws.amazon.com/enclaves/latest/user/cli-errors.html#E39 If you open a support ticket, please provide the error log found at "/var/log/nitro_enclaves/err2023-10-27T00:11:04.029367091+00:00.log" ERROR enclaver::nitro_cli > /var/log/nitro_enclaves/err2023-10-27T00:11:04.029215503+00:00.log: Action: Run Enclave Subactions: Failed to execute command `Run` Failed to trigger enclave run Failed to construct EnclaveManager with given arguments Failed to create enclave handle At least 1540 MB must be allocated (which is 4 times the EIF file size) Root error file: src/enclave_proc/resource_manager.rs Root error line: 506 Build commit: not available ERROR enclaver::nitro_cli > /var/log/nitro_enclaves/err2023-10-27T00:11:04.029367091+00:00.log: Action: Run Enclave Subactions: Failed to handle all enclave process replies Failed to connect to 1 enclave processes Root error file: src/enclave_proc_comm.rs Root error line: 349 Build commit: not available Error: failed to run enclave ERROR enclaver > error running enclave: non-zero exit code from container ```