Skip to content
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

Upgrade kcrypt partitions on boot #122

Merged
merged 2 commits into from
May 8, 2023
Merged

Upgrade kcrypt partitions on boot #122

merged 2 commits into from
May 8, 2023

Conversation

Itxaka
Copy link
Member

@Itxaka Itxaka commented May 5, 2023

This solves the issue of upgrading from the old method of mappings to identify the kcrypt partitions, with the new one that uses predictable uuids to identify them.

On boot we check for luks partitions that match the partitions persistent label (NOT THE FS LABEL) as that gets stored properly. If it matches persistent, we get its uuid and match it agsint the know uuid. If they dont match, we update it to match and proceed with booting.

Fixes: kairos-io/kairos#1379

@Itxaka Itxaka requested a review from a team May 5, 2023 17:44
@codecov-commenter
Copy link

codecov-commenter commented May 5, 2023

Codecov Report

Merging #122 (939f72e) into master (2e9e5de) will decrease coverage by 0.47%.
The diff coverage is 0.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master     #122      +/-   ##
==========================================
- Coverage   18.60%   18.14%   -0.47%     
==========================================
  Files          14       15       +1     
  Lines        1510     1549      +39     
==========================================
  Hits          281      281              
- Misses       1205     1244      +39     
  Partials       24       24              
Impacted Files Coverage Δ
internal/utils/upgrade_kcrypt.go 0.00% <0.00%> (ø)
pkg/mount/dag_normal_boot.go 0.00% <0.00%> (ø)
pkg/mount/dag_steps.go 3.99% <0.00%> (-0.04%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Itxaka Itxaka force-pushed the upgrade-kcrypt-path branch 4 times, most recently from f8ee8e7 to 0f0c21f Compare May 6, 2023 07:00
@Itxaka
Copy link
Member Author

Itxaka commented May 6, 2023

This works, tested upgrading from 1.X encrypted to master with this patch included.

This solves the issue of upgrading from the old method of mappings to
identify the kcrypt partitions, with the new one that uses predictable
uuids to identify them.

On boot we check for luks partitions that match the partitions persistent
label (NOT THE FS LABEL) as that gets stored properly.
If it matches persistent, we get its uuid and match it agsint the know
uuid. If they dont match, we update it to match and proceed with
booting.

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
pkg/mount/dag_steps.go Outdated Show resolved Hide resolved
Co-authored-by: Dimitris Karakasilis <jimmykarily@gmail.com>

// Mount COS_OEM (After root as it mounts under s.Rootdir/oem)
s.LogIfError(s.MountOemDagStep(g, cnst.OpMountRoot, cnst.OpLvmActivate, cnst.OpKcryptUnlock), "oem mount")
s.LogIfError(s.MountOemDagStep(g, cnst.OpMountRoot, cnst.OpLvmActivate), "oem mount")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im still nto sure about this. Potentially on 2.1.X we could allow encrypting COS_OEM as well, in that case this should depend on the unlock method. But it has not been tested so.....making it easy for now

@Itxaka Itxaka merged commit 14426d3 into master May 8, 2023
3 checks passed
@Itxaka Itxaka deleted the upgrade-kcrypt-path branch May 8, 2023 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Create an upgrade path for encrypted systems
3 participants