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

Update az snp / tdx vtpm dependency to 0.5 #293

Merged
merged 4 commits into from
Feb 7, 2024

Conversation

surajssd
Copy link
Member

No description provided.

@fitzthum
Copy link
Member

I think you'll want to do cargo update az-snp-vtpm and commit the Cargo.lock

@surajssd
Copy link
Member Author

I think I will wait until confidential-containers/guest-components#436 is merged.

@fitzthum
Copy link
Member

The stable check seems to have a legit failure. Maybe there were changes to the crate?

@surajssd
Copy link
Member Author

The stable check seems to have a legit failure. Maybe there were changes to the crate?

Yes that's right. I am on it.

@surajssd
Copy link
Member Author

cc: @mkulke for review of the updated tests.

@surajssd
Copy link
Member Author

Can someone authorize the test runs?

Copy link
Contributor

@mkulke mkulke left a comment

Choose a reason for hiding this comment

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

the az-tdx-vtpm verifier has been merged since, should we adjust it in the same PR?

regarding the switch to v0.5: this changed the body of the evidence. we might want to consider versioning the evidence that we produce on the attester side. if someone sends evidence with older guest-components to this verifier it'll fail to serialize, with a potentially confusing error. :/

if we'd send { version: "v1" , ... } from guest-components, we could verify this here with a readable error msg: "Evidence version < v1" or something

Alternatively we can change the Evidence type here to have pcrs: Option<...> and fail with a similar error if it's None. but I find the first option preferable

attestation-service/verifier/src/az_snp_vtpm/mod.rs Outdated Show resolved Hide resolved
@surajssd
Copy link
Member Author

the az-tdx-vtpm verifier has been merged since, should we adjust it in the same PR?

What does this entail?

regarding the switch to v0.5: this changed the body of the evidence. we might want to consider versioning the evidence that we produce on the attester side. if someone sends evidence with older guest-components to this verifier it'll fail to serialize, with a potentially confusing error. :/

if we'd send { version: "v1" , ... } from guest-components, we could verify this here with a readable error msg: "Evidence version < v1" or something

How do I do this? As in add the version where?

@mkulke
Copy link
Contributor

mkulke commented Jan 26, 2024

the az-tdx-vtpm verifier has been merged since, should we adjust it in the same PR?

What does this entail?

bumping the az-tdx crate too, and a similar replacement of the evidence fixtures I guess. should be pretty much 1:1 to the az-snp changes

@mkulke
Copy link
Contributor

mkulke commented Jan 26, 2024

regarding the switch to v0.5: this changed the body of the evidence. we might want to consider versioning the evidence that we produce on the attester side. if someone sends evidence with older guest-components to this verifier it'll fail to serialize, with a potentially confusing error. :/
if we'd send { version: "v1" , ... } from guest-components, we could verify this here with a readable error msg: "Evidence version < v1" or something

How do I do this? As in add the version where?

The version would have to be added to the evidence type in guest-components and similarly in the verifier module here:

https://github.com/confidential-containers/kbs/blob/3003ced913bf83fa11d3ef753bb621f9cd030ae8/attestation-service/verifier/src/az_snp_vtpm/mod.rs#L25-L30

At the moment the evidence is serialized as json and maybe serde will happily ignore an additional property quote.pcrs when deserializing, so nothing breaks immediately.

but we would have to introduce such a field once we actually use the pcrs field, so I'd rather do it here. I would suggest this PR back to draft, until a corresponding change in guest-components has been merged.

@surajssd
Copy link
Member Author

Once confidential-containers/guest-components#460 merged, I will udpate this PR to use 0.5.1 for az-cvm-vtpm crates and also update the guest components.

@Xynnn007
Copy link
Member

@surajssd confidential-containers/guest-components#460 is merged

@surajssd surajssd requested a review from mkulke January 29, 2024 23:23
@surajssd surajssd changed the title Update az snp vtpm dependency to 0.5 Update az snp / tdx vtpm dependency to 0.5 Jan 30, 2024
mkulke
mkulke previously approved these changes Jan 30, 2024
Copy link
Contributor

@mkulke mkulke left a comment

Choose a reason for hiding this comment

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

small nits, otherwise lgtm

attestation-service/verifier/Cargo.toml Outdated Show resolved Hide resolved
attestation-service/verifier/src/az_snp_vtpm/mod.rs Outdated Show resolved Hide resolved
kbs/tools/client/Cargo.toml Outdated Show resolved Hide resolved
@mkulke mkulke added test_e2e Authorize TEE e2e test run and removed test_e2e Authorize TEE e2e test run labels Jan 30, 2024
@mkulke mkulke added test_e2e Authorize TEE e2e test run and removed test_e2e Authorize TEE e2e test run labels Jan 31, 2024
@mkulke
Copy link
Contributor

mkulke commented Jan 31, 2024

There is a dependency to guest-components in ./kbs/tools/client/Cargo.toml we might want the rev in this PR too to reflect the changes on the attester side.

Replace `verion` with `version`.

Signed-off-by: Suraj Deshmukh <[email protected]>
- Update sub-crates az-snp-vtpm and az-tdx-vtpm to 0.5.1.
- KBS-tools: Update guest-componenets revision.

Signed-off-by: Suraj Deshmukh <[email protected]>
This commit updates the test fixtures, way to load quote and way to mess
with quote for negative tests.

Signed-off-by: Suraj Deshmukh <[email protected]>
Copy link
Contributor

@mkulke mkulke left a comment

Choose a reason for hiding this comment

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

There is a quote.verify_pcrs() check missing in each verifier.

Also, I don't think there is a pub fn to retrieve the PCRs from the quote yet. We can address this is a later PR when we actually consume the PCRs, as this probably needs a new minor release in the az-*-vtpm crates.

@mkulke mkulke dismissed their stale review January 31, 2024 22:29

missing pcr verification

@surajssd
Copy link
Member Author

@mkulke
Copy link
Contributor

mkulke commented Feb 1, 2024

Why don't we use the generic verify function from the library?

Ah, good question. There is a pending refactoring that will move the verification of report_data/nonce to from the verifiers to an upper level, so we cannot use the unified verify() method anymore, the nonce is just added as report_data to the claims and then verified somewhere else in some non-tee specific place, iiuic.

Rather than reimplementing them here:

it's not re-implementing. we're actually calling the library verification, we just have to extract the pubkey prior to sig verification.

image

Finally, in the doc-comments on both verifier fns the individual verification steps are enumerated. it would be good to add that we perform a PCR digest check here.

@surajssd
Copy link
Member Author

surajssd commented Feb 1, 2024

There is a quote.verify_pcrs() check missing in each verifier.

@mkulke done.

The new update of the library now allows the user to verify if the
digest of PCRs matches the digest in Quote.

Signed-off-by: Suraj Deshmukh <[email protected]>
Copy link
Contributor

@mkulke mkulke left a comment

Choose a reason for hiding this comment

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

lgtm

@surajssd
Copy link
Member Author

surajssd commented Feb 7, 2024

@fitzthum if the code looks good to you can we merge this?

@fitzthum fitzthum merged commit b7eb573 into confidential-containers:main Feb 7, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test_e2e Authorize TEE e2e test run
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants