-
Notifications
You must be signed in to change notification settings - Fork 53
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
attestation: use go-sev-guest
library
#2269
Conversation
✅ Deploy Preview for constellation-docs canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we can drop all of our own SNP report validation (including VCEK verification) except for MAA and maybe IDKey.
Regarding TCB version checks, @derpsteb and @katexochen should know best if the TCB version checks of the library are good to replace ours.
Regarding IDKey, the implementation may be simpler if we never use the library for it and just keep our current check. What do you think @msanft ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we can drop all of our own SNP report validation (including VCEK verification) except for MAA and maybe IDKey.
Yes, I think this is the main point of adopting the library now.
Regarding IDKey, the implementation may be simpler if we never use the library for it and just keep our current check.
I think so too. Double-checking with the library has no obvious advantages to me while making the code harder to read.
I didn't check the code yet as the pipeline is still failing and this is still a draft. Regarding the TCB checks. re 2.: fine to remove. This is unnecessarily restrictive. Can't remember why it's there. re 3.: we should set re 4.: we need to keep this. Regarding the checks that we gain: seems like a good addition to me. I always read the AMD docs in a way that suggests that the PSP firmware enforces these conditions and that a attestation verifier wouldn't have to check them. But this isn't stated anywhere. Better to have them. 👍 |
Re 5.: I agree that this should be replaced with "CurrentTCB >= TCB specified in VCEK". The current check is overly restrictive. |
latest update: Both unit test
of which I don't know why they report it yet. If anyone has ideas to debug this, please let me know. This passage in the library produces the error: |
To me it seems that the report and the vcek just don't match. Please try using the vcek and chain that the issuer is getting from Azure THIM instead of downloading it from AMD. |
needs google/go-sev-guest#73 |
One other bug I need to track down: A test with an actual cluster returns:
If I print the report that is being verified in the above trace it works when checking it "manually" in my test environment with the following snippet: report, err := abi.ReportToProto(testdata.AttestationReport)
if err != nil {
panic(err)
}
fmt.Println("Report HWID:", hex.EncodeToString(report.GetChipId()))
fmt.Println("TCB level:", kds.DecomposeTCBVersion(kds.TCBVersion(report.GetCurrentTcb())))
attestation, err := verify.GetAttestationFromReport(report, &verify.Options{})
if err != nil {
panic(err)
}
err = verify.SnpAttestation(attestation, &verify.Options{})
if err != nil {
panic(err)
} I assume that either somewhere in the build process, the pseudo-version of |
^ Possibly caused by an indirect dependency on v0.6.1 of |
Correcting this fixed it. |
feb3a83
to
e40fc65
Compare
Coverage report
|
We also probably want to use the AMD root certificate from the config instead of the one embedded in the |
8018765
to
f482515
Compare
Co-authored-by: Thomas Tendyck <[email protected]>
Co-authored-by: Thomas Tendyck <[email protected]>
Signed-off-by: Moritz Sanft <[email protected]>
Co-authored-by: Paul Meyer <[email protected]>
Co-authored-by: Paul Meyer <[email protected]>
Co-authored-by: Paul Meyer <[email protected]>
Signed-off-by: Moritz Sanft <[email protected]>
Signed-off-by: Moritz Sanft <[email protected]>
Signed-off-by: Moritz Sanft <[email protected]>
Signed-off-by: Moritz Sanft <[email protected]>
Signed-off-by: Moritz Sanft <[email protected]>
Signed-off-by: Moritz Sanft <[email protected]>
68db255
to
474367c
Compare
Signed-off-by: Moritz Sanft <[email protected]>
0c8ed62
to
85515c2
Compare
Signed-off-by: Moritz Sanft <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I didn't do another deep dive as I am unde the impression Thomas and Paul already did that. I think it's great that you extended the unittests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -77,10 +77,10 @@ require ( | |||
github.com/go-playground/universal-translator v0.18.1 | |||
github.com/go-playground/validator/v10 v10.14.1 | |||
github.com/golang-jwt/jwt/v5 v5.0.0 | |||
github.com/google/go-sev-guest v0.6.1 | |||
github.com/google/go-sev-guest v0.8.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github.com/google/go-sev-guest v0.8.0 | |
github.com/google/go-sev-guest v0.9.0 |
v0.9.0 was released 2 days ago
One last E2E run, merging afterwards if successful |
* wip: switch to attestation * add extra comments Signed-off-by: Moritz Sanft <[email protected]> * MAA checks Signed-off-by: Moritz Sanft <[email protected]> * use provided functions to parse report / cert chain Signed-off-by: Moritz Sanft <[email protected]> * replace `CommitedTCB` check with `LaunchTCB` check Signed-off-by: Moritz Sanft <[email protected]> * remove debug check Signed-off-by: Moritz Sanft <[email protected]> * remove `LaunchTCB` == `CommitedTCB` check Signed-off-by: Moritz Sanft <[email protected]> * custom IdKeyDigests check Signed-off-by: Moritz Sanft <[email protected]> * basic test of report parsing from instance info Signed-off-by: Moritz Sanft <[email protected]> * retrieve VCEK from AMD KDS Signed-off-by: Moritz Sanft <[email protected]> * remove VCEK from `azureInstanceInfo` Signed-off-by: Moritz Sanft <[email protected]> * use `go-sev-guest` TCB version type Signed-off-by: Moritz Sanft <[email protected]> * fix validation parsing test Signed-off-by: Moritz Sanft <[email protected]> * fix error message * fix comment Signed-off-by: Moritz Sanft <[email protected]> * remove certificate chain from `instanceInfo` Signed-off-by: Moritz Sanft <[email protected]> * add test for idkeydigest check Signed-off-by: Moritz Sanft <[email protected]> * update buildfiles Signed-off-by: Moritz Sanft <[email protected]> * wip: update tests Signed-off-by: Moritz Sanft <[email protected]> * update buildfiles Signed-off-by: Moritz Sanft <[email protected]> * [remove] debug prints Signed-off-by: Moritz Sanft <[email protected]> * wip: fix tests Signed-off-by: Moritz Sanft <[email protected]> * wip: fix tests Signed-off-by: Moritz Sanft <[email protected]> * fix tests, do some clean-up Signed-off-by: Moritz Sanft <[email protected]> * add test case for fetching error Signed-off-by: Moritz Sanft <[email protected]> * Update internal/attestation/azure/snp/validator.go Co-authored-by: Daniel Weiße <[email protected]> * correct `hack` dependency Signed-off-by: Moritz Sanft <[email protected]> * fix id key check Signed-off-by: Moritz Sanft <[email protected]> * [remove] comment out wip unit tests Signed-off-by: Moritz Sanft <[email protected]> * add missing newline Signed-off-by: Moritz Sanft <[email protected]> * switch to released version of `go-sev-guest` Signed-off-by: Moritz Sanft <[email protected]> * add constructor test Signed-off-by: Moritz Sanft <[email protected]> * add VMPL check Signed-off-by: Moritz Sanft <[email protected]> * add test assertions Signed-off-by: Moritz Sanft <[email protected]> * update buildfiles Signed-off-by: Moritz Sanft <[email protected]> * switch to pseudoversion Signed-off-by: Moritz Sanft <[email protected]> * use fork with windows fix Signed-off-by: Moritz Sanft <[email protected]> * fix linter checks Signed-off-by: Moritz Sanft <[email protected]> * use data from THIM Signed-off-by: Moritz Sanft <[email protected]> * update embeds Signed-off-by: Moritz Sanft <[email protected]> * verify against ARK in config Signed-off-by: Moritz Sanft <[email protected]> * invalid ASK Signed-off-by: Moritz Sanft <[email protected]> * Update internal/attestation/azure/snp/validator.go Co-authored-by: Thomas Tendyck <[email protected]> * Update internal/attestation/azure/snp/validator.go Co-authored-by: Thomas Tendyck <[email protected]> * Update internal/attestation/azure/snp/validator.go Co-authored-by: 3u13r <[email protected]> * Update internal/attestation/azure/snp/validator.go Co-authored-by: 3u13r <[email protected]> * nits Signed-off-by: Moritz Sanft <[email protected]> * remove unnecessary checks Signed-off-by: Moritz Sanft <[email protected]> * refactoring Signed-off-by: Moritz Sanft <[email protected]> * Update internal/attestation/azure/snp/validator.go Co-authored-by: Thomas Tendyck <[email protected]> * Update internal/attestation/azure/snp/validator.go Co-authored-by: Thomas Tendyck <[email protected]> * Update internal/attestation/azure/snp/validator.go Co-authored-by: Thomas Tendyck <[email protected]> * use upstream library with pseudoversion Signed-off-by: Moritz Sanft <[email protected]> * Update internal/attestation/azure/snp/validator.go Co-authored-by: Paul Meyer <[email protected]> * Update internal/attestation/azure/snp/validator.go Co-authored-by: Paul Meyer <[email protected]> * Update internal/attestation/azure/snp/validator.go Co-authored-by: Paul Meyer <[email protected]> * simplify control flow Signed-off-by: Moritz Sanft <[email protected]> * fix return error Signed-off-by: Moritz Sanft <[email protected]> * fix VCEK test Signed-off-by: Moritz Sanft <[email protected]> * tidy Signed-off-by: Moritz Sanft <[email protected]> * revert unintentional changes Signed-off-by: Moritz Sanft <[email protected]> * use new upstream release Signed-off-by: Moritz Sanft <[email protected]> * fix removed AuthorKeyEn field Signed-off-by: Moritz Sanft <[email protected]> * fix verification report printing Signed-off-by: Moritz Sanft <[email protected]> --------- Signed-off-by: Moritz Sanft <[email protected]> Co-authored-by: Daniel Weiße <[email protected]> Co-authored-by: Thomas Tendyck <[email protected]> Co-authored-by: 3u13r <[email protected]> Co-authored-by: Paul Meyer <[email protected]>
Context
We want to use the
go-sev-guest
library to have an easily maintainable interface to the verification / validation of SEV-SNP attestation reports. (For now on Azure only due to deviations in the attestation processes of the CSPs)Proposed change(s)
go-sev-guest
policy. However, there are checks which a) we currently perform but do not seem to be expressable in ago-sev-guest
policy or b) are automatically performed bygo-sev-guest
but not currently done by us. Below lists all occurances of those cases. -> See the sections below for how our previous checks are covered by which checks fromgo-sev-guest
Checks we currently do but can't be expressed in
go-sev-guest
constellation/internal/attestation/azure/snp/validator.go
Lines 151 to 153 in 590931f
constellation/internal/attestation/azure/snp/validator.go
Lines 154 to 156 in 590931f
constellation/internal/attestation/azure/snp/validator.go
Lines 157 to 159 in 590931f
constellation/internal/attestation/azure/snp/validator.go
Lines 190 to 216 in 590931f
Might be achievable by ignoring the go-sev-guest IdKey hash check if EnforcementPolicy is MaaFallback or WarnOnly and performing a custom check after. (See current idea of an implementation in the PR)
constellation/internal/attestation/azure/snp/validator.go
Lines 221 to 222 in 5272e7c
This might be replaced by the CurrentTCB >= TCB specified in VCEK check mentioned below.
Checks we didn't do before but are automatically done by
go-sev-guest
(May be easy for us by just giving in the Minimum TCB specified in our Config)
Checklist