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

NAME

6       ndctl-remove-passphrase - Stop a DIMM from locking at power-loss and
7       requiring a passphrase to access media
8

SYNOPSIS

10       ndctl remove-passphrase <nmem0> [<nmem1>..<nmemN>] [<options>]
11

DESCRIPTION

13       Search the user keyring for an encrypted passphrase for the NVDIMM in
14       question. If not found, attempt to load the passphrase blob. After
15       disabling the passphrase, remove the key-ID from the keyring as well as
16       the passphrase blob from the file system.
17

OPTIONS

19       <dimm>
20           A nmemX device name, or a dimm id number. Restrict the operation to
21           the specified dimm(s). The keyword all can be specified to indicate
22           the lack of any restriction, however this is the same as not
23           supplying a --dimm option at all.
24
25       -b, --bus=
26           A bus id number, or a provider string (e.g. "ACPI.NFIT"). Restrict
27           the operation to the specified bus(es). The keyword all can be
28           specified to indicate the lack of any restriction, however this is
29           the same as not supplying a --bus option at all.
30
31       -v, --verbose
32           Emit debug messages.
33
34       -m, --master-passphrase
35           Indicates that we are managing the master passphrase instead of the
36           user passphrase.
37

THEORY OF OPERATION

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

SEE ALSO:

186       linkndctl:ndctl-setup-passphrase[1],
187       linkndctl:ndctl-update-passphrase[1]
188
189
190
191                                  08/03/2023             NDCTL-REMOVE-PASSP(1)
Impressum