-
Couldn't load subscription status.
- Fork 580
util: explicitly set the Luks2 header size #5394
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
util: explicitly set the Luks2 header size #5394
Conversation
bbb07c4 to
22ce1d4
Compare
|
/test ci/centos/mini-e2e/k8s-1.33 |
22ce1d4 to
ffee6f6
Compare
|
passed e2e logs |
ffee6f6 to
a035b30
Compare
internal/rbd/encryption.go
Outdated
| return 0, fmt.Errorf("failed to get %s metadata on image %s: %w", luks2HeaderSizeKey, ri, err) | ||
| } | ||
|
|
||
| return 0, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be default size ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the name implies, getLuksHeaderSizeMetadata() is intended to return the LUKS2 header size only if it's explicitly set in the image metadata. If the metadata key is missing, it returns 0. It's the responsibility of the caller to interpret this and decide whether to fall back to the default LUKS2 header size (cryptsetup.DefaultLuks2HeaderSize, 16 MiB) or take another action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, you need to adjust your comment appropriately And in that case, the default LUKS2 header // size is used, which is 16 MiB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the default value needs to be returned in this function itself to avoid confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅 yea, that needs to be removed to avoid confusion.
| // on creation by using the `--luks2-metadata-size` and | ||
| // `--luks2-keyslots-size` options. By default, the header size is | ||
| // 16MiB. | ||
| DefaultLuks2HeaderSize = 16 * helpers.MiB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a separate comment for this one, explaining older images do have this set in image metadata.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed PTAL.
4cf929f to
2172248
Compare
47889b3 to
709d14b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small improvement to prevent potential bugs when calling the new getLuksHeaderSizeMetadata() function.
709d14b to
b4e6f86
Compare
|
@Mergifyio rebase |
The LUKS2 header size is variable and it can be adjusted on creation by using the `--luks2-metadata-size` and `--luks2-keyslots-size` options. By default, the header size is 16MiB. This commit explicitly uses the options to define the default header size. Ref 10.10: https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/FAQ.md Signed-off-by: Praveen M <[email protected]>
Signed-off-by: Praveen M <[email protected]>
✅ Branch has been successfully rebased |
b4e6f86 to
6cfe178
Compare
|
@Mergifyio queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at d0003aa |
|
/test ci/centos/k8s-e2e-external-storage/1.31 |
|
/test ci/centos/upgrade-tests-cephfs |
|
/test ci/centos/mini-e2e-helm/k8s-1.31 |
|
/test ci/centos/upgrade-tests-rbd |
|
/test ci/centos/mini-e2e/k8s-1.31 |
|
/test ci/centos/k8s-e2e-external-storage/1.32 |
|
/test ci/centos/k8s-e2e-external-storage/1.33 |
|
/test ci/centos/mini-e2e-helm/k8s-1.32 |
|
/test ci/centos/mini-e2e-helm/k8s-1.33 |
|
/test ci/centos/mini-e2e/k8s-1.32 |
|
/test ci/centos/mini-e2e/k8s-1.33 |
|
This pull request has been removed from the queue for the following reason: The pull request can't be updated. You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
| oldMetadataDEK = ".rbd.csi.ceph.com/dek" | ||
|
|
||
| // luks2 header size metadata key. | ||
| luks2HeaderSizeKey = "rbd.csi.ceph.com/luks2HeaderSize" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want this metadata key to be present on all the clones/snapshots and also across cluster when mirroring is enabled?
Describe what this PR does
util: explicitly set the Luks2 header size
The LUKS2 header size is variable and it can be adjusted
on creation by using the
--luks2-metadata-sizeand--luks2-keyslots-sizeoptions. By default, the header size is16MiB.
This commit explicitly uses the options to define the default
header size.
Ref 10.10: https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/FAQ.md
Checklist:
Show available bot commands
These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:
/retest ci/centos/<job-name>: retest the<job-name>after unrelatedfailure (please report the failure too!)