Repository navigation
Conversation
|
@blueorangutan package |
|
@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14453 +/- ##
======================================
Coverage 3.86% 3.86%
======================================
Files 494 494
Lines 42888 42888
Branches 8141 8141
======================================
Hits 1657 1657
Misses 40999 40999
Partials 232 232
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19644 |
90b18fc to
6abe098
Compare
a3121b3 to
743cc40
Compare
|
@blueorangutan package |
|
@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19656 |
743cc40 to
efb1c68
Compare
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19659 |
|
@blueorangutan test |
|
@vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-17197)
|
efb1c68 to
8fd2a6d
Compare
|
@blueorangutan package |
|
@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✔️ suse15. SL-JID 19767 |
There was a problem hiding this comment.
🟡 Changes recommended
Key-format repair can make historical snapshots unreadable and hold the cluster-wide rewrap lock indefinitely if HSM encryption stalls.
5 open issues
Guard historical volumes with non-destroyed snapshots · New Timeout the repair wrap call to avoid holding the cluster lock · New Preserve missing-KEK errors for CBC unwrap fallback · New Handle token RNG failures and wipe partial buffers · New Run HSM probe and cleanup through the timeout mechanism · New
Review effort: Balanced
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
There was a problem hiding this comment.
🟡 Changes recommended
The repair guard overlooks expunged volumes with retained snapshots, allowing key rewrites that make those snapshots unreadable, while HSM operations also have unresolved timeout and recovery gaps.
7 open issues
Include expunged volumes in the repair safety check · New Timeout the repair wrap call to avoid holding the cluster lock Guard historical volumes with non-destroyed snapshots Handle PKCS#11 RNG failures through the recovery path · New Run HSM probe and cleanup through the timeout mechanism Handle token RNG failures and wipe partial buffers Preserve missing-KEK errors for CBC unwrap fallback
Review effort: Balanced
8f55ff5 to
ee42536
Compare
|
@blueorangutan package |
|
@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
5 open issues
Collectorsis referenced here; ensurejava.util.stream.Collectorsis imported in this file.… · Newprovider.getWrapAlgorithm(hsmProfileId)is called with the raw command parameter, but the method… · NewwrapAlgorithmis non-nullable at the ORM level, but it has no default initialization in the… · New Consider short-circuiting whenvolumeIdsis empty to avoid an unnecessary DAO call (and to avoid… · NewdeleteUserKMSKeyis declared to throwKMSException, but this path throws… · New
7 resolved since last review
Include expunged volumes in the repair safety check Timeout the repair wrap call to avoid holding the cluster lock Guard historical volumes with non-destroyed snapshots Handle PKCS#11 RNG failures through the recovery path Run HSM probe and cleanup through the timeout mechanism Handle token RNG failures and wipe partial buffers Preserve missing-KEK errors for CBC unwrap fallback
Review effort: Lite
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20014 |
|
@vishesh92 , can you instruct any AI you may be using to avoid in line comments and generate new methods with good names and top-of-method comments instead? |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
ee42536 to
b5bceaa
Compare


Description
Fixes a set of problems in the KMS feature shipped in 4.23.0.0, plus an upgrade path for 4.23 databases.
Volumes migrated with
migrateVolumesToKMScould not be opened. Migration wrapped the base64 text of the legacy passphrase.VolumeObject.getPassphrase()base64-encodes the unwrapped bytes again, so qemu got a different passphrase than the one the LUKS header was created with (Invalid password, cannot unlock any keyslot). Migration now wraps the 48 decoded bytes, and the old passphrase row is deleted in the same transaction. Blobs already migrated on 4.23 are repaired by a background task after the upgrade (see Upgrade).Keys were removed while still needed.
VolumeDaoImpl.remove()removed the wrapped key. Volume migration (duplicateVolumeOnAnotherStorage) gives the new volume the same key, so expunging the source broke the migrated volume.SnapshotObjectTOunwraps it eagerly), but expunging released the key anyway. The legacy passphrase had the same problem, sincedeletePassphrase()hard-deleted the row.Now
remove()leaves the key alone, anddeleteKMSWrappedKey/deletePassphrasekeep it while another live volume or a non-destroyed snapshot still needs it. The storage GC callsVolumeService.releaseKeysOfRemovedVolumes()to release such keys once nothing needs them anymore. For a removed volume whose key is already gone,getPassphrase()returns an empty passphrase, so its snapshots can still be deleted.Wrap algorithm. PKCS#11 wrapped keys were AES-CBC with no authentication, and
kms_keys.algorithmwas hardcoded to GCM even for PKCS#11 keys.wrap_algorithmdetail:AES/GCM/NoPadding(default),AES/KWP/NoPadding(needs Java 18+ on the management server) orAES/CBC/PKCS5Padding(4.23's format). It can't be changed after the profile is created, and each wrapped key records the algorithm it was written with inkms_wrapped_key.wrap_algorithm.createKMSKeyandrotateKMSKeywrap and unwrap a random test key right after creating the KEK and refuse the key (and delete the KEK again) if the HSM can't do the profile's algorithm.KMSKey.algorithmnow comes from the provider.C_GenerateRandom), with the JVM'sSecureRandomas fallback for tokens without one.kms.dek.size.bitsis validated.C_Decryptactive, which made every later operation on that session fail withCKR_OPERATION_ACTIVE.Smaller fixes
deleteKMSKeyno longer removes the DB row when deleting a KEK from the HSM fails (a KEK that is already gone is skipped).deleteKeynow reportsKEK_NOT_FOUND.getPassphrase()no longer copies the key into an immutableString.HSM Database ProvidertoDatabase Provider.token_labelis gone from the UI. The provider wrotetokenLabel=into the SunPKCS11 config, which SunPKCS11 doesn't have (any JDK 17-25), so profiles using it never connected. A profile needsslotorslot_list_index.@ActionEvent, whose interceptor missed calls made from withinKMSManagerImpl(the unwraps of the rewrap worker and the format repair) and wraps done bymigrateVolumesToKMS. Every wrap and unwrap now records aKMS.KEY.WRAP/KMS.KEY.UNWRAPevent (ERROR on failure), without changing the event resource of the operation that uses the key.rotateKMSKeynow records its completed event. A volume key is unwrapped for every command that carries the volume to the host, so one operation (e.g. a VM deploy) can show several unwrap events.Upgrade (4.23.0.0 -> 24.0.0)
No HSM access is needed during the upgrade.
kms_wrapped_keygetswrap_algorithm(existing PKCS#11 keys are set to CBC, database-provider keys to GCM) andformat_check_pending(set to 1 on all existing rows).wrap_algorithm=AES/CBC/PKCS5Paddingand theirkms_keys.algorithmis corrected, so nothing changes for them. To move to GCM or KWP, create a profile with the new algorithm and runrotateKMSKeyonto it. The existing rewrap worker converts the blobs.Upgrade42300to2400restores wrapped keys that 4.23 removed while a live volume or non-destroyed snapshot still needed them, as long as the KMS key and KEK still exist. For the others it logs a WARN with the wrapped key and volume UUIDs.KMSKeyFormatRepair, shares thekms.rewrap.workerlock) checks every flagged key once, using the unwrapped length and format. Keys that 4.23 migrated wrongly are rewrapped with the raw bytes, and events are added for the KMS key and the volume. A key whose volume was created after the key is not touched: that is a copy made by a storage migration on 4.23, which was encrypted with the wrong passphrase, so rewrapping would make it unreadable. It logs a WARN and leaves it to the admin. A key that can't be unwrapped (HSM down) stays flagged and is retried. The task stops when nothing is flagged.Things to know
memcpythat trips_GLIBCXX_ASSERTIONS; Ubuntu's 2.6.1 is fine). bouncyhsm's client library rejects the GCM parameters JDK 17 sends first, so GCM there needs Java 21; the wrap test reports it cleanly on 17. Use CBC for such HSMs.C_Encrypt. openCryptoki 3.26 does; SoftHSM 2.7.0 and bouncyhsm don't, and the wrap test refuses the key.LibvirtStorageAdaptor.copyPhysicalDiskignores the passphrases. That is not KMS-specific and goes back to 4.18.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Unit tests:
KMSManagerImpl*Test(access, HSM profiles, key creation, lifecycle, rotation, migration/format repair, retry): wrap/unwrap with recorded and fallback KEK versions, key release rules, migration of the raw passphrase, the 4.23 format repair, and the KMS key events (including ERROR events on failure).PKCS11HSMProviderTest: wrap algorithm selection, blob checks, session discard.VolumeObjectTest: passphrase lookup and release for live and removed volumes.Integration:
test/integration/smoke/test_kms_lifecycle.pyupdated.Manual, on a KVM (OL9) zone with a SoftHSMv2 HSM profile: created a KMS key, deployed a VM with a KMS-encrypted volume, migrated a legacy encrypted volume with
migrateVolumesToKMS, rotated the key and checked the rewrap and the events on the KMS key.