1NDCTL-UPDATE-PASSP(1)                                    NDCTL-UPDATE-PASSP(1)
2
3
4

NAME

6       ndctl-update-passphrase - update the security passphrase for an NVDIMM
7

SYNOPSIS

9       ndctl update-passphrase <nmem0> [<nmem1>..<nmemN>] [<options>]
10

DESCRIPTION

12       Update the security passphrase for one or more NVDIMMs. Prerequisites
13       for command to succeed:
14
15        1. The kek has been loaded into the kernel’s user keyring.
16
17        2. setup-passphrase has successfully been executed on the NVDIMM.
18
19           •   Alternatively, the NVDIMM is unlocked.
20
21       The updated key blobs will be created in the /etc/ndctl/keys directory
22       with a file name format of "nvdimm_<dimm-unique-id>_<hostname>.blob".
23

OPTIONS

25       <dimm>
26           A nmemX device name, or a dimm id number. Restrict the operation to
27           the specified dimm(s). The keyword all can be specified to indicate
28           the lack of any restriction, however this is the same as not
29           supplying a --dimm option at all.
30
31       -b, --bus=
32           A bus id number, or a provider string (e.g. "ACPI.NFIT"). Restrict
33           the operation to the specified bus(es). The keyword all can be
34           specified to indicate the lack of any restriction, however this is
35           the same as not supplying a --bus option at all.
36
37       -k, --key_handle=
38           Handle for the master kek (key-encryption-key) that will be used
39           for sealing the passphrase(s) for the given DIMM(s). The format is:
40           <key type>:<key description> e.g.  trusted:nvdimm-master NOTE: The
41           kek is expected to have been loaded into the user keyring.
42
43       -m, --master-passphrase
44           Indicates that we are managing the master passphrase instead of the
45           user passphrase.
46
47       -v, --verbose
48           Emit debug messages.
49

THEORY OF OPERATION

51       The Intel Device Specific Methods (DSM) specification v1.7 and v1.8 [1]
52       introduced the following security management operations: enable
53       passphrase, update passphrase, unlock DIMM, disable security, freeze
54       security, secure (crypto) erase, overwrite, master passphrase enable,
55       master passphrase update, and master passphrase secure erase.
56
57       The security management for NVDIMMs is comprised of two parts. The
58       front end uses the Linux key management framework (trusted and
59       encrypted keys [2]) to store the encrypted passphrases in the
60       kernel-managed keyring. The interface for this is the keyutils utility
61       which uses the key management APIs in the Linux kernel. The back end
62       takes the decrypted payload (which is the DIMM passphrase) and passes
63       it to the DIMM.
64
65       Unlike other DSMs which are composed by libndctl and sent to the kernel
66       via an ioctl, the security DSMs are managed through the security sysfs
67       attribute under the dimm device. A key-ID is written to the security
68       attribute and the kernel pulls the associated key material from the
69       user keyring that is maintained by the kernel.
70
71       The security process begins with the generation of a master key that is
72       used to seal (encrypt) the passphrase for the DIMM. There can either be
73       one common master key that is used to encrypt every DIMM’s passphrase,
74       or a separate key can be generated for each DIMM. The master key is
75       also referred to as the key-encryption-key (kek). The kek can either be
76       generated by the TPM (Trusted Platform Module) on the system, or
77       alternatively, the System Master Key can also be used as the kek
78
79       For testing purposes a user key with randomized payload can also be
80       used as a kek. See [2] for details. To perform any security operations,
81       it is expected that the kek has been added to the kernel’s user keyring
82       as shown in example below:
83
84           # keyctl show
85           Session Keyring
86            736023423 --alswrv      0     0  keyring: _ses
87            675104189 --alswrv      0 65534   \_ keyring: _uid.0
88            680187394 --alswrv      0     0       \_ trusted: nvdimm-master
89
90       Before performing any of the security operations, all the regions
91       associated with the DIMM in question need to be disabled. For the
92       overwrite operation, in addition to the regions, the dimm also needs to
93       be disabled.
94
95       [1] http://pmem.io/documents/NVDIMM_DSM_Interface-V1.8.pdf [2]
96       https://www.kernel.org/doc/Documentation/security/keys/trusted-encrypted.rst
97
98       The following sub-sections describe specifics of each security feature.
99
100   UNLOCK
101       Unlock is performed by the kernel, however a preparation step must
102       happen before the unlock DSM can be issued by the kernel. It is
103       expected that from the initramfs, a setup command (ndctl load-keys) is
104       executed before the libnvdimm module is loaded by modprobe. This
105       command will inject the kek and the encrypted passphrases into the
106       kernel’s user keyring. During the probe of the libnvdimm driver, it
107       will:
108
109        1. Check the security state of the device and see if the DIMM is
110           locked
111
112        2. Request the associated encrypted passphrase from the kernel’s user
113           key ring
114
115        3. Use the kek to decrypt the passphrase
116
117        4. Create the unlock DSM, copy the decrypted payload into the DSM
118
119        5. Issue the DSM to unlock the DIMM
120
121       If the DIMM is already unlocked, the kernel will attempt to revalidate
122       the passphrase. If we fail to revalidate the passphrase, the kernel
123       will freeze the security and disallow any further security
124       configuration changes. A kernel module parameter is available to
125       override this behavior.
126
127   SETUP USER PASSPHRASE
128       To setup the passphrase for a DIMM, it is expected that the kek to be
129       used is present in the kernel’s user keyring. The kek encrypts the DIMM
130       passphrase using the enc32 key format. The plaintext passphrase is
131       never provided by or made visible to the user. It is instead randomly
132       generated by the kernel and userspace does not have access to it. Upon
133       encryption, a binary blob of the passphrase is written to the
134       passphrase blob storage directory (/etc/ndctl/keys). The user is
135       responsible for backing up the passphrase blobs to a secure location.
136
137   UPDATE USER PASSPHRASE
138       The update user passphrase operation uses the same DSM command as
139       enable user passphrase. Most of the work is done on the key management
140       side. The user has the option of providing a new kek for the new
141       passphrase, but continuing to use the existing kek is also acceptable.
142       The following operations are performed for update-passphrase:
143
144        1. Remove the encrypted passphrase from the kernel’s user keyring.
145
146        2. Rename the passphrase blob to old.
147
148        3. Load this old passphrase blob into the keyring with an "old" name.
149
150        4. Create the new passphrase and encrypt with the kek.
151
152        5. Send DSM with the old and new decrypted passphrases.
153
154        6. Remove old passphrase and the passphrase blob from the keyring.
155
156   REMOVE USER PASSPHRASE
157       The key-ID for the passphrase to be removed is written to sysfs. The
158       kernel then sends the DSM to disable security, and the passphrase is
159       then removed from the keyring, and the associated passphrase blob is
160       deleted.
161
162   CRYPTO (SECURE) ERASE
163       This operation is similar to remove-passphrase. The kernel issues a
164       WBINVD instruction before and after the operation to ensure no data
165       corruption from a stale CPU cache. Use ndctl’s sanitize-dimm command
166       with the --crypto-erase option to perform this operation.
167
168   OVERWRITE
169       This is invoked using --overwrite option for ndctl sanitize-dimm. The
170       overwrite operation wipes the entire NVDIMM. The operation can take a
171       significant amount of time. NOTE: When the command returns
172       successfully, it just means overwrite has been successfully started,
173       and not that the overwrite is complete. Subsequently, ndctl
174       wait-overwrite can be used to wait for the NVDIMMs that are performing
175       overwrite. Upon successful completion of an overwrite, the WBINVD
176       instruction is issued by the kernel. If both --crypto-erase and
177       --overwrite options are supplied, then crypto-erase is performed before
178       overwrite.
179
180   SECURITY FREEZE
181       This operation does not require a passphrase. This will cause any
182       security command other than a status query to be locked out until the
183       next boot.
184
185   MASTER PASSPHRASE SETUP, UPDATE, and CRYPTO ERASE
186       These operations are similar to the user passphrase enable and update.
187       The only difference is that a different passphrase is used. The master
188       passphrase has no relation to the master key (kek) which is used for
189       encryption of either passphrase.
190
192       Copyright © 2016 - 2022, Intel Corporation. License GPLv2: GNU GPL
193       version 2 http://gnu.org/licenses/gpl.html. This is free software: you
194       are free to change and redistribute it. There is NO WARRANTY, to the
195       extent permitted by law.
196

SEE ALSO:

198       linkndctl:ndctl-setup-passphrase[1],
199       linkndctl:ndctl-remove-passphrase[1]
200
201
202
203                                  08/03/2023             NDCTL-UPDATE-PASSP(1)
Impressum