mirror of
https://git.adityakumar.xyz/blog.git
synced 2024-11-21 23:22:53 +00:00
add luks
This commit is contained in:
parent
0395544a0f
commit
0cc297505d
1 changed files with 95 additions and 0 deletions
95
content/post/luks.md
Normal file
95
content/post/luks.md
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
---
|
||||||
|
title: "LUKS Encryption"
|
||||||
|
date: 2023-12-22T16:24:31+05:30
|
||||||
|
lastmod: 2023-12-22T16:24:31+05:30
|
||||||
|
draft: false
|
||||||
|
keywords: [luks linux]
|
||||||
|
description: ""
|
||||||
|
tags: [luks linux]
|
||||||
|
categories: [linux]
|
||||||
|
author: "Aditya"
|
||||||
|
|
||||||
|
# You can also close(false) or open(true) something for this content.
|
||||||
|
# P.S. comment can only be closed
|
||||||
|
comment: false
|
||||||
|
toc: true
|
||||||
|
autoCollapseToc: false
|
||||||
|
postMetaInFooter: true
|
||||||
|
hiddenFromHomePage: false
|
||||||
|
# You can also define another contentCopyright. e.g. contentCopyright: "This is another copyright."
|
||||||
|
contentCopyright: false
|
||||||
|
reward: false
|
||||||
|
mathjax: false
|
||||||
|
mathjaxEnableSingleDollar: false
|
||||||
|
mathjaxEnableAutoNumber: false
|
||||||
|
|
||||||
|
# You unlisted posts you might want not want the header or footer to show
|
||||||
|
hideHeaderAndFooter: false
|
||||||
|
|
||||||
|
# You can enable or disable out-of-date content warning for individual post.
|
||||||
|
# Comment this out to use the global config.
|
||||||
|
#enableOutdatedInfoWarning: false
|
||||||
|
|
||||||
|
flowchartDiagrams:
|
||||||
|
enable: false
|
||||||
|
options: ""
|
||||||
|
|
||||||
|
sequenceDiagrams:
|
||||||
|
enable: false
|
||||||
|
options: ""
|
||||||
|
|
||||||
|
---
|
||||||
|
I've been using LUKS for quite a while so thought might as well put it here.
|
||||||
|
<!--more-->
|
||||||
|
## LUKS Explained
|
||||||
|
LUKS (Linux Unified Key Setup) encryption refers to a secure, flexible, and robust full-disk encryption system designed for Linux operating systems. It provides an additional layer of security by encrypting the entire storage device or partition instead of just individual files or directories within the file system hierarchy. This makes it much more difficult for unauthorized access or data theft, ensuring privacy and protection against potential threats from malicious actors.
|
||||||
|
|
||||||
|
In simple terms, LUKS creates a secure encryption key that is required to decrypt your encrypted storage device before you can use it normally. The process of turning on this security feature starts with initializing the disk partition you want to protect using the 'cryptsetup' command line tool. Once initialized, you will need to create a strong passphrase or enter the encryption key which is used for unlocking the encrypted data later when you need access to your system.
|
||||||
|
|
||||||
|
LUKS uses AES (Advanced Encryption Standard) and two other ciphers - Serpent and Twofish as its primary options, although users can choose different encryption algorithms based on their requirements and preferences. The LUKS standard also offers several modes of operation including:
|
||||||
|
|
||||||
|
1. XTS Mode with a 512-bit key size: This is the default mode for LUKS, providing strong security without sacrificing performance. It uses the AES block cipher in an XEX (XOR Encrypted eXchange) mode and combines two keys to encrypt each data block.
|
||||||
|
|
||||||
|
2. CBC Mode with a 512-bit key size: This is an alternative mode that employs standard Cipher Block Chaining encryption. While it offers slightly less security compared to XTS, its performance may be faster on older hardware since the algorithm is simpler and requires fewer computational resources.
|
||||||
|
|
||||||
|
3. LRW Mode with a 512-bit key size: This provides an option for compatibility with Microsoft Windows BitLocker Drive Encryption (BDE). It uses AES in Cipher Feedback mode, which ensures that changes to one data block do not affect other blocks' encryption state.
|
||||||
|
|
||||||
|
It is essential to note that once a storage device or partition has been encrypted using LUKS, it will remain encrypted even if the system crashes or shuts down unexpectedly without saving the unlocking key properly. In this case, you would need the passphrase or recovery keys (optional) to regain access and recover your data.
|
||||||
|
|
||||||
|
## LUKS2 over LUKS
|
||||||
|
Although LUKS was initially introduced with the intention of providing an easy-to-use, flexible and secure mechanism to protect sensitive information stored on hard drives or other storage devices, over time, two main versions have been developed – LUKS1 (the original version) and LUKS2 (the newer enhanced version).
|
||||||
|
|
||||||
|
LUKS2 (Linux Unified Key Setup version 2) is a cryptographic disk encryption system designed specifically for Linux operating systems, which provides an extra layer of security by encrypting the data stored on your hard drive or other storage devices. It was created to improve upon its predecessor, LUKS1, by offering better usability and more advanced features like key wrapping and full-disk encryption capabilities.
|
||||||
|
|
||||||
|
LUKS2 functions as a framework that provides a standardized method of creating and managing encrypted partitions on your system. When you use LUKS2 to encrypt your hard drive or partition, the data stored within it is encoded with complex algorithms making it unreadable without access to its encryption key. This means that even if someone gains physical access to your storage device, they will not be able to read the information unless they have the correct decryption key.
|
||||||
|
|
||||||
|
LUKS1 has several limitations:
|
||||||
|
|
||||||
|
- **Weak key management:** Luks1 uses a fixed-size key for all devices, which can be problematic in scenarios where multiple users need to access the same device or when data ownership changes.
|
||||||
|
- **No support for multi-factor authentication (MFA):** LUKS1 does not provide any built-in MFA capabilities, which can be a significant security concern in today's threat landscape.
|
||||||
|
|
||||||
|
LUKS2 offers several advantages over LUKS1:
|
||||||
|
|
||||||
|
- **Better performance:** One of the main improvements in LUKS2 is the reduced performance impact on the system during encryption and decryption processes. With LUKS1, there was a noticeable slowdown in system performance when dealing with encrypted disks. In contrast, LUKS2 has been optimized to provide better performance without compromising security, making it more suitable for everyday use.
|
||||||
|
|
||||||
|
- **Improved security:** LUKS2 includes several new security features compared to LUKS1. For instance, the new version supports per-file encryption and decryption, allowing users to encrypt individual files or directories rather than entire disks. This can be particularly useful when dealing with sensitive data that does not require full disk encryption. Additionally, LUKS2 has been updated to support the latest cryptographic algorithms, such as ChaCha20, which provides enhanced security compared to older ciphers like AES.
|
||||||
|
|
||||||
|
- **Multi-factor authentication (MFA):** LUKS2 provides built-in MFA capabilities through the use of hardware security tokens or other trusted authenticators, enhancing overall security posture.
|
||||||
|
|
||||||
|
- **Enhanced support for larger drives:** LUKS2 has been optimized for modern storage devices (e.g., SSDs) with higher capacities, ensuring faster encryption/decryption times and better performance under heavy workloads.
|
||||||
|
|
||||||
|
- **Key Management:** Another significant advantage of LUKS2 is its improved key management capabilities. In comparison to LUKS1's limited key handling options (where you either needed to remember your passphrase or use a single keyfile), LUKS2 provides more flexibility with multiple key slots and the ability to use different keys for each slot, thus improving data security and making it easier to rotate encryption keys. This feature helps in better management of encryption keys and reduces the risk associated with storing sensitive information on a computer system.
|
||||||
|
|
||||||
|
- **Flexible key sizes:** LUKS2 supports flexible key sizes (e.g., 128-bit, 256-bit), enabling more secure key storage and reducing the risk of key exposure. It also allows multiple users to share a single device while maintaining individual access control.
|
||||||
|
|
||||||
|
- **Compatibility:** As LUKS1 was developed years before LUKS2, there is often compatibility issue when working across different Linux distributions. In contrast, LUKS2 has been designed to be more compatible with multiple versions of Linux and various other operating systems like FreeBSD, NetBSD, and OpenSolaris, thus making it an ideal choice for users who need their encryption solution to work seamlessly across diverse platforms.
|
||||||
|
|
||||||
|
- **Integration:** One of the key selling points of LUKS2 is its integration with full disk encryption tools such as dm-crypt (Device Mapper Cryptographic Volume Manager) and cryptsetup, which are used by most Linux distributions for handling encrypted partitions. This makes it easier to implement and maintain encryption on multiple systems using the same encryption methodology.
|
||||||
|
|
||||||
|
- **Efficiency:** LUKS2 provides better performance in terms of encryption and decryption processes compared to its predecessor. While both versions are known to have minimal impact on system performance when idle, LUKS1's XTS mode can be a bit slower during data read or write operations due to the requirement for additional metadata processing that isn't present in AES-XTS encryption used by LUKS2.
|
||||||
|
|
||||||
|
- **Enhanced support for larger drives:** LUKS2 has been optimized for modern storage devices (e.g., SSDs) with higher capacities, ensuring faster encryption/decryption times and better performance under heavy workloads.
|
||||||
|
|
||||||
|
- **Backwards compatibility:** Although LUKS2 is not directly compatible with LUKS1, you can use the `cryptsetup` command alongside the original LUKS for a transition period. This allows users to gradually migrate their systems from LUKS1 to LUKS2 without losing access to existing encrypted volumes or experiencing any performance issues during the transition.
|
||||||
|
|
||||||
|
LUKS serves as an essential tool in protecting data stored on your storage devices by providing powerful encryption capabilities with enhanced flexibility, compatibility, and security features. Its integration into popular Linux distributions and ease of use make it a valuable addition to any system administrator's arsenal when securing sensitive information.
|
Loading…
Reference in a new issue