34.Key AbstractDigital

Digital security is getting stronger, so criminals and law enforcement alike may be more willing to physically take your laptop or storage device to gain access to your data. It's possible, however, to protect yourself against this invasion of privacy thanks to encryption.

This article will discuss disk encryption, its uses and types, and its advantages and disadvantages. We will also show you how to encrypt a Linux hard drive and the various Linux encryption methods at your disposal.

What Is Disk Encryption?

Encryption is the process of converting textual data into a secret code (a.k.a. ciphertext) for secure communication between multiple parties. Users can encrypt files or messages so that they are only accessible to other selected clients using shared protocols and encryption algorithms.

Types of Encryption

The challenge of encrypting data has been tackled by some of the world’s brightest minds for generations. Leading intelligence agencies, cybersecurity consultant firms, and computer scientists have dealt with this issue, developing various encryption types and standards. The most prominent ones include the following:

  • Public Key
  • DES
  • AES
  • RSA
  • Post-Quantum
  • Homomorphic
  • Elliptic-Curve

Uses of Encryption

Developers and IT experts most commonly use cryptographic systems for the following applications:

  • Network monitoring tools
  • CASB (Cloud access security brokers)
  • Password managers
  • NGFS (Next-gen firewalls)
  • WAF (Web app firewalls)
  • VPN (Virtual private networks)
  • WEP (Wired Equivalent Privacy) and WPA (Wi-Fi Protected Access) wireless standards

Data-at-Rest Encryption vs. Full-Disk Encryption in Linux

A data-at-rest encryption program encrypts and decrypts data while it is being written to or read from a disk partition, block device, or directory. DVDs, hard drives, and flash drives are all examples of block devices.

It is important to view data-at-rest encryption as an adjunct to existing security mechanisms within the operating system, particularly regarding user-based access control and network access security.

Full disk encryption (as its name suggests) encrypts the whole disk, functioning below the filesystem layer. In a nutshell, it's block device encryption. This means the kernel’s encryption module translates the data when reading blocks from disks (or writing them).

When it comes to device-mapper encryption in Linux, dm-crypt is the default solution as it provides complete control over partitioning and key management. Dm-crypt is managed through cryptsetup, while LUKS (Linux Unified Key Setup, detailed later on) is an additional frontend layer that simplifies all cryptographic processes for dm-crypt.

Need for Encryption

Linux EncryptionServers are often housed in well-fortified data centers. This, coupled with the fact that Full Drive Encryption (FDE) only protects data at rest and physical servers are usually run for extended periods without any rest, lends credence to the argument that encryption is unnecessary.

However, every drive will leave the data center to be repaired or disposed of sooner or later. By protecting your old drives with encryption, you avoid them showing up on the dark web while still carrying customer data. An encrypted drive is easy to crypto-erase if it is still functional, and if not, the data remains inaccessible without the encryption key.

Further, with the increased attention to international standards such as the GDPR and California’s Consumer Privacy Act, it is prudent to encrypt everything, everywhere, at all times.

Encryption Dos and Don’ts

Here are some things you should make sure TO DO when it comes to encrypting your data:

  • Ensure the drive runs properly beforehand
  • Test on a pilot group
  • Check for any driver or BIOS-related interference
  • Consider the authentication options
  • Include removable media support
  • Consider Active Directory integration
  • Check the supported platforms

And here are a few things you should NOT DO:

  • Overlook key management
  • Jump in too quickly
  • Underestimate deployment time
  • Expect full user acceptance

Should You Encrypt Your Linux Partition?

Encrypting your Linux disk has the following benefits:

  • Keeping sensitive data secure from unauthorized access
  • Preventing remote surveillance
  • Ensuring that sensitive corporate information is not stolen
  • Keeping personal data safe from theft and loss

Disk encryption also has a few negative consequences, such as:

  • Throttling system performance
  • Making it almost impossible to recover the entire system in case of sudden failure
  • Increasing the difficulty of data recovery

Advantages of Full Disk Encryption

The full disk encryption (FDE) method encrypts drives at the hardware level, significantly enhancing data protection. Let’s look at some of its major advantages.

Improved Data Security

Strengthened data security is, without question, one of the most important benefits. Drives on your PCs are encrypted using robust encryption algorithms, protecting all the data stored on them. Even when a drive is removed from the current computer and put into another, the drive data is still inaccessible if a correct key is not used.

Automatic Encryption

Full disk encryption (FDE) encrypts all data from the moment it is stored on a hard drive instead of just encrypting a folder or a file. Essentially, this process of encryption is automatic. In this respect, it's far more convenient than file or folder encryption, which requires manually selecting the files or folders you want to encrypt.

Limiting User Mistakes

In addition to fully automatic encryption, another advantage of FDE is its ability to avoid encryption errors. Users are bound to make mistakes to some extent, as we all know. In the case of FDE, this can be avoided.

Disadvantages of Full Disk Encryption

FDE also has a few drawbacks. We will talk about the major ones below.

In-Transit Data Not Protected

Data sent through emails or shared between devices are not protected by FDE and could potentially be accessed by unauthorized third parties.

Performance Impact

When reading a drive protected by full disk encryption, you are prompted to enter the authentication key each time. This process may slow your computer down.

Data Recovery Complications

Like other kinds of encryption, disk data recovery is complicated by full disk encryption. This is hardly surprising if you think about it. It would make no sense to encrypt data if it could be recovered quickly.

Linux Disk Encryption Options

There are several options at your disposal when it comes to encrypting your Linux disk. Let’s briefly look through some of our favorites.

DM-Crypt

It is possible to mount encrypted file systems using Dm-crypt, a Linux kernel-level encryption tool. An operating system uses mounting to access a file system by attaching it to a directory (mount point).

VeraCrypt

With VeraCrypt, you can perform on-the-fly encryption (OTFE) for free. With the software, you can create a virtual encrypted disk within a file that works just like an actual disk. As well as encrypting a partition, it can authenticate the entire storage device before booting.

Cryptmount

The Cryptmount utility allows users to access encrypted filesystems without having root privileges on GNU/Linux systems. You will need Linux 2.6 or higher to run it. The program is capable of handling both encrypted partitions and encrypted files.

eCryptfs

Enterprise Cryptographic Filesystem (eCryptfs) allows encrypting disks on Linux. Unlike dm-crypt, which offers a block device encryption layer, eCryptfs provides an actual stacked cryptographic file system.

loop-AES

The loop-AES package encrypts both file systems and swap partitions quickly and transparently. Loop-AES is suitable for encrypting not only disk partitions but swap space, removable media, and other devices. Various measures are available to strengthen encryption, including passphrase seeds, multiple hash iterations, MD5 IV, and alternating encryption keys.

Linux Unified Key Setup

The Linux Unified Key Setup, or LUKS for short, provides a generic key store. This is an area of a hard drive dedicated to storing keys, which can be unlocked using multiple passphrases. 

Here’s what you need to do to encrypt your Linux partition with LUKS:

  1. Install cryptsetup-luks. On CentOS or RHEL, run the following command: # yum install cryptsetup-luks. On Debian or Ubuntu, run # apt-get install cryptsetup
  2. Configure the partition. 
    1. First, list all of the partitions using # fdisk -l and # blkid
    2. Then, use #  cryptsetup luksFormat to prepare the partition for encryption. This command will wipe the partition clean.
    3. Set up a logical device-mapper device using # cryptsetup luksOpen. Using this command, you will initialize the volume and set an initial key.
    4. Check the status of the encryption with # cryptsetup luksDump
  3. Format the partition.
    1. Use the following command to allocate block data with zeros
    2. Format the partition to your chosen filesystem
    3. Mount the system

Disk Encryption Security Concerns

EncryptionDespite our best efforts, data encryption will not be able to provide complete protection for all of our security needs. As technology advances, increasingly secure encryption systems/algorithms are developed, but attackers' techniques continue to improve.

Encryption systems can be attacked in three main ways:

  1. Using keyloggers and brute force methods to find cryptographic keys
  2. Attacking the encryption algorithm through cryptanalysis
  3. Attacking the software that implements the encryption algorithm

You may consider your PC 100% protected with encryption, but there are plenty of ways for cybercriminals to attack and steal your data. 

For example, encrypting your entire disk will not protect you from someone intercepting your online communications. An unpatched Windows OS, old software, or an older operating system (like Windows XP) can be exploited remotely to infect your computer with malware. As a result, your disk encryption is rendered useless as the keys to decrypt the disk are stolen.

The information security field is continuously evolving. In the future, we will see more robust encryption algorithms based on their mathematical strength/key size and persistence against outside attacks, not to mention quantum computing, which will render all of today's encryption algorithms useless.

Bottom Line

Having your laptop or hard drive stolen can be stressful, but encryption keeps your data safe. You can use encryption even if you have obscure hardware or a non-mainstream operating system. The article above has presented some options for protecting your data on Linux and shown you the advantages and disadvantages of this process.

However, it is important to remember that encryption can only protect you against physical threats. You may still be susceptible to cybercrime in other forms. Enlisting the help of a cybersecurity consultant firm is your best bet in terms of ensuring complete data security.