zfs icon indicating copy to clipboard operation
zfs copied to clipboard

Support TFTP as a keylocation

Open johnlane opened this issue 2 months ago • 3 comments

Describe the feature you would like to see added to OpenZFS

It would be good if keylocation could use TFTP (or any protocol offered by curl).

How will this feature improve OpenZFS?

It would increase options for key storage.

Additional context

If zfs already uses curl (or libcurl) for http/https keys then it ought to be a simple extension to allow the URL passed to curl to be anything that curl will accept. Currently attempting to use tftp results in an error becuase, I guess, zfs performs validity checking on the given url

# zfs set keylocation=tftp://192.168.123.45/keys/myhost-mypool-enc-dataset.key mypool/enc
cannot set property for 'mypool/enc': invalid keylocation

(I didn't expect it to work because it isn't documented; I just tried it hoping that it would.)

johnlane avatar Oct 06 '25 17:10 johnlane

You could make it even more general and allow keylocation to execute a script (keylocation=/path/to/script.sh). The script would write the key to stdout, which would be read by zfs. This would allow all manners of authentication. I haven't thought though the security implications of this though.

tonyhutter avatar Oct 06 '25 17:10 tonyhutter

Such kind of facility can also be interesting for approaches like:

  • https://github.com/latchset/clevis/issues/218
  • https://github.com/latchset/clevis/pull/467

almereyda avatar Oct 27 '25 22:10 almereyda

You could make it even more general and allow keylocation to execute a script (keylocation=/path/to/script.sh). The script would write the key to stdout, which would be read by zfs. This would allow all manners of authentication. I haven't thought though the security implications of this though.

That would also allow people to use FIDO2/pkcs#11 hardware crypto tokens such as the Yubikey.

ncoder-1 avatar Nov 15 '25 12:11 ncoder-1