Mispelling fixes.
[platform/upstream/cryptsetup.git] / man / cryptsetup.8
1 .TH CRYPTSETUP "8" "" "cryptsetup" "Maintenance Commands"
2 .SH NAME
3 cryptsetup - setup cryptographic volumes for dm-crypt (including LUKS extension)
4 .SH SYNOPSIS
5
6 .B cryptsetup <options> <action> <action args>
7 .SH DESCRIPTION
8 .PP
9 cryptsetup is used to conveniently setup dm-crypt managed device-mapper mappings.
10 For basic (plain) dm-crypt mappings, there are four operations.
11 .SH ACTIONS
12 These strings are valid for \fB<action>\fR, followed by their \fB<action args>\fR:
13
14 \fIcreate\fR <name> <device>
15 .IP
16 creates a mapping with <name> backed by device <device>.
17
18 \fB<options>\fR can be [\-\-hash, \-\-cipher, \-\-verify-passphrase, \-\-key-file, \-\-key-size, \-\-offset, \-\-skip, \-\-readonly]
19 .PP
20 \fIremove\fR <name>
21 .IP
22 removes an existing mapping <name>.
23 .PP
24 \fIstatus\fR <name>
25 .IP
26 reports the status for the mapping <name>.
27 .PP
28 \fIresize\fR <name>
29 .IP
30 resizes an active mapping <name>.
31
32 If \-\-size (in sectors) is not specified, the size of the underlying block device is used.
33 .PP
34 .br
35 .SH LUKS EXTENSION
36
37 LUKS, Linux Unified Key Setup, is a standard for hard disk encryption. It standardizes a partition header, as well as the format of the bulk data. LUKS can manage multiple passwords, that can be revoked effectively and that are protected against dictionary attacks with PBKDF2. 
38
39 These are valid LUKS actions:
40
41 \fIluksFormat\fR <device> [<key file>]
42 .IP
43 initializes a LUKS partition and sets the initial key, either via prompting or via <key file>.
44
45 \fB<options>\fR can be [\-\-cipher, \-\-verify-passphrase, \-\-key-size, \-\-key-slot,
46 \-\-key-file (takes precedence over optional second argument), \-\-keyfile-size, \-\-use-random | \-\-use-urandom, \-\-uuid].
47
48 .PP
49 \fIluksOpen\fR <device> <name>
50 .IP
51 opens the LUKS partition <device> and sets up a mapping <name> after successful verification of the supplied key material (either via key file by \-\-key-file, or via prompting).
52
53 \fB<options>\fR can be [\-\-key-file, \-\-keyfile-size, \-\-readonly].
54 .PP
55 \fIluksClose\fR <name>
56 .IP
57 identical to \fIremove\fR.
58 .PP
59 \fIluksSuspend\fR <name>
60 .IP
61 suspends active device (all IO operations are frozen) and wipes encryption key from kernel. Kernel version 2.6.19 or later is required.
62
63 After that operation you have to use \fIluksResume\fR to reinstate encryption key (and resume device) or \fIluksClose\fR to remove mapped device.
64
65 \fBWARNING:\fR never try to suspend device where is the cryptsetup binary itself.
66 .PP
67 \fIluksResume\fR <name>
68 .IP
69 Resumes suspended device and reinstates encryption key. You will need provide passphrase
70 identical to \fIluksOpen\fR command (using prompting or key file).
71
72 \fB<options>\fR can be [\-\-key-file, \-\-keyfile-size]
73 .PP
74 \fIluksAddKey\fR <device> [<new key file>]
75 .IP
76 add a new key file/passphrase. An existing passphrase or key file (via \-\-key-file) must be supplied.
77 The key file with the new material is supplied as a positional argument.
78
79 \fB<options>\fR can be [\-\-key-file, \-\-keyfile-size, \-\-new-keyfile-size, \-\-key-slot].
80 .PP
81 \fIluksRemoveKey\fR <device> [<key file>] 
82 .IP
83 remove supplied key or key file from LUKS device
84 .PP
85 \fIluksChangeKey\fR <device> [<new key file>]
86 .IP
87 change existing key file or passphrase. An existing passphrase or key file (via \-\-key-file) must be supplied.
88 The key file with the new material is supplied as a positional argument.
89
90 If no key slot is specified (and there is still free key slot on device) new slot is allocated before the old is purged.
91
92 If \fB\-\-key\-slot\fR option is specified (or there is no free slot) command will overwrite existing slot.
93
94 \fBWARNING:\fR Be sure you have another slot active or header backup when using explicit key slot (so you can
95 unlock the device even after possible media failure during slot swap).
96
97 \fB<options>\fR can be [\-\-key-file, \-\-keyfile-size, \-\-new-keyfile-size, \-\-key-slot].
98 .PP
99 \fIluksKillSlot\fR <device> <key slot number>
100 .IP
101 wipe key with number <key slot> from LUKS device. A remaining passphrase or
102 key file (via \-\-key-file) must be supplied.
103
104 \fB<options>\fR can be [\-\-key-file, \-\-keyfile-size].
105 .PP
106 \fIluksUUID\fR <device>
107 .IP
108 print UUID, if <device> has a LUKS header.
109
110 set new UUID if \fI\-\-uuid\fR option is specified.
111 .PP
112 \fIisLuks\fR <device>
113 .IP
114 returns true, if <device> is a LUKS partition. Otherwise, false.
115 .PP
116 \fIluksDump\fR <device>
117 .IP
118 dumps the header information of a LUKS partition.
119
120 If \-\-dump-master-key option is used, the volume (master) key is dumped instead of keyslot info.
121 Because this information can be used to access encrypted device without passphrase knowledge
122 (even without LUKS header) use this option very carefully.
123
124 Dump with volume key (either printed or stored to file) should be always stored encrypted
125 and on safe place.
126
127 LUKS passphrase or key file is required for volume key dump.
128
129 \fB<options>\fR can be [\-\-dump-master-key, \-\-key-file, \-\-keyfile-size].
130 .PP
131 \fIluksHeaderBackup\fR <device> \-\-header-backup-file <file>
132 .IP
133 Stores binary backup of LUKS header and keyslot areas.
134
135 \fBWARNING:\fR Please note that with this backup file (and old passphrase knowledge) you can decrypt data even if old passphrase was wiped from real device.
136
137 Also note that anti-forensic splitter is not used during manipulation with backup file.
138 .PP
139 \fIluksHeaderRestore\fR <device> \-\-header-backup-file <file>
140 .IP
141
142 Restores binary backup of LUKS header and keyslot areas from specified file.
143
144 \fBWARNING:\fR All the keyslot areas are overwritten, only active keyslots form backup file are available after issuing this command.
145
146 This command allows restoring header if device do not contain LUKS header or if the master key size and data offset in LUKS header on device match the backup file.
147 .PP
148
149 For more information about LUKS, see \fBhttp://code.google.com/p/cryptsetup/wiki/Specification\fR
150
151 .SH loop-AES EXTENSION
152
153 cryptsetup supports mapping of loop-AES encrypted partition using compatible dm-crypt mode.
154
155 .PP
156 \fIloopaesOpen\fR <device> <name> \-\-key-file <keyfile>
157 .IP
158 opens the loop-AES <device> and sets up a mapping <name>.
159
160 N.B. If keyfile is in GPG encrypted format, you have to use \-\-key-file=- and decrypt it before use.
161 gpg --decrypt <keyfile> | cryptsetup loopaesOpen \-\-key-file=- <device> <name>
162
163 Use \-\-key-file to specify proper key length, default compiled-in parameters are visible in \-\-help output.
164
165 \fB<options>\fR can be [\-\-key-file, \-\-key-size, \-\-offset, \-\-readonly].
166 .PP
167 \fIloopaesClose\fR <name>
168 .IP
169 identical to \fIremove\fR.
170 .PP
171 For more information about loop-AES, see \fBhttp://loop-aes.sourceforge.net\fR
172
173 .SH OPTIONS
174 .TP
175 .B "\-\-verbose, \-v"
176 Print more verbose messages.
177 .TP
178 .B "\-\-debug"
179 Run in debug mode with full diagnostic logs.
180 .TP
181 .B "\-\-hash, \-h"
182 For \fIcreate\fR action specifies hash to use for password hashing.
183
184 For \fIluksFormat\fR action specifies hash used in LUKS key setup scheme and volume key digest.
185
186 \fBWARNING:\fR setting hash other than \fBsha1\fR causes LUKS device incompatible with older version of cryptsetup.
187
188 The hash string is passed to libgcrypt, so all hash algorithms are supported
189 (for \fIluksFormat\fR algorithm must provide at least 20 byte long hash).
190 Default is set during compilation, compatible values with old version of cryptsetup are
191 \fB"ripemd160"\fR for \fIcreate\fR action and \fB"sha1"\fR for \fIluksFormat\fR.
192
193 Use \fIcryptsetup \-\-help\fR to show defaults.
194 .TP
195 .B "\-\-cipher, \-c"
196 set cipher specification string.
197
198 Default mode is configurable during compilation,
199 you can see compiled-in default using \fIcryptsetup \-\-help\fR.
200 If not changed, the default is for plain dm-crypt and LUKS mappings
201 "aes-cbc-essiv:sha256".
202
203 For pre-2.6.10 kernels, use "aes-plain" as they don't understand
204 the new cipher spec strings. To use ESSIV, use "aes-cbc-essiv:sha256".
205
206 For XTS mode, kernel version 2.6.24 or more recent is required.
207 Use "aes-xts-plain" cipher specification and set key size to 256 (or 512) bits (see \-s option).
208 .TP
209 .B "\-\-verify-passphrase, \-y"
210 query for passwords twice. Useful when creating a (regular) mapping for the first time, or when running \fIluksFormat\fR.
211 .TP
212 .B "\-\-key-file, \-d"
213 use file as key material.
214
215 With LUKS, key material supplied in key files via \-d are always used for existing passphrases,
216 except in \fIluksFormat\fR action where \-d is equivalent to positional key file argument.
217 If you want to set a new key via a key file, you have to use a positional arg to \fIluksAddKey\fR.
218
219 If the key file is "-", stdin will be used. With the "-" key file reading will
220 not stop when new line character is detected. See section \fBNOTES ON PASSWORD PROCESSING\fR for more information.
221 .TP
222 .B "\-\-keyfile-size, \-l \fIvalue\fR"
223 Limits read from keyfile to \fIvalue\fR bytes.
224 Usable together with all comands using key file.
225 .TP
226 .B "\-\-new-keyfile-size  \fIvalue\fR"
227 Limits read from new keyfile to \fIvalue\fR bytes in \fIluksAddKey\fR when adding new key file.
228 Default is exhaustive read from key file.
229 .TP
230 .B "\-\-master-key-file"
231 Use pre-generated master key stored in file. For \fIluksFormat\fR it allows LUKS header reformatting with the same master key (if all other parameters are the same existing encrypted data remains intact).
232
233 For \fIluksAddKey\fR it allows adding new passphrase with only master key knowledge.
234 .TP
235 .B "\-\-dump-master-key"
236 For \fIluksDump\fR it allows LUKS header dump including volume (master) key.
237 Use with care (this information allows access to device without passphrase knowledge).
238
239 See \fIluksDump\fR for more info.
240 .TP
241 .B "\-\-use-random"
242 .TP
243 .B "\-\-use-urandom"
244 For \fIluksFormat\fR it defines which kernel random number generator will be used for long-term key (volume key).
245
246 See \fBNOTES ON RNG\fR for more information. Use \fIcryptsetup \-\-help\fR to show default RNG.
247 .TP
248 .B "\-\-key-slot, \-S"
249 For LUKS operations that add key material, this options allows you to specify which key slot is selected for the new key. This option can be used for \fIluksFormat\fR and \fIluksAddKey\fR.
250 .TP
251 .B "\-\-key-size, \-s"
252 set key size in bits.
253
254 Has to be a multiple of 8 bits. The key size is limited by the used cipher. See output of /proc/crypto for more information.
255 Can be used for \fIcreate\fR or \fIluksFormat\fR, all other LUKS actions will use key-size specified by the LUKS header.
256 Default is set during compilation, if not changed it is 256 bits.
257
258 Use \fIcryptsetup \-\-help\fR to show defaults.
259 .TP
260 .B "\-\-size, \-b"
261 force the size of the underlying device in sectors.
262 This option is only relevant for \fIcreate\fR and \fIresize\fR action.
263 .TP
264 .B "\-\-offset, \-o"
265 start offset in the backend device (in 512-byte sectors).
266 This option is only relevant for \fIcreate\fR action.
267 .TP
268 .B "\-\-skip, \-p"
269 how many sectors of the encrypted data to skip at the beginning. This is different from the \-\-offset options with respect to IV calculations. Using \-\-offset will shift the IV calculation by the same negative amount. Hence, if \-\-offset \fIn\fR, sector \fIn\fR will be the first sector on the mapping with IV \fI0\fR. Using \-\-skip would have resulted in sector \fIn\fR being the first sector also, but with IV \fIn\fR.
270 This option is only relevant for \fIcreate\fR action.
271 .TP
272 .B "\-\-readonly"
273 set up a read-only mapping.
274 .TP
275 .B "\-\-iter-time, \-i"
276 The number of milliseconds to spend with PBKDF2 password processing. This option is only relevant to the LUKS operations as \fIluksFormat\fR or \fIluksAddKey\fR.
277 Note that 0 means default.
278 .TP
279 .B "\-\-batch-mode, \-q"
280 Do not ask for confirmation. Use with care! This option is only relevant for \fIluksFormat\fR, \fIluksAddKey\fR, \fIluksRemoveKey\fR or \fIluksKillSlot\fR.
281 .TP
282 .B "\-\-timeout, \-t"
283 The number of seconds to wait before timeout. This option is relevant every time a password is asked, like \fIcreate\fR, \fIluksOpen\fR, \fIluksFormat\fR or \fIluksAddKey\fR. It has no effect if used in conjunction with \-\-key-file.
284 .TP
285 .B "\-\-tries, \-T"
286 How often the input of the passphrase shall be retried. This option is relevant every time a password is asked, like \fIcreate\fR, \fIluksOpen\fR, \fIluksFormat\fR or \fIluksAddKey\fR. The default is 3 tries.
287 .TP
288 .B "\-\-align-payload=\fIvalue\fR"
289 Align payload at a boundary of \fIvalue\fR 512-byte sectors. This option is relevant for \fIluksFormat\fR.
290 If not specified, cryptsetup tries to use topology info provided by kernel for underlying device to get optimal alignment.
291 If not available (or calculated value is multiple of default) data is by default aligned to 1 MiB boundary (2048 512-byte sectors).
292 .TP
293 .B "\-\-uuid=\fIUUID\fR"
294 Use provided \fIUUID\fR in \fIluksFormat\fR command instead of generating new one or change existing UUID in \fIluksUUID\fR command.
295
296 The UUID must be provided in standard UUID format (e.g. 12345678-1234-1234-1234-123456789abc).
297 .TP
298 .B "\-\-version"
299 Show the version.
300
301 .SH NOTES ON PASSWORD PROCESSING
302 \fIFrom a terminal\fR: Password processing is new-line sensitive, meaning the reading will stop after encountering \\n. It will process the read material (without newline) with the default hash or the hash given by \-\-hash. After hashing, it will be cropped to the key size given by \-s.
303
304 \fIFrom stdin\fR: Reading will continue until EOF (so using e.g. /dev/random as stdin will not work), with the trailing newline stripped. After that the read data will be hashed with the default hash or the hash given by \-\-hash and the result will be cropped to the keysize given by \-s. If "plain" is used as an argument to the hash option, the input data will not be hashed.
305 Instead, it will be zero padded (if shorter than the keysize) or truncated (if longer than the keysize) and used directly as the key. No warning will be given if the amount of data read from stdin is less than the keysize.
306
307 \fIFrom a key file\fR: It will be cropped to the size given by \-s. If there is insufficient key material in the key file, cryptsetup will quit with an error.
308
309 If \-\-key-file=- is used for reading the key from stdin, no trailing newline is stripped from the input. Without that option, cryptsetup strips trailing newlines from stdin input.
310 .SH NOTES ON PASSWORD PROCESSING FOR LUKS
311 LUKS uses PBKDF2 to protect against dictionary attacks (see RFC 2898).
312
313 LUKS will always do an exhaustive password reading. Hence, password can not be read from /dev/random, /dev/zero or any other stream that does not terminate.
314
315 For any password creation action (luksAddKey, or luksFormat), the user may specify how much the time the password processing should consume.
316 Increasing the time will lead to a more secure password, but also will take luksOpen longer to complete. The default setting of one second is sufficient for good security.
317 .SH INCOHERENT BEHAVIOUR FOR INVALID PASSWORDS/KEYS
318 LUKS checks for a valid password or key when an encrypted partition is unlocked. Thus the luksOpen action fails with invalid password or key, contrary to the plain dm-crypt create action.
319
320 Please also be sure that you are using the same keyboard and language setting as during device format.
321 .SH NOTES ON SUPPORTED CIPHERS, MODES, HASHES AND KEY SIZES
322 The available combinations of ciphers, modes, hashes and key sizes depend on kernel support. See /proc/crypto for a list of available options. You might need to load additional kernel crypto modules in order to get more options.
323
324 For \-\-hash option all algorithms supported by gcrypt library are available.
325 .SH NOTES ON PASSWORDS
326 Mathematics can't be bribed. Make sure you keep your passwords safe. There are a few nice tricks for constructing a fallback, when suddenly out of (or after being) blue, your brain refuses to cooperate. These fallbacks are possible with LUKS, as it's only possible with LUKS to have multiple passwords.
327 .SH NOTES ON RNG
328 Random Number Generator (RNG) used in cryptsetup always uses kernel RNG without
329 any modifications or additions to data stream procudes by kernel (like internal
330 random pool operations or mixing with the other random sources).
331
332 There are two types of randomness cryptsetup/LUKS needs. One type (which always
333 uses /dev/urandom) is used for salt, AF splitter and for wiping removed
334 keyslot.
335
336 Second type is used for volume (master) key. You can switch between
337 using /dev/random and /dev/urandom  here, see \fP--use-random\fR and \fP--use-urandom\fR
338 options. Using /dev/random on system without enough entropy sources
339 can cause \fPluksFormat\fR to block until the requested amount of random data is gathered.
340 See \fPurandom(4)\fR for more information.
341 .SH NOTES ON LOOPBACK DEVICE USE
342 Cryptsetup is usually used directly over block device (like disk partition or LVM volume).
343 However if the device argument is file, cryptsetup tries to allocate loopback device
344 and map it into this file. This mode requires Linux kernel 2.6.25 or more recent which
345 supports loop autoclear flag (loop device is cleared on last close automatically).
346
347 When device mapping is active, you can see loop backing file in status command output.
348 Also see losetup(8).
349 .SH AUTHORS
350 cryptsetup is written by Christophe Saout <christophe@saout.de>
351 .br
352 LUKS extensions, and man page by Clemens Fruhwirth <clemens@endorphin.org>
353 .SH DEPRECATED ACTIONS
354 .PP
355 The \fIreload\fR action is no longer supported.
356 Please use \fIdmsetup(8)\fR if you need to
357 directly manipulate with the device mapping table.
358 .PP
359 The \fIluksDelKey\fR was replaced with \fIluksKillSlot\fR.
360 .PP
361 .SH "REPORTING BUGS"
362 Report bugs to <dm-crypt@saout.de> or Issues section on LUKS website.
363 Please attach output of failed command with added \-\-debug option.
364 .SH COPYRIGHT
365 Copyright \(co 2004 Christophe Saout
366 .br
367 Copyright \(co 2004-2006 Clemens Fruhwirth
368 .br
369 Copyright \(co 2009-2011 Red Hat, Inc.
370
371 This is free software; see the source for copying conditions.  There is NO
372 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
373 .SH "SEE ALSO"
374
375 LUKS website, \fBhttp://code.google.com/p/cryptsetup/\fR