Repository navigation
Conversation
These two tests are: - `rot_attestor_verify_attestation`: get the required artifacts through the `RotAttestationHandle`, and then verify the attestation returned using the `dice-verifier` - `rot_attestor_busy`: ensure that the `RotAttestationTask` will reject requests with `RotError::Busy` / `http::StatusCode::SERVICE_UNAVAILABLE` when `QUEUE_SIZE` requests are outstanding This requires a few utility functions to: - generate mock keys and certs using the sprockets test utils - generate a mock measurement log using `attest-mock` and some KDL
This commit updates `AttestIpcc` to use this new async version of the trait. `AttestIpcc` now handles blocking I/O internally. This eliminates a lot of machinery and simplifies the request queuing logic. The `RotAttestationTask` & `RotAttestationHandle` are now combined in a single `RotAttestor` type. We now use a `Mutex` to serialize requests while preserving the existing limit on outstanding requests with a `Semaphore`.
jmpesp
left a comment
There was a problem hiding this comment.
To check my assumptions: RotAttestor now takes care of spawning the necessary background task(s)? Does that mean RotError::Shutdown can still come from the functions called on guard.attest?
| let attestor = RotAttestationTask::launch(&logctx.log, &cfg).unwrap(); | ||
| let log = attestor.get_measurement_log().await.unwrap(); | ||
| let chain = attestor.get_certificate_chain().await.unwrap(); | ||
| let nonce: Nonce = SaRotTypes::Nonce::N32([7u8; 32]).into(); |
There was a problem hiding this comment.
Any reason not to generate a random nonce here?
There was a problem hiding this comment.
I went back and forth on this. TL;DR simplicity won out and as written, this tests all of he parts that we care about here.
Some of the logic behind the choice:
There's nothing bad about creating the qualifying data from a random nonce here, but for the purposes of this test we don't really care about freshness or even appraising the attestation. All we care about is that the machinery in sled-agent behaves the way we expect. Verifying the attestation here serves as a means to check the integrity of the data we get back from the plumbing, but that's it. There are tests in the dice-util repo where we try to mimic the "real world" as much as possible and we use a random nonce there. I didn't think there was much use recreating those tests here.
All that said the cost associated with dipping into the RNG is pretty low so I'm not really attached to either approach. LMK if you have a preference?
| pub struct QualifyingData(oxide_rot::QualifyingData); | ||
|
|
||
| impl From<SaRotTypes::Nonce> for Nonce { | ||
| impl From<SaRotTypes::Nonce> for QualifyingData { |
There was a problem hiding this comment.
Do we plan to also change the API-visible names as well?
There was a problem hiding this comment.
At this point I avoided doing so because the change is just cosmetic. I've got a few topic branches where I'm working out how to add support for the HeliosRot and that will require API changes. It seemed logical to do that in a single PR ... or maybe just leave this part of the API alone? I'm not fully convinced this is the right approach so suggestions / opinions are welcome.
|
in reply to @jmpesp from #11674 (review)
Yes: https://github.com/oxidecomputer/dice-util/blob/main/oxide-rot/src/ipcc.rs#L39
As written now I believe the answer is 'no'. AFAIK: Lines 157 to 163 in eb2e28a and Lines 201 to 208 in eb2e28a This doesn't give us much info about what happened to the task, but it means that the task that should respond is not going to and This code now immediately calls All that said, instead of |
address review feedback: #11674 (comment) #11674 (comment)
address review feedback: #11674 (comment) #11674 (comment)
This work is intended to simplify the machinery behind the existing
sled-agentRoT interface & to bringsled-agentup to date w/ some reorganization & renaming done in thedice-utilrepo. The hard work was already done in oxidecomputer/dice-util#360. This PR just bringssled-agentup to date allowing it to benefit from the newly async trait & impls.