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

nixos/zfs: load encryption keys for all pools #41846

Merged
merged 4 commits into from Jun 28, 2018
Merged

Conversation

woffs
Copy link
Contributor

@woffs woffs commented Jun 11, 2018

this is a proposal to fix #41838

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@woffs
Copy link
Contributor Author

woffs commented Jun 11, 2018

@GrahamcOfBorg test zfs

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: tests.zfs

Partial log (click to expand)

Cannot nix-instantiate `tests.zfs' because:
error: attribute 'zfs' in selection path 'tests.zfs' not found

@GrahamcOfBorg
Copy link

No attempt on x86_64-linux (full log)

The following builds were skipped because they don't evaluate on x86_64-linux: tests.zfs

Partial log (click to expand)

Cannot nix-instantiate `tests.zfs' because:
error: attribute 'zfs' in selection path 'tests.zfs' not found

("$zpool_cmd" list "${pool}" >/dev/null) || "$zpool_cmd" import -d ${cfgZfs.devNodes} -N ${optionalString cfgZfs.forceImportAll "-f"} "${pool}"
${optionalString cfgZfs.requestEncryptionCredentials "\"$zfs_cmd\" load-key -r \"${pool}\""}
Copy link
Member

Choose a reason for hiding this comment

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

Did you actually test this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just tested this, it works and loads the key (from file:///, not prompt). I just wonder why zfs-mount.service does not get started. (manual "systemctl start zfs-mount.service" works).

@woffs
Copy link
Contributor Author

woffs commented Jun 13, 2018

I mentioned the change in the option description. Fixes for enabling the zfs-mount services follow in separate PRs

fixes NixOS#41838

At the moment it works fine for "file://" keys, but does not work for
dataPools with "prompt" keys, because the passphrase cannot be entered
(yet).
@woffs
Copy link
Contributor Author

woffs commented Jun 17, 2018

Tested, updated description, squashed and rebased.

@Mic92 Mic92 merged commit c5da007 into NixOS:master Jun 28, 2018
@@ -397,9 +397,8 @@ in
};
script = ''
zpool_cmd="${packages.zfsUser}/sbin/zpool"
zfs_cmd="${packages.zfsUser}/sbin/zfs"
("$zpool_cmd" list "${pool}" >/dev/null) || "$zpool_cmd" import -d ${cfgZfs.devNodes} -N ${optionalString cfgZfs.forceImportAll "-f"} "${pool}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be improved, but will be overwritten by #42269 anyway :-)

@woffs
Copy link
Contributor Author

woffs commented Jun 28, 2018

Thanks @Mic92 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nixos/zfs: requestEncryptionCredentials only handles rootPool
3 participants