LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-29-2023, 12:22 PM   #1
nomival
LQ Newbie
 
Registered: Sep 2023
Posts: 3

Rep: Reputation: 0
LUKS encryption security


Hello.

Suppose you a new physical disk to a server where you must store sensitive data with the following commands:

1. get disks
Code:
lsblk
2. format and setup with luks2
Code:
cryptsetup luksFormat --type luks2 /dev/sdb
2. open it
Code:
cryptsetup luksOpen /dev/sdb safe_data
3. fill space with 0
Code:
dd if=/dev/zero of=/dev/mapper/safe_data status=progress
4. format it
Code:
mkfs.ext4 /dev/mapper/safe_data
5. mount it
Code:
mount /dev/mapper/safe_data /home/safe_data
6. copy data on it from secure web transfer

Now i am curious, suppose the server gets a shutdown/reboot (power outage) without manually running the `cryptsetup luksClose` cmd on a encrypted container. Is there any possibility that you can access the data without entering the password because you did not closed the container?

You can have physical access to the disk, dump ram memory or even using recovery software.

How about run-time attacks (having access to the server but not knowing user/pass to log in)?

Thank you.
 
Old 09-30-2023, 12:58 AM   #2
DoorDaesh
LQ Newbie
 
Registered: Jul 2020
Posts: 23

Rep: Reputation: Disabled
The password/key is stored in the (volatile) RAM, so if the machine reboots, it's gone and the ciphertext is secure.
 
1 members found this post helpful.
Old 09-30-2023, 07:00 AM   #3
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 691
Blog Entries: 1

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by nomival View Post
Hello.
3. fill space with 0
Code:
dd if=/dev/zero of=/dev/mapper/safe_data status=progress
I would use /dev/urandom instead of /dev/zero. If on an SDD type drive, I would probably skip this step. From what I read skipping this on an SDD only increases the risk slightly.


Quote:
Originally Posted by nomival View Post
Now i am curious, suppose the server gets a shutdown/reboot (power outage) without manually running the `cryptsetup luksClose` cmd on a encrypted container. Is there any possibility that you can access the data without entering the password because you did not closed the container?
As someone said, no risk. I heard in theory for a short bit of time a Ghost image could be there, but it will be gone rather quickly.

Another concern, if you hibernate, is there a risk of what you asking ? I think there could be.

Last edited by jmccue; 10-05-2023 at 09:31 AM. Reason: spelling
 
Old 10-04-2023, 02:10 PM   #4
nomival
LQ Newbie
 
Registered: Sep 2023
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by DoorDaesh View Post
The password/key is stored in the (volatile) RAM, so if the machine reboots, it's gone and the ciphertext is secure.
If machine suddenly shut down, then a RAM attack can be performed, right?

More than that, mounting path gets lost.
 
Old 10-04-2023, 02:12 PM   #5
nomival
LQ Newbie
 
Registered: Sep 2023
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jmccue View Post
I would use /dev/urandom instead of /dev/zero. If on an SDD type drive, I would probably skip this step. From what I read shipping this on an SDD only increases the risk slightly.




As someone said, no risk. I heard in theory for a short bit of time a Ghost image could be there, but it will be gone rather quickly.

Another concern, if you hibernate, is there a risk of what you asking ? I think there could be.
From what i know, you can't write on SSD where you want, it actually writes where it wants. What do you mean about increasing the risk? I thought it is healthy to write random data everywhere.
 
Old 10-05-2023, 09:30 AM   #6
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 691
Blog Entries: 1

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
crap, instead of saying "From what I read shipping", I meant to say "From what I read skipping"

You should do a search, I did when I replaced a HDD with a SDD on my main system running Slackware

I saw somewhere that w/LUKS, all people could tell on a SDD where the file is, but that file will be encrypted. That is using LUKs and trim. Plus if you do not trim, then security increases. FWIW, I trim and use LUKs because I doubt the NSA even cares about me. My main concern is theft, and what I do is good enough for that.

But the articles about SDDs and LUKS and trim are very confusing and there are many conflicting statements. So I chose what I think was the best for me, no dd and use trim.

But using /dev/zero is the same as not doing it at all.

For HDDs using /dev/urandom will help a lot with security. For SDDs I do not know.

Last edited by jmccue; 10-05-2023 at 09:45 AM. Reason: spelling
 
  


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
[SOLVED] Uefi and full disk encryption with lvm on luks with luks keyfile lancsuk Slackware 2 04-02-2021 02:43 PM
How to have luks encryption with keyfile OR passphrase (efi full disk encryption including boot)? byroncollege Linux - Security 2 03-30-2017 07:45 AM
LUKS on RAID or RAID on LUKS? retch Linux - Server 3 05-05-2010 01:57 PM
Security of LUKS encryption PlatinumX Linux - Security 5 06-06-2009 04:08 PM
System encryption with dm-crypt and luks? Zmyrgel Slackware 9 09-02-2006 10:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:09 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