-
Notifications
You must be signed in to change notification settings - Fork 71
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
[cmd] Add new command token in the CLI tool #375
Conversation
@jkl73 @kongoshuu Could you take a look? |
LGTM, let's hold the merge until the ek cert is more available on gce instance. |
/gcbrun |
Please hold off merging until the internal privacy policy reviewers give the go-ahead, since this is sending data from a user (should be a nonce, but could be anything) to a Google service. |
2a3ddb5
to
209ba23
Compare
Hi @jkl73, could we resume the merge? The ek cert is now available on gce instance. And the privacy review is passed. |
/gcbrun |
…attestation agent
19961e6
to
d268962
Compare
/gcbrun |
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.
most comments are nits
/gcbrun |
Use: "token", | ||
Short: "Attest and fetch an OIDC token from Google Attestation Verification Service.", | ||
Long: `Gather attestation report and send it to Google Attestation Verification Service for an OIDC token. | ||
The OIDC token includes claims regarding the GCE VM, which is verified by Attestation Verification Service. Note that Confidential Computing API needs to be enabled for your account to access Google Attestation Verification Service https://pantheon.corp.google.com/apis/api/confidentialcomputing.googleapis.com. |
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.
I believe the external-facing URL is console.cloud.google.com :).
So, https://console.cloud.google.com/apis/api/confidentialcomputing.googleapis.com
return err | ||
} | ||
if gceAK.Cert() == nil { | ||
return errors.New("failed to find gceAKCert on this VM: try creating a new VM or verifying the VM has an EK cert using get-shielded-identity gcloud command. The used key algorithm is: " + usedKeyAlgo) |
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.
"failed to find GCE AK Certificate on this..."
// Supports GCE VM. Hard code the AK type. Set GCE AK (EK signing) cert | ||
var gceAK *client.Key | ||
var usedKeyAlgo string | ||
if keyAlgo == tpm2.AlgRSA { | ||
usedKeyAlgo = "RSA" | ||
gceAK, err = client.GceAttestationKeyRSA(rwc) | ||
} | ||
if keyAlgo == tpm2.AlgECC { | ||
usedKeyAlgo = "ECC" | ||
gceAK, err = client.GceAttestationKeyECC(rwc) | ||
} | ||
if err != nil { | ||
return err | ||
} | ||
if gceAK.Cert() == nil { | ||
return errors.New("failed to find gceAKCert on this VM: try creating a new VM or verifying the VM has an EK cert using get-shielded-identity gcloud command. The used key algorithm is: " + usedKeyAlgo) | ||
} | ||
gceAK.Close() |
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.
This has a lot in common with the attest
command. We should refactor out common logic.
"github.com/containerd/containerd/namespaces" | ||
"github.com/golang-jwt/jwt/v4" | ||
"github.com/google/go-tpm-tools/client" | ||
"github.com/google/go-tpm-tools/launcher/agent" |
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.
This PR encodes a dependency on the launcher
submodule. We should separate out the agent
logic if it will be used between the two.
* refactor verifier * move rest_network_test to agent_test * resolve token command comments in #375 * refactor token cmd without depending on launcher agent * decouple launcher agent from cloud logger * extract agent common functions to package util * extract getRestClient function * extract getRegion function * fix fake_oauth2_server * use constants in the fake * move util to internal * replace fakeOauth2Credential with os.CreateTemp * refactor principalFetcher * add PrincipleFetcher unit test
Breaking Changes: [launcher/cmd] Refactor verifier for issue google#419 * Unexport `cmd.Instance`, `cmd.MetadataServer`, `cmd.NewMetadataServer`. * Move package `verifier` from launcher to go-tpm-tools. * `verifier.Client`, `verifier.Challenge`, etc. * Move package `fake` from launcher to go-tpm-tools. * `fake.Claims`, `fake.NewClient`, etc. * Move package `rest` from launcher to go-tpm-tools. * `rest.NewClient`, `rest.BadRegionError`, etc. New Features: [cmd] Add new command token in the CLI tool google#375 [cmd] add records to cloud logging when fetching token from attestation verifier google#417 Bug Fixes: Statically link binaries built by goreleaser google#425 Other Changes: Update readme to include the instruction to use the prebuilt gotpm tool. google#424 New Contributors: @Ruide in google#375 @qinkunbao in google#424
Breaking Changes: [launcher/cmd] Refactor verifier for issue google#419 * Unexport `cmd.Instance`, `cmd.MetadataServer`, `cmd.NewMetadataServer`. * Move package `verifier` from launcher to go-tpm-tools. * `verifier.Client`, `verifier.Challenge`, etc. * Move package `fake` from launcher to go-tpm-tools. * `fake.Claims`, `fake.NewClient`, etc. * Move package `rest` from launcher to go-tpm-tools. * `rest.NewClient`, `rest.BadRegionError`, etc. New Features: [cmd] Add new command token in the CLI tool google#375 [cmd] add records to cloud logging when fetching token from attestation verifier google#417 Bug Fixes: Statically link binaries built by goreleaser google#425 Other Changes: Update readme to gotpm CLi instructions. google#424, google#426 New Contributors: @Ruide in google#375 @qinkunbao in google#424
Command Description: Fetch an attestation report from GCE VM vTPM and send it to Google Attestation Service for an OIDC token.
This command improves usability for a GCE VM user.
This PR replaces closed #368. Branch name changed.