Skip to content
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

hardware key runners #1977

Merged
merged 28 commits into from
Dec 19, 2024

Conversation

James-Pickett
Copy link
Contributor

@James-Pickett James-Pickett commented Dec 4, 2024

  • adds secure enclave create key command to desktop user server, client, and root desktop runner
  • adds a "runner" style struct to handle initializing keys for both tpm and secure enclave that is added to the rungroup in main launcher command, this allows for initializing (and retrying failures) of tpm and secure enclave keys
  • signing with secure enclave will come in a follow on PR

@James-Pickett James-Pickett changed the title rough draft hardware key runners Dec 4, 2024
@James-Pickett James-Pickett marked this pull request as ready for review December 5, 2024 23:32
Copy link
Contributor

@RebeccaMahany RebeccaMahany left a comment

Choose a reason for hiding this comment

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

I really like how all of this fits together with the runners!

ee/desktop/user/client/client.go Outdated Show resolved Hide resolved
ee/secureenclaverunner/secureenclaverunner.go Show resolved Hide resolved
ee/secureenclaverunner/secureenclaverunner.go Outdated Show resolved Hide resolved
ee/secureenclaverunner/secureenclaverunner.go Show resolved Hide resolved
ee/secureenclaverunner/secureenclaverunner.go Show resolved Hide resolved
ee/tpmrunner/tpmrunner_test.go Show resolved Hide resolved
@@ -0,0 +1,241 @@
package tpmrunner
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you add a quick diagram/writeup in the docs/architecture folder for this? Since this work traverses both root and user launcher, and the implementation differs between darwin/other OSes (plus the keys are pretty important) I think it's worth documenting how the different pieces fit together. Doesn't have to be in this PR!

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little curious about this as well. I understand why we need to move the secure enclave signing. But I'm much less sure what's happening with the TPM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@RebeccaMahany , I will write up some docs for this PR

@directionless there are 2 reasons I went ahead and made the tpm a "runner" style like secure enclave.

  1. We do see errors pop up with TPM operations that I can't reproduce. I'm hoping that these have something to do with the TPM not being ready or unavailable for some reason, taking this route we'll keep trying in the background hoping it becomes available.

  2. It felt cleaner to have both hardware signature mechanisms operate in the same way. Understanding that no kind of hardware signing can be expected to be available immediately after start up.

ee/tpmrunner/tpmrunner.go Outdated Show resolved Hide resolved
ee/tpmrunner/tpmrunner.go Outdated Show resolved Hide resolved
ee/secureenclaverunner/secureenclaverunner.go Outdated Show resolved Hide resolved
ee/agent/keys_darwin.go Outdated Show resolved Hide resolved
}

k, err := tpm.New(priData, pubData)
// SetHardwareKeysRunner creates a tpm runner and sets it as the agent hardware key as it also implements the keyInt/cyrpto.Signer interface.
Copy link
Contributor

Choose a reason for hiding this comment

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

Naming question... If this returns a runner, why is it called Set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The runner also implements keyInt & crypto.Signer and gets set as the hardware key, maybe CreateSetHardwareKeysRunner? Or possible different functions for create and set?

ee/secureenclaverunner/secureenclaverunner.go Show resolved Hide resolved
ee/secureenclaverunner/secureenclaverunner.go Show resolved Hide resolved
@@ -0,0 +1,241 @@
package tpmrunner
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little curious about this as well. I understand why we need to move the secure enclave signing. But I'm much less sure what's happening with the TPM

ee/tpmrunner/tpmrunner.go Outdated Show resolved Hide resolved
Copy link
Contributor

@RebeccaMahany RebeccaMahany left a comment

Choose a reason for hiding this comment

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

Just a couple small nitpicks, LGTM! Sorry for the delay on re-review this time around

ee/desktop/user/client/client.go Show resolved Hide resolved
ee/desktop/user/client/client.go Outdated Show resolved Hide resolved
ee/secureenclaverunner/secureenclaverunner.go Show resolved Hide resolved
ee/secureenclaverunner/secureenclaverunner.go Show resolved Hide resolved
ee/secureenclaverunner/secureenclaverunner.go Outdated Show resolved Hide resolved
ee/tpmrunner/tpmrunner.go Outdated Show resolved Hide resolved
Copy link
Contributor

@RebeccaMahany RebeccaMahany left a comment

Choose a reason for hiding this comment

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

Nice!!

@James-Pickett James-Pickett added this pull request to the merge queue Dec 19, 2024
Merged via the queue into kolide:main with commit 503ca05 Dec 19, 2024
32 checks passed
@James-Pickett James-Pickett deleted the james/hardware-key-runners branch December 19, 2024 18:14
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