LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-20-2024, 10:13 PM   #1
hedron
Member
 
Registered: Jul 2009
Location: NYC
Distribution: Slackware64-multilib 15.0, SARPI, artix
Posts: 401

Rep: Reputation: 32
how to encrypt a hard drive: what are the pitfalls? what type of encryption?


I have virtually zero experience encrypting hard drives. I only encrypted an Artix Linux install once, but I didn't really pay much attention to what I was doing. The only thing I learned is that there is a significant wait for the hard drive to mount every time I boot, since it's extrapolating the encrypted content. At least....I think. Maybe there's another explaination. And that's why I'm making this thread.

I want some basic suggestions which type of encryption to use for an external hard drive? And what pitfalls could ensue? Like, forgetting your password, but that's one I can think of myself, so I'm hoping someone more experienced would know other pitfalls.

Also, what about mdadm/raid compatibility? I choose mirror in case one drive fails, I can still recover. In a single drive failure scenario, what complications can arise?

Also, is there some Slackware specific encryption methods that do not apply to other distros? Slackware is my primary distro, but I also like Artix.

Also, what tools are recommended to test hard drives of their reliability before committing them to encryption?

I want to implement this on a SARPI 15.0 install. I want to do full disk encryption, unless that's not a good idea.
 
Old 03-21-2024, 07:59 AM   #2
tjallen
Member
 
Registered: Jan 2014
Location: Central New York
Distribution: Slackware
Posts: 77

Rep: Reputation: 26
I don't have a ton of experience, but I do encrypt my laptop drive and my internal and external backup drives. For the laptop, I follow the instructions given for full disk encryption (except for /boot) in the Slackware release, which is in README_CRYPT.TXT. I use LVM as well, following the instructions in README_LVM.TXT. LUKS and cryptsetup work great for encrypting and decrypting.

It does take a little time to decrypt the key initially, but once the drives are mounted the speed difference between drives that use encryption and those that do not is not noticeable, even when using encryption algorithms other than AES. (AES has hardware acceleration in many CPUs.) The main pitfall is losing your password or mangling your LUKS headers, so you need to back those up several places for safekeeping. Cryptsetup will help with copying the LUKS headers to files.

With my internal backup drive pairs I encrypt both and then use btrfs with RAID1, for drive mirroring. Btrfs works well for backups, but if one drive in a mirrored set goes bad, it'll be a pain to recover from (though I understand that it's not impossible). I don't have experience with mdadm so I can't answer questions about that.
 
2 members found this post helpful.
Old 03-21-2024, 03:03 PM   #3
gegechris99
Senior Member
 
Registered: Oct 2005
Location: France
Distribution: Slackware 15.0 64bit
Posts: 1,160
Blog Entries: 5

Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
Some time ago, I wrote a litte how-to for encrypting a USB key: how-to-encrypt-a-usb-key-with-cryptsetup
I use it when I have a new USB key to encrypt.
It should also apply to external hard drive.
Instructions to backup the LUKS header are included.
Hope this helps.
 
2 members found this post helpful.
Old 03-21-2024, 03:04 PM   #4
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 777

Rep: Reputation: 244Reputation: 244Reputation: 244
Arrow

I'd go with LUKS encrypted containers or ecryptfs's ~/Private setup and avoid full disk encryption because:
  • If an update to the tool breaks it, you're stuck
  • If the underlying crypto lib updates with an incompatible change, you are stuck (looking at you, openssl). This happened to me once with libgcrypt
  • You can't use an encrypted system to fix an encrypted system that won't unlock
  • The chance for a non-booting system increases with full disk encryption
  • People lose/forget passwords

Unless you have a very special use case, like you are deep behind enemy lines and your life depends on it, I'd stay away from full disk encryption. A special setup on a USB stick, maybe for travel, would be different, as well as a an external HD purely for storage, but I'd not bet my entire main system on always being able to unlock the encyption. Consider: how many times have you seen an application break because it needs to be recompiled against the new libraries you just installed?
 
7 members found this post helpful.
Old 03-23-2024, 05:45 PM   #5
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050
You may find this documentation helpful on Slackware ARM/ARM64. I wrote it up while focused on the Pinebook Pro last year. It is the same process, with different block devices, on the raspberry pi 4 vs rockpro64. Somewhat of a rewrite of the README_CRYPT.TXT from Pat.

Slack docs: disk_encryption_slackware_aarch64

I'd recommend using a 256 bit key size rather than a 512 bit. 512 bit keys are just plain over kill IMHO. Also do not use a SD card as your encrypted root disk. Plug in two of the same drives to the usb 3.0 ports. Boot from the SD card and have your rootfs on the external disk.

RAID 1 is what I use on the Honeycomb LX2k, also arm64. I have tried it with and without RAID disk encryption. I did not benchmark read and writes. The drives did appear to constantly be "behind" with disk sync. This was not the case with a stand alone RAID 1 or a stand alone LUKS + LVM configuration.
 
2 members found this post helpful.
Old 03-24-2024, 09:35 PM   #6
hedron
Member
 
Registered: Jul 2009
Location: NYC
Distribution: Slackware64-multilib 15.0, SARPI, artix
Posts: 401

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by jayjwa View Post
  • If an update to the tool breaks it, you're stuck
I'm not going to encrypt the system disk, just external storage. I mean, so long I still have the "old" version even if the new version breaks it, wouldn't I be able to access the disk? Am I not understanding something?
 
Old 03-25-2024, 04:36 AM   #7
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
The only downside I've found so far is that you can't use autofs automounting as something will need to have unlocked the luks container first. I think most the desktop environment file-managers/volume-managers do this for you these days, but if you're a cli jockey that uses autofs then its a limitation you have to live with.
 
1 members found this post helpful.
Old 03-25-2024, 07:12 AM   #8
triplum.fm
Registered User
 
Registered: Mar 2023
Posts: 60

Rep: Reputation: 33
Encrypting the entire hard drive is, in my opinion, unnecessary. I only encrypt my external SSD and NVMe with TCplay AES/Serpent/Twofish. - On this encrypted SSD, all of my important data is stored. This external SSD can also be decrypted very easily with Windows.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Latest attack against TLS shows the pitfalls of intentionally weakening encryption LXer Syndicated Linux News 0 03-03-2016 11:12 AM
LXer: Encrypt Early, Encrypt Often! LXer Syndicated Linux News 0 08-10-2011 02:30 AM
crypt() perl function to encrypt Password in shell scripts or How Encrypt passwords ? balakrishnay Linux - General 13 01-14-2010 09:35 AM
encrypt and decrypt using encrypt(char block[64], int edflag) rockwell_001 Linux - Security 3 08-30-2009 09:16 AM
Moving hard drive from one system type to another type SlowCoder Linux - Newbie 7 11-26-2007 10:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration