COCOS-391- GCP Attestation policy#405
Merged
Merged
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #405 +/- ##
==========================================
- Coverage 56.77% 54.94% -1.84%
==========================================
Files 59 60 +1
Lines 5099 5262 +163
==========================================
- Hits 2895 2891 -4
- Misses 1903 2070 +167
Partials 301 301 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| func GenerateAttestationPolicy(endorsement *endorsement.VMGoldenMeasurement) (*config.Config, error) { | ||
| attestationPolicy := config.Config{PcrConfig: &config.PcrConfig{}, SnpCheck: &check.Config{RootOfTrust: &check.RootOfTrust{}, Policy: &check.Policy{}}} | ||
| attestationPolicy.SnpCheck.Policy.Policy = endorsement.SevSnp.Policy | ||
| attestationPolicy.SnpCheck.Policy.Measurement = endorsement.SevSnp.Measurements[2] |
Contributor
There was a problem hiding this comment.
Can we make this configurable? We can the CVM is launched with more than 2 vCPUs. Also, it will be good to set fields family_id and image_id here.
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
dborovcanin
approved these changes
Mar 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
This is a feature that adds generation of gcp attestation policy
What does this do?
New Features
Chores
Which issue(s) does this PR fix/relate to?
Have you included tests for your changes?
Did you document any new/modified feature?
Notes
sequenceDiagram participant User as User participant CLI as CLI Command (NewGCPAttestationPolicy) participant FS as File System participant GCP as GCP Package User->>CLI: Execute GCP Attestation Policy Command with report file path CLI->>FS: Read attestation report file FS-->>CLI: Return binary attestation data CLI->>GCP: Extract384BitMeasurement(data) GCP-->>CLI: 384-bit measurement CLI->>GCP: GetLaunchEndorsement(measurement) GCP-->>CLI: Launch endorsement data CLI->>GCP: GenerateAttestationPolicy(endorsement) GCP-->>CLI: Attestation policy data CLI->>FS: Write attestation_policy.json CLI-->>User: Output success resultsequenceDiagram participant User as User participant CLI as CLI Command (NewDownloadGCPOvmfFile) participant FS as File System participant GCP as GCP Package User->>CLI: Execute Download GCPOVMF command with report file path CLI->>FS: Read attestation report file FS-->>CLI: Return binary attestation data CLI->>GCP: Extract384BitMeasurement(data) GCP-->>CLI: 384-bit measurement CLI->>GCP: GetLaunchEndorsement(measurement) GCP-->>CLI: Launch endorsement data CLI->>GCP: DownloadOvmfFile(endorsement.digest) GCP-->>CLI: OVMF file bytes CLI->>FS: Write ovmf.fd CLI-->>User: Signal download successsequenceDiagram participant Main as Main Function (cmd/agent/main.go) participant Server as Agent Server (agent/cvms/server/cvm.go) participant gRPC as gRPC Server Main->>Server: Call NewServer(logger, service, host) Server-->>Main: Return AgentServer instance Main->>Server: Call Start() Server->>gRPC: Initialize gRPC server using host from field gRPC-->>Server: gRPC server starts