Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recover-tpm tool to debug container and verification image #3867

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

shjala
Copy link
Contributor

@shjala shjala commented Apr 18, 2024

This PR adds the recovertpm tool the debug container. With sufficient knowledge of how EVE intercats with TPM (key indexes, PCR indexes, etc) we can leverage the tool to perform various test on the TPM, re-generate keys, extract the volume key and more.

This tools is used in a new script verifytpm.sh in the verification image to test all the TPM operations that are critical to EVE and make sure all function well, in addition it runs a small stress test on TPM to make sure key generation and derivation operations work fine even after a few dozen repeated operations .

This tool makes intercting with the TPM easier.
specifically, it can be used extract volume keys
from the TPM, but only in an encrypted format suitable
for inserting in a cloud controler.

Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
utilize the tpm-recovery tool to run tests on
TPM hardware and make sure operations that are used
by EVE are all functional and available.

Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
@github-actions github-actions bot requested a review from jsfakian April 18, 2024 10:02
@shjala shjala changed the title Add recover-tpm tool to debug and verification container Add recover-tpm tool to debug container and verification image Apr 18, 2024
# verify the TPM
if [ -c $TPM_DEVICE_PATH ]; then
logmsg "TPM device is present, running some extra tests"
/verifytpm.sh | tee -a "$REPORT/tpmchecks.log" >/dev/console 2>&1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a failure, do we indicate that in the summary.log?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, I'll add it.

docs/DEBUGGING.md Outdated Show resolved Hide resolved
Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits.
Will re-run yetus workflow since it appears to have failed without any output.

return cert.PublicKey, nil
}

func getVualtKeyWireFormat(encryptedVaultKey []byte, digest256 []byte) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func getVualtKeyWireFormat(encryptedVaultKey []byte, digest256 []byte) (string, error) {
func getVaultKeyWireFormat(encryptedVaultKey []byte, digest256 []byte) (string, error) {

Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
@rene
Copy link
Collaborator

rene commented Apr 22, 2024

nice tool @shjala , I think it deserves a dedicated repository under lf-edge or under your GH space (or maybe a pkg/recovertpm), then it can be integrated to debugger container through Dockerfile. In this way it can be more easy to maintain, track changes, without mix with debugger container stuff...

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
It seems to be overkill to have a separate repo for this. Mayve a pkg/recovertpm would suffice @rene ?

@rene
Copy link
Collaborator

rene commented Apr 24, 2024

LGTM It seems to be overkill to have a separate repo for this. Mayve a pkg/recovertpm would suffice @rene ?

I agree @eriknordmark , pkg/recovertpm should be enough to insulate and track changes....

@rouming
Copy link
Contributor

rouming commented May 13, 2024

@shjala do we merge this? All comments are addressed?

@eriknordmark
Copy link
Contributor

@rouming there was a request to move the code to pkg/recovertpm instead of it being burried in pkg/debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants