-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
zfs-mount-generator: Skip loading already loaded key #9529
zfs-mount-generator: Skip loading already loaded key #9529
Conversation
I considered using |
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.
LGTM
@aerusso you may want to have a look at this as well. |
Codecov Report
@@ Coverage Diff @@
## master #9529 +/- ##
==========================================
+ Coverage 79.01% 79.17% +0.15%
==========================================
Files 418 416 -2
Lines 123686 123661 -25
==========================================
+ Hits 97736 97909 +173
+ Misses 25950 25752 -198
Continue to review full report at Codecov.
|
This looks good to me. I waffled back and forth about testing for
Which more narrowly proceeds only if it can actually do something about it, and succeeds otherwise (also, a cursory glance through |
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'm not super familiar with systemd, but the general idea looks right to me.
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.
From: #9495 (comment)
This problem also exists in dracut module in the mount-zfs.sh. There should be a check included to see if zfs encryption key was already loaded.
@vozhyk- when you get a chance can you update the dracut script with a similar fix. |
@aerusso Indeed, this makes more sense. This should prevent trying to load the key for an unencrypted dataset (which would also fail) if the unit is ever generated for one.
@rlaager @behlendorf I've added similar checks to all the places That said, I cannot test the |
76d7d4b
to
b50c0ec
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.
This looks good other than the tabs to spaces change needed.
Don't ask for the password / try to load the key if the key for the encryptionroot is already loaded. Closes openzfs#9495 Signed-off-by: Witaut Bajaryn <[email protected]>
The user might have loaded the key manually or by other means before the scripts get called. Issue openzfs#9495 Signed-off-by: Witaut Bajaryn <[email protected]>
b50c0ec
to
fbdcd34
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.
LGTM.
Can this be added to |
Don't ask for the password / try to load the key if the key for the encryptionroot is already loaded. The user might have loaded the key manually or by other means before the scripts get called. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Witaut Bajaryn <[email protected]> Closes openzfs#9495 Closes openzfs#9529
Don't ask for the password / try to load the key if the key for the encryptionroot is already loaded. The user might have loaded the key manually or by other means before the scripts get called. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Witaut Bajaryn <[email protected]> Closes openzfs#9495 Closes openzfs#9529
Don't ask for the password / try to load the key if the key for the encryptionroot is already loaded. The user might have loaded the key manually or by other means before the scripts get called. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Witaut Bajaryn <[email protected]> Closes #9495 Closes #9529
Don't ask for the password / try to load the key
if the key for the
encryptionroot
is already loaded.Motivation and Context
This resolves #9495.
Description
Make the generated
zfs-load-key-<pool>.service
check if theencryptionroot
'skeystatus
isavailable
(meaning that the key is loaded) and return success if it is.How Has This Been Tested?
I've tested the change manually on top of 0.8.2 (in a fork with
libbe
andbeadm
ported from illumos; commit https://gitlab.com/linux-be/zfs/commits/85ef14c587e7cf358a8434ec31fa9ed2799247e7) on the Sabayon system from #9495.te
),zfs-load-key-te.service
does not ask for the password and does not fail:systemctl status zfs-load-key-te.service
testpool
), the generatedzfs-load-key-testpool.service
does not ask for the passphrase when the key is already loaded, but does ask for one and loads the key when it is not loaded:results with a file-based pool
Types of changes
Checklist:
Signed-off-by
.