Skip to content

Add tpm package with Attestation/Validation functionality#40351

Merged
strideynet merged 37 commits intomasterfrom
strideynet/add-tpm-joining-package
Apr 11, 2024
Merged

Add tpm package with Attestation/Validation functionality#40351
strideynet merged 37 commits intomasterfrom
strideynet/add-tpm-joining-package

Conversation

@strideynet
Copy link
Copy Markdown
Contributor

@strideynet strideynet commented Apr 9, 2024

Part of #38558

As per RFD #38613

This is the foundational package for the new TPM joining functionality. It adds the client side element of attestation and the server side which can verify that attestation.

@strideynet strideynet added the no-changelog Indicates that a PR does not require a changelog entry label Apr 9, 2024
@strideynet strideynet self-assigned this Apr 9, 2024
@strideynet strideynet marked this pull request as ready for review April 10, 2024 11:35
@github-actions github-actions Bot requested review from atburke and avatus April 10, 2024 11:36
@strideynet strideynet requested a review from codingllama April 10, 2024 11:53
@codingllama
Copy link
Copy Markdown
Contributor

No backports - I'll backport all of the PRs as one PR when the work is complete.

That is gonna big PR, no? Hard to spot changes and fixes also. Are you sure that's a good idea?

@strideynet
Copy link
Copy Markdown
Contributor Author

That is gonna big PR, no? Hard to spot changes and fixes also. Are you sure that's a good idea?

Perhaps I'm overly worried about releasing "half complete" changes in v15/14 - there's nothing about them that makes me think it would be inherently bad about only some of the changes being released, it might just be odd for CLI commands etc to start showing up but for the backend implementation to not be complete

@codingllama
Copy link
Copy Markdown
Contributor

Set a feature flag, hide all public facing changes until done, make RPCs return unimplemented when appropriate, then profit?

@codingllama
Copy link
Copy Markdown
Contributor

(I do understand your worries about half complete changes though.)

@strideynet
Copy link
Copy Markdown
Contributor Author

Set a feature flag, hide all public facing changes until done, make RPCs return unimplemented when appropriate, then profit?

Seems reasonable. I can do that :)

Comment thread lib/tpm/proto.go
Comment thread lib/tpm/proto_test.go
Comment thread lib/tpm/proto_test.go
Comment thread lib/tpm/tpm.go Outdated
Comment thread lib/tpm/tpm.go Outdated
Comment thread lib/tpm/tpm_simulator_test.go Outdated
Comment thread lib/tpm/tpm_simulator_test.go Outdated
Comment thread lib/tpm/tpm_simulator_test.go Outdated
Comment thread lib/tpm/tpm_simulator_test.go Outdated
Comment thread lib/tpm/tpm_simulator_test.go
strideynet and others added 2 commits April 10, 2024 23:39
Co-authored-by: Alan Parra <alan.parra@goteleport.com>
Co-authored-by: Alan Parra <alan.parra@goteleport.com>
Comment thread lib/tpm/validate.go Outdated
Co-authored-by: Alan Parra <alan.parra@goteleport.com>
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from atburke April 11, 2024 16:09
@strideynet strideynet added this pull request to the merge queue Apr 11, 2024
Merged via the queue into master with commit 521f692 Apr 11, 2024
@strideynet strideynet deleted the strideynet/add-tpm-joining-package branch April 11, 2024 16:28
@public-teleport-github-review-bot
Copy link
Copy Markdown

@strideynet See the table below for backport results.

Branch Result
branch/v14 Failed
branch/v15 Failed

strideynet added a commit that referenced this pull request Apr 11, 2024
* Add structure of `tpm` package

* Add proto conversion methods

* Add tests for proto conversions

* Add startup stuff for tpm sim based tests

* try and fail to write a fake ekcert to the tpm

* Working ability to write to a TPM ekcert index

* Tidy up

* Add finishing touches to test and add godocs

* Go mod tidy

* Appease linter

* Remove incorrectly copied comment

* Tidy up line wrapping

* Add license header

* Update lib/tpm/tpm.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/validate.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Avoid managing closure in the attestWithTPM func

* Use ekCertSerialHex const

* Simpler JoinAuditAttributes method

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Add missing err return

* Add remark on the nvram rsa ekcert index

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Add subtests

* Clarify in hex

* Switch to testing exported iface

* Use x509.CertPool and switch to testing public APi

* Remove overly cautious check

* Validate Validate params

* Reuse strings builder when handling an odd number of hex digits

* Switch to gocmp and struct for ekcert

* Use return struct for Attest

* Avoid marshalling PKIX key twice

* Update lib/tpm/validate.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
strideynet added a commit that referenced this pull request Apr 11, 2024
* Add structure of `tpm` package

* Add proto conversion methods

* Add tests for proto conversions

* Add startup stuff for tpm sim based tests

* try and fail to write a fake ekcert to the tpm

* Working ability to write to a TPM ekcert index

* Tidy up

* Add finishing touches to test and add godocs

* Go mod tidy

* Appease linter

* Remove incorrectly copied comment

* Tidy up line wrapping

* Add license header

* Update lib/tpm/tpm.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/validate.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Avoid managing closure in the attestWithTPM func

* Use ekCertSerialHex const

* Simpler JoinAuditAttributes method

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Add missing err return

* Add remark on the nvram rsa ekcert index

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Add subtests

* Clarify in hex

* Switch to testing exported iface

* Use x509.CertPool and switch to testing public APi

* Remove overly cautious check

* Validate Validate params

* Reuse strings builder when handling an odd number of hex digits

* Switch to gocmp and struct for ekcert

* Use return struct for Attest

* Avoid marshalling PKIX key twice

* Update lib/tpm/validate.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
github-merge-queue Bot pushed a commit that referenced this pull request Apr 11, 2024
…40495)

* Add structure of `tpm` package

* Add proto conversion methods

* Add tests for proto conversions

* Add startup stuff for tpm sim based tests

* try and fail to write a fake ekcert to the tpm

* Working ability to write to a TPM ekcert index

* Tidy up

* Add finishing touches to test and add godocs

* Go mod tidy

* Appease linter

* Remove incorrectly copied comment

* Tidy up line wrapping

* Add license header

* Update lib/tpm/tpm.go



* Update lib/tpm/tpm_simulator_test.go



* Update lib/tpm/validate.go



* Update lib/tpm/tpm.go



* Update lib/tpm/tpm_simulator_test.go



* Update lib/tpm/tpm_simulator_test.go



* Update lib/tpm/tpm_simulator_test.go



* Avoid managing closure in the attestWithTPM func

* Use ekCertSerialHex const

* Simpler JoinAuditAttributes method



* Add missing err return

* Add remark on the nvram rsa ekcert index

* Update lib/tpm/tpm_simulator_test.go



* Add subtests

* Clarify in hex

* Switch to testing exported iface

* Use x509.CertPool and switch to testing public APi

* Remove overly cautious check

* Validate Validate params

* Reuse strings builder when handling an odd number of hex digits

* Switch to gocmp and struct for ekcert

* Use return struct for Attest

* Avoid marshalling PKIX key twice

* Update lib/tpm/validate.go



---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
github-merge-queue Bot pushed a commit that referenced this pull request Apr 11, 2024
…0351) (#40496)

* Add `tpm` package with Attestation/Validation functionality (#40351)

* Add structure of `tpm` package

* Add proto conversion methods

* Add tests for proto conversions

* Add startup stuff for tpm sim based tests

* try and fail to write a fake ekcert to the tpm

* Working ability to write to a TPM ekcert index

* Tidy up

* Add finishing touches to test and add godocs

* Go mod tidy

* Appease linter

* Remove incorrectly copied comment

* Tidy up line wrapping

* Add license header

* Update lib/tpm/tpm.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/validate.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Avoid managing closure in the attestWithTPM func

* Use ekCertSerialHex const

* Simpler JoinAuditAttributes method

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Add missing err return

* Add remark on the nvram rsa ekcert index

* Update lib/tpm/tpm_simulator_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Add subtests

* Clarify in hex

* Switch to testing exported iface

* Use x509.CertPool and switch to testing public APi

* Remove overly cautious check

* Validate Validate params

* Reuse strings builder when handling an odd number of hex digits

* Switch to gocmp and struct for ekcert

* Use return struct for Attest

* Avoid marshalling PKIX key twice

* Update lib/tpm/validate.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Move indirect to correct block

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Indicates that a PR does not require a changelog entry size/lg

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants