Unattended boot prompts for passphrase when keylocation & keysource are set, Manual booting from menu finds the key and does not prompt #784
-
ZFSBootMenu build sourceRelease EFI ZFSBootMenu version3.0.1 Boot environment distributionDebian Trixie Problem descriptionUnattended booting prompts for the passphrase when the keysource & keylocation file are set, but if you press esc to open main menu and immediately select the default boot environment it is able to find the keylocation via keysource, unlock it, and boot without prompting. Unattended booting should be able to find and unlock the boot environment without manual intervention Steps to reproduce
Hopefully relevant setup and properties: The debian trixie boot environment has copy of the key and it is included in it's initramfs |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
|
Unless you've put your key within your ZFSBootMenu image, which is a really bad idea, you will always have to type your password once. The keysource parameter is only used when caching the key, in case ZBM needs to reimport your pool. |
Beta Was this translation helpful? Give feedback.
-
|
ZFSBootMenu is finding, loading, unlocking, and booting the encrypted boot environment when it's manually selected from the main menu without needing to enter the passphrase. The issue is that only works if someone is there to push two buttons and doesn't work when the timer runs out. If it's important, my specific use case and reasoning for this setup is being able to send/recv fully encrypted boot environment datasets to & from "untrusted" hosts that do not have the key. |
Beta Was this translation helpful? Give feedback.
-
|
One small point of clarification; when you've selected a boot environment from the main menu the environment has already been decrypted. The fact that you're getting there without typing a password is actually the bug here; that behavior is not intentional. The design goal of the https://github.com/zbm-dev/zfsbootmenu/blob/master/zfsbootmenu/libexec/zfsbootmenu-init#L73-L78 -- we disallow using cached keys for automatic boots. |
Beta Was this translation helpful? Give feedback.
-
|
Since ZFSBootMenu is capable of doing so, could the functionally become intentional? I don't think the use case is unreasonable and the risk of having the keys be available for unattended boot is probably a choice a user should be able to make. (I, for one, understand the implications of doing so and am happy to make the trade off to be able to have encrypted datasets I can backup automatically to untrusted hosts; and I'd rather not have to go back to using grub) |
Beta Was this translation helpful? Give feedback.
-
|
All you have to do is put your keys in the ZFSBootMenu image, at the path specified by |
Beta Was this translation helpful? Give feedback.
-
|
I suppose building a custom image is doable (will try to read through the build guide), but it also seems drastically more accessible to |
Beta Was this translation helpful? Give feedback.
-
|
zdykstra has helped me understand the issue here. On automatic boot, your keys do not exist in the ZFSBootMenu root at the path indicated by the When you break to the menu, we again attempt to mount the root filesystem, but now we allow key caching. Caching looks like this:
To be blunt, we will not implement a method to support your desired operation for automatic mounting. The key caching routine uses a mutex to ensure that only a single ZFSBootMenu instance attempts to cache a key. We do not allow caching during the automatic boot for two principal reasons:
We do not view storing of unencrypted keys on the same device as the encrypted filesystem as a legitimate use of encryption. If you are going to put a deadbolt on your front door, it is simply insane to weld the key into the cylinder and pretend you have somehow improved security over just removing the lock. You should drop encryption if you do not like typing a password once per boot. Nevertheless, ZFSBootMenu is designed to be extensible and flexible. You actually have two choices:
|
Beta Was this translation helpful? Give feedback.
-
|
Reading through this again, I noticed that your motivation is to receive encrypted datasets on an untrusted host. Note that this does not require that the untrusted host have any encrypted filesystems that you care about. Your untrusted host can receive raw snapshots of encrypted datasets and put them under an unencrypted parent without issue, and the untrusted host will never be able to unlock them (unless you log in and do so manually). If you are not sending raw encrypted snapshots, you are actually decrypting them for transmission (which is needlessly slow) and re-encrypting them with the unguarded key on the remote. You certainly don't want to do this, because it would require absolute trust in the remote system that you don't want to trust at all. |
Beta Was this translation helpful? Give feedback.
zdykstra has helped me understand the issue here.
On automatic boot, your keys do not exist in the ZFSBootMenu root at the path indicated by the
keylocationproperty of the locked root filesystem. Hence, when we try to mount the root filesystem to read the kernel and ultimately boot it, ZFS prompts you for a passphrase (because we overridekeylocationwhen we detect that the key is not available, to force a prompt rather than just failing). This unlock does not allow key caching viaorg.zfsbootmenu:keysource. The caching mechanism is what circumvents the password requirement in the menu.When you break to the menu, we again attempt to mount the root filesystem, but now we allow key cachin…