mirror of
https://git.sr.ht/~nabijaczleweli/tzpfms
synced 2025-05-05 10:31:02 +03:00
154 lines
4.1 KiB
Groff
154 lines
4.1 KiB
Groff
.Dd October 15, 2021
|
|
.ds doc-volume-operating-system
|
|
.Dt ZFS-TPM2-CHANGE-KEY 8
|
|
.Os tzpfms 0.1-5
|
|
.
|
|
.Sh NAME
|
|
.Nm zfs-tpm2-change-key
|
|
.Nd change ZFS dataset key to one stored on the TPM
|
|
.Sh SYNOPSIS
|
|
.Nm
|
|
.Op Fl b Ar backup-file
|
|
.Ar dataset
|
|
.
|
|
.Sh DESCRIPTION
|
|
To normalise
|
|
.Ar dataset ,
|
|
.Nm
|
|
will open its encryption root in its stead.
|
|
.Nm
|
|
will
|
|
.Em never
|
|
create or destroy encryption roots; use
|
|
.Xr zfs-change-key 8
|
|
for that.
|
|
.Pp
|
|
First, a connection is made to the TPM, which
|
|
.Em must
|
|
be TPM-2.0-compatible.
|
|
.Pp
|
|
If
|
|
.Ar dataset
|
|
was previously encrypted with
|
|
.Nm tzpfms
|
|
and the
|
|
.Sy TPM2
|
|
back-end was used, the previous key will be freed from the TPM.
|
|
Otherwise, or in case of an error, data required for manual intervention will be printed to the standard error stream.
|
|
.Pp
|
|
Next, a new wrapping key is be generated on the TPM, optionally backed up
|
|
.Pq see Sx OPTIONS ,
|
|
and sealed to a persistent object on the TPM under the owner hierarchy;
|
|
if there is a passphrase set on the owner hierarchy, the user is prompted for it;
|
|
the user is always prompted for an optional passphrase to protect the sealed object with.
|
|
.Pp
|
|
The following properties are set on
|
|
.Ar dataset :
|
|
.Bl -bullet -compact -offset 4n -width ""
|
|
.\"" TODO: width?
|
|
.It
|
|
.Li xyz.nabijaczleweli:tzpfms.backend Ns = Ns Sy TPM2
|
|
.It
|
|
.Li xyz.nabijaczleweli:tzpfms.key Ns = Ns Ar ID of persistent object
|
|
.El
|
|
.Pp
|
|
.Li tzpfms.backend
|
|
identifies this dataset for work with
|
|
.Sy TPM2 Ns -back-ended
|
|
.Nm tzpfms
|
|
tools
|
|
.Pq namely Xr zfs-tpm2-change-key 8 , Xr zfs-tpm2-load-key 8 , and Xr zfs-tpm2-clear-key 8 .
|
|
.Pp
|
|
.Li tzpfms.key
|
|
is an integer representing the sealed object;
|
|
if needed, it can be passed to
|
|
.Nm tpm2_unseal Fl c Ev ${tzpfms.key} Op Fl p Ev ${password}
|
|
or equivalent for back-up
|
|
.Pq see Sx OPTIONS .
|
|
If you have a sealed key you can access with that or equivalent tool and set both of these properties, it will funxion seamlessly.
|
|
.Pp
|
|
Finally, the equivalent of
|
|
.Nm zfs Cm change-key Fl o Li keylocation=prompt Fl o Li keyformat=raw Ar dataset
|
|
is performed with the new key.
|
|
If an error occurred, best effort is made to clean up the persistent object and properties,
|
|
or to issue a note for manual intervention into the standard error stream.
|
|
.Pp
|
|
A final verification should be made by running
|
|
.Nm zfs-tpm2-load-key Fl n Ar dataset .
|
|
If that command succeeds, all is well,
|
|
but otherwise the dataset can be manually rolled back to a password with
|
|
.Nm zfs-tpm2-clear-key Ar dataset
|
|
.Pq or, if that fails to work, Nm zfs Cm change-key Fl o Li keyformat=passphrase Ar dataset ,
|
|
and you are hereby asked to report a bug, please.
|
|
.Pp
|
|
.Nm zfs-tpm2-clear-key Ar dataset
|
|
can be used to free the TPM persistent object and go back to using a password.
|
|
.
|
|
.Sh OPTIONS
|
|
.Bl -tag -compact -width "-b backup-file"
|
|
.It Fl b Ar backup-file
|
|
Save a back-up of the key to
|
|
.Ar backup-file ,
|
|
which must not exist beforehand.
|
|
This back-up
|
|
.Em must
|
|
be stored securely, off-site.
|
|
In case of a catastrophic event, the key can be loaded by running
|
|
.Dl Nm zfs Cm load-key Ar dataset Li < Ar backup-file
|
|
.El
|
|
.
|
|
.Sh TPM2 back-end configuration
|
|
.Ss Environment variables
|
|
.Bl -tag -compact -width "TSS2_LOG"
|
|
.It Ev TSS2_LOG
|
|
Any of:
|
|
.Sy NONE , ERROR , WARNING , INFO , DEBUG , TRACE .
|
|
Default:
|
|
.Sy WARNING .
|
|
.El
|
|
.
|
|
.Ss TPM selection
|
|
The library
|
|
.Nm libtss2-tcti-default.so
|
|
can be linked to any of the
|
|
.Pa libtss2-tcti-*.so
|
|
libraries to select the default, otherwise
|
|
.Pa /dev/tpmrm0 ,
|
|
then
|
|
.Pa /dev/tpm0 ,
|
|
then
|
|
.Pa localhost:2321
|
|
will be tried, in order
|
|
.Pq see Xr ESYS_CONTEXT 3 .
|
|
.
|
|
.Ss See also
|
|
The tpm2-tss git repository at
|
|
.Lk https:/\&/github.com/tpm2-software/tpm2-tss
|
|
and the documentation at
|
|
.Lk https:/\&/tpm2-tss.readthedocs.io .
|
|
.Pp
|
|
The TPM 2.0 specifications, mainly at
|
|
.Lk https:/\&/trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-1-Architecture-01.38.pdf
|
|
and related pages.
|
|
.
|
|
.Sh SPECIAL THANKS
|
|
To all who support further development, in particular:
|
|
.Bl -bullet -offset 4n -compact -width 0
|
|
.It
|
|
ThePhD
|
|
.It
|
|
Embark Studios
|
|
.El
|
|
.
|
|
.Sh REPORTING BUGS
|
|
.Lk https:/\&/todo.sr.ht/~nabijaczleweli/tzpfms
|
|
.Pp
|
|
.Mt ~nabijaczleweli/tzpfms@lists.sr.ht ,
|
|
archived at
|
|
.Lk https:/\&/lists.sr.ht/~nabijaczleweli/tzpfms .
|
|
.
|
|
.Sh SEE ALSO
|
|
.Xr tpm2_unseal 1
|
|
.Pp
|
|
.Lk https:/\&/git.sr.ht/~nabijaczleweli/tzpfms
|