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

feat: add zfs-service to zfs extension (unmount, encryption) #513

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

jfroy
Copy link
Contributor

@jfroy jfroy commented Nov 5, 2024

This patch adds a new service to the zfs extension (zfs-service) that handles pool import and unmount. These operations are tied to the service lifecycle: the service imports all pools when it starts, waits for an exit signal, then unmounts all pools before exiting.

As a subtle additional benefit, the service passes the -l flag to zpool-import1, which instructs it to request encryption keys for all encrypted datasets. Using the zfs keylocation2 property and Talos secure boot and TPM disk encryption, a ZFS encryption key file can be safely stored on the EPHEMERAL partition to import encrypted datasets at boot. Alternatively, a key can be stored on an https server.

Footnotes

  1. https://openzfs.github.io/openzfs-docs/man/master/8/zpool-import.8.html

  2. https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#keylocation

@jfroy
Copy link
Contributor Author

jfroy commented Nov 5, 2024

@frezbo As discussed.

@frezbo frezbo force-pushed the zfs-ext branch 3 times, most recently from b634f9a to b1aecbc Compare November 7, 2024 08:50
This patch adds a new service to the zfs extension (`zfs-service`) that
handles pool import and unmount. These operations are tied to the
service lifecycle: the service imports all pools when it starts, waits
for an exit signal, then unmounts all pools before exiting.

As a subtle additional benefit, the service passes the `-l` flag to
`zpool-import`[^1], which instructs it to request encryption keys for
all encrypted datasets. Using the zfs `keylocation`[^2] property and
Talos secure boot and TPM disk encryption, a ZFS encryption key file can
be safely stored on the EPHEMERAL partition to import encrypted datasets
at boot. Alternatively, a key can be stored on an https server.

[^1]: https://openzfs.github.io/openzfs-docs/man/master/8/zpool-import.8.html
[^2]: https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#keylocation

Signed-off-by: Jean-Francois Roy <[email protected]>
Signed-off-by: Noel Georgi <[email protected]>
@frezbo
Copy link
Member

frezbo commented Nov 8, 2024

/m

@talos-bot talos-bot merged commit 61c0dc4 into siderolabs:main Nov 8, 2024
14 checks passed
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.

3 participants