Add dynamic PCR policy support for disk key sealing#5398
Add dynamic PCR policy support for disk key sealing#5398eriknordmark merged 3 commits intolf-edge:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5398 +/- ##
==========================================
+ Coverage 19.52% 29.49% +9.96%
==========================================
Files 19 18 -1
Lines 3021 2417 -604
==========================================
+ Hits 590 713 +123
+ Misses 2310 1552 -758
- Partials 121 152 +31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dc7ca1e to
5af49ee
Compare
eriknordmark
left a comment
There was a problem hiding this comment.
Yetus issues to fix
|
@shjala a number of eden tests fail even after re-running.
|
|
@eriknordmark made some changes, please review (in the meantime I'll debug the eden). |
|
Something is broken in this PR. Once the device has been onboarded to the controller I see this error INFO: updated diag information at 2026-01-29T18:18:03.569550018Z due to Network So this causes some ordering issue for bringing up the vault. |
c0d339b to
ed9799d
Compare
Update eve-api to include the latest changes that support dynamic PCRs Signed-off-by: Shahriyar Jalayeri <shahriyar@posteo.de>
|
@eriknordmark made some changes, local run of Eden networking and upgrade tests all passed, smoke test all pass except Apps are running too, |
eriknordmark
left a comment
There was a problem hiding this comment.
I'll run this on some physical test device today.
|
Two yetus things to fix: Also, is there some comment syntax to tell revive to not complain about the TPM_CC_ name? |
Seems adding |
This commit introduces the ability to dynamically update the PCR policy used for sealing the disk encryption key, allowing the controller to define which PCRs are used for sealing. Key changes: evetpm: Added functionality to persist and validate PCR policy configuration in policy-pcr.json, plus recovring policy in case of configuration corruption. vaultmgr: Updated key handling logic to detect policy changes from the controller, persist the new policy, and trigger a reseal of the disk encryption key. zedagent: Added extraction of PCR policy information from AttestStorageKeys protobuf messages to pass to vaultmgr. types: Introduced VaultKeyPolicyPCR struct and PolicyPcrFile constant to support policy propagation. tests: Added unit tests for policy digest computation and validation. Signed-off-by: Shahriyar Jalayeri <shahriyar@posteo.de>
Update docs/SECURITY-ARCHITECTURE.md to include a new section that briefly explains the concept of dynamic PRC policy. Signed-off-by: Shahriyar Jalayeri <shahriyar@posteo.de>
|
|
||
| lockFile, err := fileutils.AcquireLock(policyPath, true) | ||
| if err != nil { | ||
| // xxx : should we fatal here? |
There was a problem hiding this comment.
Will it try again to save the policyPCR if you return an error?
Description
This commit introduces the ability to dynamically update the PCR policy used for sealing the disk encryption key, allowing the controller to define which PCRs are used for sealing.
Key changes:
configuration in policy-pcr.json, plus recovring policy in case
of configuration corruption.
controller, persist the new policy, and trigger a reseal of
the disk encryption key.
AttestStorageKeys protobuf messages to pass to vaultmgr.
to support policy propagation.
PR dependencies
lf-edge/eve-api#125
How to test and validate this PR
Automated Tests
TestSaveDiskKeySealingPCRsValidPolicy,TestSaveDiskKeySealingPCRsInvalidPolicy,TestSaveDiskKeySealingPCRsPolicyUnchanged,TestGetDiskKeySealingPCRsFromFile, andTestGetDiskKeySealingPCRsCorruptedFilehave been added topkg/pillar/evetpm/tpm_test.goto verify the policy validation, saving, and loading logic.Manual Verification
To validate the full end-to-end flow with a controller:
Preparation:
Controller Integration (Dynamic Policy Update):
EncryptedVaultKeymessage with a new PCR policy (e.g., adding or removing a valid PCR index like PCR 4 or 6).logread | grep vaultmgr) that:[ATTEST] received Controller-given encrypted key with Policy PCR version).vaultmgrdetects the policy change (Policy Changed: true)vaultmgrvalidates the new policy and accepts it (Policy Changed: true)Re-sealed disk key in TPM).Controller Integration (Invalid Policy):
vaultmgrrejects the policy with an error and does not update the sealing policy (Failed to save controller provided Policy).No-Op Update:
vaultmgrdetects no change and skips the re-sealing process ( content ofpersist/status/policy-pcr.jsonshould not change, same forpolicy-pcr-digestin the same directory)Changelog notes
Added support for dynamic configuration of TPM PCR policies for disk encryption. The device can now receive updated sealing policies from the controller, allowing for more flexible security configurations without requiring a full system update.
PR Backports
Checklist
For backport PRs (remove it if it's not a backport):
And the last but not least:
check them.
Please, check the boxes above after submitting the PR in interactive mode.