Skip to content

Add attestation workflow - #249

Open
chaskayamane wants to merge 11 commits into
openconfig:mainfrom
chaskayamane:attest
Open

Add attestation workflow#249
chaskayamane wants to merge 11 commits into
openconfig:mainfrom
chaskayamane:attest

Conversation

@chaskayamane

Copy link
Copy Markdown

Demonstrate calling the TpmAttestzService.Attest gRPC service on a switch device.

Demonstrate calling the TpmAttestzService.Attest
gRPC service on a switch device.
Comment thread service/attest/verify.go Outdated
Comment thread service/attest/verify.go Outdated
return errors.New("OIAK certificate does not contain an RSA public key")
}

// 2. Extract public key to verify raw Signature (not a TPMT_SIGNATURE) against the Quote.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the quote signature will usually be a TPMT_SIGNATURE. Can you default to unmarshalling as a tpm2.TPMTSignature, and fall back to using the raw bytes when that fails?

Comment thread service/attest/main.go Outdated
Comment thread service/attest/reference/verify.go
return fmt.Errorf("quote signature verification failed: %v", err)
}

// 3. Verify unencoded, raw binary data for the TPM2 PCR Quote (TPMS_ATTEST).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The default is TPM2B_ATTEST, but you can check for both here.

Comment thread service/attest/main.go Outdated

@betuls betuls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please move these files to a specific folder, such as "reference_verifier", because the logic doesn't support all the verification paths yet and we should avoid confusing the repo readers.


log.Infof("AttestResponse:\n%s", prototext.Format(resp))

if err := VerifyRemoteAttestation(resp, expectedPCRs, pcrIndices, nonce, trustedRoots, nil, hashAlgo); err != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hashAlgo is the TPM PCR hash agorithm, but here you use it as the quote signature hash algorithm.

return fmt.Errorf("unsupported hash algorithm %v: must be SHA256 or SHA384", hashAlgo)
}
// 1. Parse and cryptographically verify the OIAK against the Root/Intermediate CA chain.
block, _ := pem.Decode([]byte(resp.GetAttestationCert().GetOiakCert()))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You might need to loop over this to account for multi-block pem certs

## Building and Running with Bazel

```bash
bazel run //service/attest:attest -- \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs updating with the new path

| -------------------- | ------ | ------------------------- | --------------------------------------------------------------------------------- |
| `-addr` | string | `localhost:50051` | Address (`host:port`) of the `TpmAttestzService` gRPC server. |
| `-control_card_role` | string | `CONTROL_CARD_ROLE_ACTIVE` | Control card role to attest (`"CONTROL_CARD_ROLE_ACTIVE"`, `"CONTROL_CARD_ROLE_STANDBY"`, etc.). |
| `-insecure` | bool | `false` | Use insecure transport credentials (disable TLS). Set to `false` for TLS. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should clean up the documentation to reflect the current options.

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.

3 participants