meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:fs:luks [2015/03/29 23:17] – niziak | linux:fs:luks [2021/02/17 08:51] (current) – niziak | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | [[https:// | + | [[https:// |
| ====== LUKS on LVM vs LVM on LUKS ====== | ====== LUKS on LVM vs LVM on LUKS ====== | ||
| Line 8: | Line 8: | ||
| - good for multiuser environment | - good for multiuser environment | ||
| - root system can be on unencrypted partition (no password to boot). The same can be achieved with LVM on LUKS on separate partition. | - root system can be on unencrypted partition (no password to boot). The same can be achieved with LVM on LUKS on separate partition. | ||
| + | - Volumes can span on multiple drives | ||
| + | - LVM cache is caching encrypted data (no unecnrypted data leak to cache device). | ||
| + | - one common SSD cache device can be used if you have encrypted (data) and unecrypted (system) partitions on LVM | ||
| LVM on LUKS (preffered) | LVM on LUKS (preffered) | ||
| Line 15: | Line 18: | ||
| - one unlock of block device give access to all LVM volume created on it. | - one unlock of block device give access to all LVM volume created on it. | ||
| - it is easier to change volumes sizes without touching encryption layer | - it is easier to change volumes sizes without touching encryption layer | ||
| + | - LVM cache is caching decrypted data | ||
| + | - workaround: encrypt also cache device, but for mixed setup (unencrypted and crypted partition) it is need to divide cache device into 2 volumes to serve unencrypted cache for system (no need to provide unlock password). | ||
| + | ====== Performance ====== | ||
| + | IT depends on HW acceleration | ||
| < | < | ||
| cryptsetup benchmark | cryptsetup benchmark | ||
| </ | </ | ||
| + | Best choice for AMD A4-5300 APU: | ||
| + | < | ||
| + | # Tests are approximate using memory only (no storage IO). | ||
| + | PBKDF2-sha1 | ||
| + | PBKDF2-sha256 | ||
| + | PBKDF2-sha512 | ||
| + | PBKDF2-ripemd160 | ||
| + | # Algorithm | Key | Encryption | Decryption | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | |||
| ====== Advices ====== | ====== Advices ====== | ||
| - | Cipher: | + | == Cipher |
| * AES well known, accelerated by common HW | * AES well known, accelerated by common HW | ||
| + | * Twofish (faster SW implementation comparing to AES) | ||
| - | Chaining mode: | + | == Chaining mode == |
| - | * CBC | + | * CBC. Every block will be XOR’ed with the encrypted previous block. This effectively means that every block depends on the output of the previous block. |
| - | every block will be XOR’ed with the encrypted previous block. This effectively means that every block depends on the output of the previous block. | + | |
| * EBC (Electronic Codebook), each block is encrypted with the same key | * EBC (Electronic Codebook), each block is encrypted with the same key | ||
| - | * XTS | + | * XTS. Is counter-oriented chaining mode. It's an evolution of XEX (actually: " |
| - | is counter-oriented chaining mode. It's an evolution of XEX (actually: " | + | == IV (Initalisation Vector) calculation |
| - | + | ||
| - | IV (Initalisation Vector) calculation | + | |
| * plain | * plain | ||
| * plain64 | * plain64 | ||
| - | + | Is an IV generation mechanism that simply passes the 64-bit sector index directly to the chaining algorithm as the IV. plain truncates that to 32-bit. Certain chaining modes such as XTS don't need the IV to be unpredictable, | |
| - | is an IV generation mechanism that simply passes the 64-bit sector index directly to the chaining algorithm as the IV. plain truncates that to 32-bit. Certain chaining modes such as XTS don't need the IV to be unpredictable, | + | |
| * ESSIV | * ESSIV | ||
| Line 68: | Line 87: | ||
| * increase number of iterations (default it is set to 1000 ms) | * increase number of iterations (default it is set to 1000 ms) | ||
| - | ===== Setup /dev/sda5 as LUKS device: | + | ===== Fill with random data ===== |
| + | <code bash> | ||
| + | or (faster, only writes). Block size for dd has to be big, to avoid re-reading data from encrypted block. | ||
| < | < | ||
| + | cryptsetup open --type plain /dev/sda5 tempcontainer | ||
| + | dd if=/ | ||
| + | cryptsetup luksClose tempcontainer | ||
| + | </ | ||
| + | |||
| + | ===== Setup /dev/sda5 as LUKS device: ===== | ||
| + | <code bash> | ||
| cryptsetup luksFormat -y -v /dev/sda5 | cryptsetup luksFormat -y -v /dev/sda5 | ||
| </ | </ | ||
| - | will create by default **aes-xts-plain64** | + | will create by default **aes-xts-plain64** |
| - | < | + | Another examples: |
| - | cryptsetup luksFormat -c aes-cbc-plain -s 256 /dev/sda5 | + | |
| - | cryptsetup luksFormat -c aes-cbc-plain -s 256 --hash sha1 -i 2000 --use-random /dev/sda5 | + | < |
| - | cryptsetup luksFormat -c aes-cbc-essiv: | + | cryptsetup luksFormat --cipher |
| - | cryptsetup -y -v -c aes-xts-plain: | + | cryptsetup luksFormat --cipher |
| - | cryptsetup -y -v -c aes-xts-plain: | + | cryptsetup luksFormat --cipher |
| + | cryptsetup | ||
| + | cryptsetup | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | cryptsetup --verify-passphrase | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | cryptsetup luksFormat --cipher | ||
| </ | </ | ||
| Line 93: | Line 130: | ||
| < | < | ||
| - | cryptsetup status sda5 cryptsetup luksDump /dev/sda5 | + | cryptsetup status sda5 |
| + | cryptsetup luksDump /dev/sda5 | ||
| </ | </ | ||
| Line 101: | Line 139: | ||
| cryptsetup luksClose sda5 | cryptsetup luksClose sda5 | ||
| </ | </ | ||
| + | |||
| + | ====== References ====== | ||
| + | [[security.stackexchange.com/ | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | |||