Commit e45b10d
committed
Support ZFS encryption key rotation for Trust Quorum epoch commits
When Trust Quorum commits a new epoch, all U.2 crypt datasets must have
their encryption keys rotated to use the new epoch's derived key. This
change implements the key rotation flow triggered by epoch commits.
## Trust Quorum Integration
- Add watch channel to `NodeTaskHandle` for epoch change notifications
- Initialize channel with current committed epoch on startup
- Notify subscribers via `send_if_modified()` when epoch changes
## Config Reconciler Integration
- Accept `committed_epoch_rx` watch channel from trust quorum
- Trigger reconciliation when epoch changes
- Track per-disk encryption epoch in `ExternalDisks`
- Add `rekey_for_epoch()` to coordinate key rotation:
- Filter disks needing rekey (cached epoch < target OR unknown)
- Derive keys for each disk via `StorageKeyRequester`
- Send batch request to dataset task
- Update cached epochs on success
- Retry on failure via normal reconciliation retry logic
## Dataset Task Changes
- Add `RekeyRequest`/`RekeyResult` types for batch rekey operations
- Add `datasets_rekey()` with idempotency check (skip if already at target)
- Use `Zfs::change_key()` for atomic key + epoch property update
## ZFS Utilities
- Add `Zfs::change_key()` using `zfs_atomic_change_key` crate
- Add `Zfs::load_key()`, `unload_key()`, `dataset_exists()`
- Add `epoch` field to `DatasetProperties`
- Add structured error types for key operations
## Crash Recovery
- Add trial decryption recovery in `sled-storage` for datasets with
missing epoch property (e.g., crash during initial creation)
- Unload key before each trial attempt to handle crash-after-load-key
- Set epoch property after successful recovery
## Safety Properties
- Atomic: Key and epoch property set together via `zfs_atomic_change_key`
- Idempotent: Skip rekey if dataset already at target epoch
- Crash-safe: Epoch read from ZFS on restart rebuilds cache correctly
- Conservative: Unknown epochs (None) trigger rekey attempt1 parent 31f4fff commit e45b10d
File tree
15 files changed
+904
-50
lines changed- illumos-utils
- src
- key-manager/src
- sled-agent
- config-reconciler
- src
- reconciler_task
- src
- sim
- sled-storage/src
- trust-quorum/src
15 files changed
+904
-50
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
829 | 829 | | |
830 | 830 | | |
831 | 831 | | |
| 832 | + | |
832 | 833 | | |
833 | 834 | | |
834 | 835 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
209 | 245 | | |
210 | 246 | | |
211 | 247 | | |
| |||
523 | 559 | | |
524 | 560 | | |
525 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
526 | 566 | | |
527 | 567 | | |
528 | 568 | | |
529 | | - | |
530 | | - | |
| 569 | + | |
531 | 570 | | |
532 | 571 | | |
533 | 572 | | |
| |||
648 | 687 | | |
649 | 688 | | |
650 | 689 | | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
651 | 702 | | |
652 | 703 | | |
653 | 704 | | |
| |||
658 | 709 | | |
659 | 710 | | |
660 | 711 | | |
| 712 | + | |
661 | 713 | | |
662 | 714 | | |
663 | 715 | | |
| |||
1197 | 1249 | | |
1198 | 1250 | | |
1199 | 1251 | | |
1200 | | - | |
| 1252 | + | |
1201 | 1253 | | |
1202 | 1254 | | |
1203 | 1255 | | |
| |||
1246 | 1298 | | |
1247 | 1299 | | |
1248 | 1300 | | |
1249 | | - | |
| 1301 | + | |
1250 | 1302 | | |
1251 | 1303 | | |
1252 | 1304 | | |
| |||
1365 | 1417 | | |
1366 | 1418 | | |
1367 | 1419 | | |
1368 | | - | |
1369 | | - | |
1370 | | - | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
1371 | 1443 | | |
1372 | 1444 | | |
1373 | 1445 | | |
| |||
1523 | 1595 | | |
1524 | 1596 | | |
1525 | 1597 | | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
1526 | 1654 | | |
1527 | 1655 | | |
1528 | 1656 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
0 commit comments