Blame docs/v2.2.0-ReleaseNotes

Packit Service a9384c
Cryptsetup 2.2.0 Release Notes
Packit Service a9384c
==============================
Packit Service a9384c
Stable release with new experimental features and bug fixes.
Packit Service a9384c
Packit Service a9384c
Cryptsetup 2.2 version introduces a new LUKS2 online reencryption
Packit Service a9384c
extension that allows reencryption of mounted LUKS2 devices
Packit Service a9384c
(device in use) in the background.
Packit Service a9384c
Packit Service a9384c
Online reencryption is a complex feature. Please be sure you
Packit Service a9384c
have a full data backup before using this feature.
Packit Service a9384c
Packit Service a9384c
Changes since version 2.1.0
Packit Service a9384c
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Packit Service a9384c
Packit Service a9384c
LUKS2 online reencryption
Packit Service a9384c
~~~~~~~~~~~~~~~~~~~~~~~~~
Packit Service a9384c
Packit Service a9384c
The reencryption is intended to provide a reliable way to change
Packit Service a9384c
volume key or an algorithm change while the encrypted device is still
Packit Service a9384c
in use.
Packit Service a9384c
Packit Service a9384c
It is based on userspace-only approach (no kernel changes needed)
Packit Service a9384c
that uses the device-mapper subsystem to remap active devices on-the-fly
Packit Service a9384c
dynamically. The device is split into several segments (encrypted by old
Packit Service a9384c
key, new key and so-called hotzone, where reencryption is actively running).
Packit Service a9384c
Packit Service a9384c
The flexible LUKS2 metadata format is used to store intermediate states
Packit Service a9384c
(segment mappings) and both version of keyslots (old and new keys).
Packit Service a9384c
Also, it provides a binary area (in the unused keyslot area space)
Packit Service a9384c
to provide recovery metadata in the case of unexpected failure during
Packit Service a9384c
reencryption. LUKS2 header is during the reencryption marked with
Packit Service a9384c
"online-reencryption" keyword. After the reencryption is finished,
Packit Service a9384c
this keyword is removed, and the device is backward compatible with all
Packit Service a9384c
older cryptsetup tools (that support LUKS2).
Packit Service a9384c
Packit Service a9384c
The recovery supports three resilience modes:
Packit Service a9384c
Packit Service a9384c
  - checksum: default mode, where individual checksums of ciphertext hotzone
Packit Service a9384c
    sectors are stored, so the recovery process can detect which sectors were
Packit Service a9384c
    already reencrypted. It requires that the device sector write is atomic.
Packit Service a9384c
Packit Service a9384c
  - journal: the hotzone is journaled in the binary area
Packit Service a9384c
    (so the data are written twice)
Packit Service a9384c
Packit Service a9384c
  - none: performance mode; there is no protection
Packit Service a9384c
    (similar to old offline reencryption)
Packit Service a9384c
Packit Service a9384c
These resilience modes are not available if reencryption uses data shift.
Packit Service a9384c
Packit Service a9384c
Note: until we have full documentation (both of the process and metadata),
Packit Service a9384c
please refer to Ondrej's slides (some slight details are no longer relevant)
Packit Service a9384c
https://okozina.fedorapeople.org/online-disk-reencryption-with-luks2-compact.pdf
Packit Service a9384c
Packit Service a9384c
The offline reencryption tool (cryptsetup-reencrypt) is still supported
Packit Service a9384c
for both LUKS1 and LUKS2 format.
Packit Service a9384c
Packit Service a9384c
Cryptsetup examples for reencryption
Packit Service a9384c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Packit Service a9384c
Packit Service a9384c
The reencryption feature is integrated directly into cryptsetup utility
Packit Service a9384c
as the new "reencrypt" action (command).
Packit Service a9384c
Packit Service a9384c
There are three basic modes - to perform reencryption (change of already
Packit Service a9384c
existing LUKS2 device), to add encryption to plaintext device and to remove
Packit Service a9384c
encryption from a device (decryption).
Packit Service a9384c
Packit Service a9384c
In all cases, if existing LUKS2 metadata contains information about
Packit Service a9384c
the ongoing reencryption process, following reencrypt command continues
Packit Service a9384c
with the ongoing reencryption process until it is finished.
Packit Service a9384c
Packit Service a9384c
You can activate a device with ongoing reencryption as the standard LUKS2
Packit Service a9384c
device, but the reencryption process will not continue until the cryptsetup
Packit Service a9384c
reencrypt command is issued.
Packit Service a9384c
Packit Service a9384c
Packit Service a9384c
1) Reencryption
Packit Service a9384c
~~~~~~~~~~~~~~~
Packit Service a9384c
This mode is intended to change any attribute of the data encryption
Packit Service a9384c
(change of the volume key, algorithm or sector size).
Packit Service a9384c
Note that authenticated encryption is not yet supported.
Packit Service a9384c
Packit Service a9384c
You can start the reencryption process by specifying a LUKS2 device or with
Packit Service a9384c
a detached LUKS2 header.
Packit Service a9384c
The code should automatically recognize if the device is in use (and if it
Packit Service a9384c
should use online mode of reencryption).
Packit Service a9384c
Packit Service a9384c
If you do not specify parameters, only volume key is changed
Packit Service a9384c
(a new random key is generated).
Packit Service a9384c
Packit Service a9384c
# cryptsetup reencrypt <device> [--header <hdr>]
Packit Service a9384c
Packit Service a9384c
You can also start reencryption using active mapped device name:
Packit Service a9384c
  # cryptsetup reencrypt --active-name <name>
Packit Service a9384c
Packit Service a9384c
You can also specify the resilience mode (none, checksum, journal) with
Packit Service a9384c
--resilience=<mode> option, for checksum mode also the hash algorithm with
Packit Service a9384c
--resilience-hash=<alg> (only hash algorithms supported by cryptographic
Packit Service a9384c
backend are available).
Packit Service a9384c
Packit Service a9384c
The maximal size of reencryption hotzone can be limited by
Packit Service a9384c
--hotzone-size=<size> option and applies to all reencryption modes.
Packit Service a9384c
Note that for checksum and journal mode hotzone size is also limited
Packit Service a9384c
by available space in binary keyslot area.
Packit Service a9384c
Packit Service a9384c
2) Encryption
Packit Service a9384c
~~~~~~~~~~~~~
Packit Service a9384c
This mode provides a way to encrypt a plaintext device to LUKS2 format.
Packit Service a9384c
This option requires reduction of device size (for LUKS2 header) or new
Packit Service a9384c
detached header.
Packit Service a9384c
Packit Service a9384c
  # cryptsetup reencrypt <device> --encrypt --reduce-device-size <size>
Packit Service a9384c
Packit Service a9384c
Or with detached header:
Packit Service a9384c
  # cryptsetup reencrypt <device> --encrypt --header <hdr>
Packit Service a9384c
Packit Service a9384c
3) Decryption
Packit Service a9384c
~~~~~~~~~~~~~
Packit Service a9384c
This mode provides the removal of existing LUKS2 encryption and replacing
Packit Service a9384c
a device with plaintext content only.
Packit Service a9384c
For now, we support only decryption with a detached header.
Packit Service a9384c
Packit Service a9384c
  # cryptsetup reencrypt <device> --decrypt --header <hdr>
Packit Service a9384c
Packit Service a9384c
For all three modes, you can split the process to metadata initialization
Packit Service a9384c
(prepare keyslots and segments but do not run reencryption yet) and the data
Packit Service a9384c
reencryption step by using --init-only option.
Packit Service a9384c
Packit Service a9384c
Prepares metadata:
Packit Service a9384c
  # cryptsetup reencrypt --init-only <parameters>
Packit Service a9384c
Packit Service a9384c
Starts the data processing:
Packit Service a9384c
  # cryptsetup reencrypt <device>
Packit Service a9384c
Packit Service a9384c
Please note, that due to the Linux kernel limitation, the encryption or
Packit Service a9384c
decryption process cannot be run entirely online - there must be at least
Packit Service a9384c
short offline window where operation adds/removes device-mapper crypt (LUKS2) layer.
Packit Service a9384c
This step should also include modification of /etc/crypttab and fstab UUIDs,
Packit Service a9384c
but it is out of the scope of cryptsetup tools.
Packit Service a9384c
Packit Service a9384c
Limitations
Packit Service a9384c
~~~~~~~~~~~
Packit Service a9384c
Most of these limitations will be (hopefully) fixed in next versions.
Packit Service a9384c
Packit Service a9384c
* Only one active keyslot is supported (all old keyslots will be removed
Packit Service a9384c
  after reencryption).
Packit Service a9384c
Packit Service a9384c
* Only block devices are now supported as parameters. As a workaround
Packit Service a9384c
  for images in a file, please explicitly map a loop device over the image
Packit Service a9384c
  and use the loop device as the parameter.
Packit Service a9384c
Packit Service a9384c
* Devices with authenticated encryption are not supported. (Later it will
Packit Service a9384c
  be limited by the fixed per-sector metadata, per-sector metadata size
Packit Service a9384c
  cannot be changed without a new device format operation.)
Packit Service a9384c
Packit Service a9384c
* The reencryption uses userspace crypto library, with fallback to
Packit Service a9384c
  the kernel (if available). There can be some specific configurations
Packit Service a9384c
  where the fallback does not provide optimal performance.
Packit Service a9384c
Packit Service a9384c
* There are no translations of error messages until the final release
Packit Service a9384c
  (some messages can be rephrased as well).
Packit Service a9384c
Packit Service a9384c
* The repair command is not finished; the recovery of interrupted
Packit Service a9384c
  reencryption is made automatically on the first device activation.
Packit Service a9384c
Packit Service a9384c
* Reencryption triggers too many udev scans on metadata updates (on closing
Packit Service a9384c
  write enabled file descriptors). This has a negative performance impact on the whole
Packit Service a9384c
  reencryption and generates excessive I/O load on the system.
Packit Service a9384c
Packit Service a9384c
New libcryptsetup reencryption API
Packit Service a9384c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Packit Service a9384c
The libcryptsetup contains new API calls that are used to setup and
Packit Service a9384c
run the reencryption.
Packit Service a9384c
Packit Service a9384c
Note that there can be some changes in API implementation of these functions
Packit Service a9384c
and/or some new function can be introduced in final cryptsetup 2.2 release.
Packit Service a9384c
Packit Service a9384c
New API symbols (see documentation in libcryptsetup.h)
Packit Service a9384c
* struct crypt_params_reencrypt - reencryption parameters
Packit Service a9384c
Packit Service a9384c
* crypt_reencrypt_init_by_passphrase
Packit Service a9384c
* crypt_reencrypt_init_by_keyring
Packit Service a9384c
  - function to configure LUKS2 metadata for reencryption;
Packit Service a9384c
    if metadata already exists, it configures the context from this metadata
Packit Service a9384c
Packit Service a9384c
* crypt_reencrypt
Packit Service a9384c
  - run the reencryption process (processing the data)
Packit Service a9384c
  - the optional callback function can be used to interrupt the reencryption
Packit Service a9384c
    or report the progress.
Packit Service a9384c
Packit Service a9384c
* crypt_reencrypt_status
Packit Service a9384c
  - function to query LUKS2 metadata about the reencryption state
Packit Service a9384c
Packit Service a9384c
Other changes and fixes
Packit Service a9384c
~~~~~~~~~~~~~~~~~~~~~~~
Packit Service a9384c
* Add optional global serialization lock for memory hard PBKDF.
Packit Service a9384c
  (The --serialize-memory-hard-pbkdf option in cryptsetup and
Packit Service a9384c
  CRYPT_ACTIVATE_SERIALIZE_MEMORY_HARD_PBKDF in activation flag.)
Packit Service a9384c
Packit Service a9384c
  This is an "ugly" optional workaround for a situation when multiple devices
Packit Service a9384c
  are being activated in parallel (like systemd crypttab activation).
Packit Service a9384c
  The system instead of returning ENOMEM (no memory available) starts
Packit Service a9384c
  out-of-memory (OOM) killer to kill processes randomly.
Packit Service a9384c
Packit Service a9384c
  Until we find a reliable way how to work with memory-hard function
Packit Service a9384c
  in these situations, cryptsetup provide a way how to serialize memory-hard
Packit Service a9384c
  unlocking among parallel cryptsetup instances to workaround this problem.
Packit Service a9384c
  This flag is intended to be used only in very specific situations,
Packit Service a9384c
  never use it directly :-)
Packit Service a9384c
Packit Service a9384c
* Abort conversion to LUKS1 with incompatible sector size that is
Packit Service a9384c
  not supported in LUKS1.
Packit Service a9384c
Packit Service a9384c
* Report error (-ENOENT) if no LUKS keyslots are available. User can now
Packit Service a9384c
  distinguish between a wrong passphrase and no keyslot available.
Packit Service a9384c
Packit Service a9384c
* Fix a possible segfault in detached header handling (double free).
Packit Service a9384c
Packit Service a9384c
* Add integritysetup support for bitmap mode introduced in Linux kernel 5.2.
Packit Service a9384c
  Integritysetup now supports --integrity-bitmap-mode option and
Packit Service a9384c
  --bitmap-sector-per-bit and --bitmap-flush-time commandline options.
Packit Service a9384c
Packit Service a9384c
  In the bitmap operation mode, if a bit in the bitmap is 1, the corresponding
Packit Service a9384c
  region's data and integrity tags are not synchronized - if the machine
Packit Service a9384c
  crashes, the unsynchronized regions will be recalculated.
Packit Service a9384c
  The bitmap mode is faster than the journal mode because we don't have
Packit Service a9384c
  to write the data twice, but it is also less reliable, because if data
Packit Service a9384c
  corruption happens when the machine crashes, it may not be detected.
Packit Service a9384c
  This can be used only for standalone devices, not with dm-crypt.
Packit Service a9384c
Packit Service a9384c
* The libcryptsetup now keeps all file descriptors to underlying device
Packit Service a9384c
  open during the whole lifetime of crypt device context to avoid excessive
Packit Service a9384c
  scanning in udev (udev run scan on every descriptor close).
Packit Service a9384c
Packit Service a9384c
* The luksDump command now prints more info for reencryption keyslot
Packit Service a9384c
  (when a device is in-reencryption).
Packit Service a9384c
Packit Service a9384c
* New --device-size parameter is supported for LUKS2 reencryption.
Packit Service a9384c
  It may be used to encrypt/reencrypt only the initial part of the data
Packit Service a9384c
  device if the user is aware that the rest of the device is empty.
Packit Service a9384c
Packit Service a9384c
  Note: This change causes API break since the last rc0 release
Packit Service a9384c
  (crypt_params_reencrypt structure contains additional field).
Packit Service a9384c
Packit Service a9384c
* New --resume-only parameter is supported for LUKS2 reencryption.
Packit Service a9384c
  This flag resumes reencryption process if it exists (not starting
Packit Service a9384c
  new reencryption).
Packit Service a9384c
Packit Service a9384c
* The repair command now tries LUKS2 reencryption recovery if needed.
Packit Service a9384c
Packit Service a9384c
* If reencryption device is a file image, an interactive dialog now
Packit Service a9384c
  asks if reencryption should be run safely in offline mode
Packit Service a9384c
  (if autodetection of active devices failed).
Packit Service a9384c
Packit Service a9384c
* Fix activation through a token where dm-crypt volume key was not
Packit Service a9384c
  set through keyring (but using old device-mapper table parameter mode).
Packit Service a9384c
Packit Service a9384c
* Online reencryption can now retain all keyslots (if all passphrases
Packit Service a9384c
  are provided). Note that keyslot numbers will change in this case.
Packit Service a9384c
Packit Service a9384c
* Allow volume key file to be used if no LUKS2 keyslots are present.
Packit Service a9384c
  If all keyslots are removed, LUKS2 has no longer information about
Packit Service a9384c
  the volume key size (there is only key digest present).
Packit Service a9384c
  Please use --key-size option to open the device or add a new keyslot
Packit Service a9384c
  in these cases.
Packit Service a9384c
Packit Service a9384c
* Print a warning if online reencrypt is called over LUKS1 (not supported).
Packit Service a9384c
Packit Service a9384c
* Fix TCRYPT KDF failure in FIPS mode.
Packit Service a9384c
  Some crypto backends support plain hash in FIPS mode but not for PBKDF2.
Packit Service a9384c
Packit Service a9384c
* Remove FIPS mode restriction for crypt_volume_key_get.
Packit Service a9384c
  It is an application responsibility to use this API in the proper context.
Packit Service a9384c
Packit Service a9384c
* Reduce keyslots area size in luksFormat when the header device is too small.
Packit Service a9384c
  Unless user explicitly asks for keyslots areas size  (either via
Packit Service a9384c
  --luks2-keyslots-size or --offset) reduce keyslots size so that it fits
Packit Service a9384c
  in metadata device.
Packit Service a9384c
Packit Service a9384c
* Make resize action accept --device-size parameter (supports units suffix).