-
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
[launcher] Support TDX RTMR based attestation in launcher #478
Conversation
c75591b
to
b9c1240
Compare
/gcbrun |
/gcbrun |
/gcbrun |
a3066ba
to
cf3b63c
Compare
/gcbrun |
9df421f
to
7244331
Compare
/gcbrun |
6307fc9
to
952db42
Compare
/gcbrun |
/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.
The verifier build is failing
// If an error is encountered in the process, return what has been constructed so far. | ||
func (k *Key) getCertificateChain(client *http.Client) ([][]byte, error) { |
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.
don't export this. put this in internal somewhere and take a key.
func getCertificateChain(cert *x509.Certificate, client *http.Client) ([][]byte, error)
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.
moved to internal/cert.go
@@ -7,7 +7,7 @@ require ( | |||
github.com/google/go-attestation v0.5.1 | |||
github.com/google/go-cmp v0.6.0 | |||
github.com/google/go-configfs-tsm v0.3.3-0.20240910040719-1cc7e25d9272 | |||
github.com/google/go-sev-guest v0.11.1 | |||
github.com/google/go-sev-guest v0.11.2-0.20241009005433-de2ac900e958 |
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.
why are we updating this?
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.
@@ -1,7 +1,7 @@ | |||
substitutions: | |||
'_BASE_IMAGE': '' # an empty base image means the build will use the latest image in '_BASE_IMAGE_FAMILY' | |||
'_BASE_IMAGE_FAMILY': 'cos-113-lts' # base image family | |||
'_OUTPUT_IMAGE_PREFIX': 'confidential-space' | |||
'_BASE_IMAGE_FAMILY': 'cos-tdx-113-lts' # base image family |
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.
nit: so I'm assuming cos-tdx-113-lts
family will also work for SEV-based CS image?
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.
yes, it's SEV_CAPABLE as well
/gcbrun |
type tpmAttestRoot struct { | ||
tpmMu sync.Mutex | ||
fetchedAK *client.Key | ||
tpm io.ReadWriteCloser | ||
} | ||
|
||
func (t *tpmAttestRoot) Extend(c cel.Content, l *cel.CEL) error { | ||
return l.AppendEventPCR(t.tpm, cel.CosEventPCR, defaultCELHashAlgo, c) | ||
} | ||
|
||
func (t *tpmAttestRoot) Attest(nonce []byte) (any, error) { | ||
t.tpmMu.Lock() | ||
defer t.tpmMu.Unlock() | ||
|
||
return t.fetchedAK.Attest(client.AttestOpts{ | ||
Nonce: nonce, | ||
CertChainFetcher: http.DefaultClient, | ||
}) | ||
} | ||
|
||
type tdxAttestRoot struct { | ||
tdxMu sync.Mutex | ||
qp *tg.LinuxConfigFsQuoteProvider | ||
tsmClient configfsi.Client | ||
} | ||
|
||
func (t *tdxAttestRoot) Extend(c cel.Content, l *cel.CEL) error { | ||
return l.AppendEventRTMR(t.tsmClient, cel.CosRTMR, c) | ||
} | ||
|
||
func (t *tdxAttestRoot) Attest(nonce []byte) (any, error) { | ||
t.tdxMu.Lock() | ||
defer t.tdxMu.Unlock() | ||
|
||
var tdxNonce [tlabi.TdReportDataSize]byte | ||
copy(tdxNonce[:], nonce) | ||
|
||
rawQuote, err := tg.GetRawQuote(t.qp, tdxNonce) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
ccelData, err := os.ReadFile("/sys/firmware/acpi/tables/data/CCEL") | ||
if err != nil { | ||
return nil, err | ||
} | ||
ccelTable, err := os.ReadFile("/sys/firmware/acpi/tables/CCEL") | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &verifier.TDCCELAttestation{ | ||
CcelAcpiTable: ccelTable, | ||
CcelData: ccelData, | ||
TdQuote: rawQuote, | ||
}, nil |
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.
Should these live in attest.go instead of here?
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.
No. Really most of this should belong in go-tdx-guest, but it's okay to be here for now.
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.architecture == 'x64' | ||
- name: Test all modules | ||
run: go test -v ./... ./cmd/... ./launcher/... ./verifier/... -skip='TestCacheConcurrentSetGet|TestHwAttestationPass|TestHardwareAttestationPass' |
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.
Why do we need this change?
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.
launcher now depends on LinuxConfigFsQuoteProvider
(which is in tdxAttestRoot
). Which can be only complied on Linux. So trying to compile launcher on mac will fail
type tpmAttestRoot struct { | ||
tpmMu sync.Mutex | ||
fetchedAK *client.Key | ||
tpm io.ReadWriteCloser | ||
} | ||
|
||
func (t *tpmAttestRoot) Extend(c cel.Content, l *cel.CEL) error { | ||
return l.AppendEventPCR(t.tpm, cel.CosEventPCR, defaultCELHashAlgo, c) | ||
} | ||
|
||
func (t *tpmAttestRoot) Attest(nonce []byte) (any, error) { | ||
t.tpmMu.Lock() | ||
defer t.tpmMu.Unlock() | ||
|
||
return t.fetchedAK.Attest(client.AttestOpts{ | ||
Nonce: nonce, | ||
CertChainFetcher: http.DefaultClient, | ||
}) | ||
} | ||
|
||
type tdxAttestRoot struct { | ||
tdxMu sync.Mutex | ||
qp *tg.LinuxConfigFsQuoteProvider | ||
tsmClient configfsi.Client | ||
} | ||
|
||
func (t *tdxAttestRoot) Extend(c cel.Content, l *cel.CEL) error { | ||
return l.AppendEventRTMR(t.tsmClient, cel.CosRTMR, c) | ||
} | ||
|
||
func (t *tdxAttestRoot) Attest(nonce []byte) (any, error) { | ||
t.tdxMu.Lock() | ||
defer t.tdxMu.Unlock() | ||
|
||
var tdxNonce [tlabi.TdReportDataSize]byte | ||
copy(tdxNonce[:], nonce) | ||
|
||
rawQuote, err := tg.GetRawQuote(t.qp, tdxNonce) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
ccelData, err := os.ReadFile("/sys/firmware/acpi/tables/data/CCEL") | ||
if err != nil { | ||
return nil, err | ||
} | ||
ccelTable, err := os.ReadFile("/sys/firmware/acpi/tables/CCEL") | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &verifier.TDCCELAttestation{ | ||
CcelAcpiTable: ccelTable, | ||
CcelData: ccelData, | ||
TdQuote: rawQuote, | ||
}, nil |
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.
No. Really most of this should belong in go-tdx-guest, but it's okay to be here for now.
ccelData, err := os.ReadFile("/sys/firmware/acpi/tables/data/CCEL") | ||
if err != nil { | ||
return nil, err | ||
} | ||
ccelTable, err := os.ReadFile("/sys/firmware/acpi/tables/CCEL") |
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 am surprised there's no utilities for this in go-tdx-guest. There should be.
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.
noted google/go-tdx-guest#53
@@ -21,7 +21,7 @@ steps: | |||
if [ -z ${base_image} ] | |||
then | |||
echo "getting the latest COS image" | |||
base_image=$(gcloud compute images describe-from-family ${BASE_IMAGE_FAMILY} --project cos-cloud | grep name | cut -d ' ' -f 2) | |||
base_image=$(gcloud compute images describe-from-family ${BASE_IMAGE_FAMILY} --project confidential-vm-images | grep name | cut -d ' ' -f 2) |
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.
Why are we changing the project?
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.
COS TDX_capable images are not released in regular cos-cloud project
Allow a TDX machine to create a TD quote and request a hardware rooted attestation from the attestation verifier. ./launcher ci will now only run in linux. Upgrade go-sev-guest. Signed-off-by: Jiankun Lu <jiankun@google.com>
/gcbrun |
Allow a TDX machine to create a TD quote and request a hardware rooted attestation from the attestation verifier.
./launcher ci will now only run in linux. (because launcher now depends on *tg.LinuxConfigFsQuoteProvider which only presents in linux)