LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 03-27-2017, 08:55 PM   #1
byroncollege
LQ Newbie
 
Registered: Mar 2017
Posts: 1

Rep: Reputation: Disabled
How to have luks encryption with keyfile OR passphrase (efi full disk encryption including boot)?


Hello,
Can anyone help me to achieve a luks encryption setup where an external USB key is used to decrypt disks on boot OR when the usb is not present it asks for a passphrase instead.

I use my laptop on a dock and would like to leave the usb key connected to the dock so when I am connected to the dock the machine boots seamlessly decrypting from the usb keyfile. Then when I am on the road the machine will ask for the passphrase when booting as there is no keyfile present.

The system uses UEFI to boot and I have set the crypttab file to point to the usb key file, updated grub and initramfs and it all works as should. If the usb key is disconnected the machine just hangs after grub and doesn't decrypt as it does not ask for a passphrase and cannot find the usb key.

Ideally I would like to have the /boot partition encrypted on the laptop so it asks for the password once to unlock the boot partition and load grub, then asks for the luks password again when selecting ubunutu.

Next a seperate, unencrypted boot partition is on the usb key together with the keyfile. I would then build the initramfs,grub,efi with the usb key mounted at /boot and the crypttab pointing to the keyfile. This would/should give a seemless boot process, as /boot is now unencrypted when docked and the usb keyfile is loaded to decrypt the hdd. I would give the usb boot priority over the HDD.

Then I remove the usb key, /boot is now inside the luks container and update the crypttab to "none" for keyfile and rebuild initramfs and grub. This process achieves the double password boot (once for grub, once for booting ubuntu).

Where I am stuck is - I have been unable to successfully copy the boot partition to the usb drive and update it with the different crypttab/efi boot files.
When I select the usb to boot it attempts to boot then drops back to the BIOS boot menu and moves to the next option of booting from the HDD.

Does anyone know if this is possible or can shed some light the process to achieve it? I think possibly I need to set the /boot drive in fstab to the usb key to get it to work, but then this would mean it will fail to find the /boot partion on the hdd should the usb be disconnected?


I am using ubuntu 16.10

/dev/sda
sda1 /boot/efi
sda2 luksCrypt
@ / btrfs (including /boot)
@home /home btrfs
/dev/sdb - usb
sda1 /boot and keyfile.key
 
Old 03-30-2017, 12:56 AM   #2
displace
Member
 
Registered: Jan 2013
Location: EU
Distribution: Debian
Posts: 268

Rep: Reputation: 25
You'll likely have to modify the crypto hooks for initramfs-tools and then update grub2 with appropriate files. A shell script should be needed that looks for a keyfile, and if it fails then asks for a password instead. The LUKS partition could probably use two slots - one with a keyfile and another with password. The boot partition can theoretically be encrypted too, provided the GRUB is setup to decrypt it first. I think it's possible to do, but I haven't done so myself *yet*.

I found two interesting docs on how to encrypt the boot partition. Give them a read:
http://www.pavelkogan.com/2014/05/23...sk-encryption/
http://www.pavelkogan.com/2015/01/25...nt-encryption/
 
Old 03-30-2017, 07:45 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
If you want to achieve this level of security, you can't do it in software.

A Amazon search for "encrypted hard drive laptop" shows various things – including an external hard drive with a keypad on top of it. Secure encrypted NAS for only $6,000.00 (USD). "IronKey" hard drives for $400.00. And, so on.

You can also purchase "hardened" laptops that have soup-to-nuts hardware security features, once again including hardware encryption and modified BIOSes that are not stored in "flash memory." You're probably looking at $2,500.00 and up. Way up. The equipment is much more expensive, and the market is small.
 
  


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
Mint 18 Full disk encryption VS Veracrypt Full Disk encryption: Help a Noob Decide Please ! APeacefulRig Linux - Security 2 11-11-2016 08:10 AM
[SOLVED] Full hard disk encryption login (LUKS) not working properly flackbt Linux Mint 1 10-06-2015 10:40 AM
linux GUI full disk encryption including /boot postcd Linux - Security 12 11-04-2014 12:05 AM
Luks disk encryption balaji2219@gmail.com Linux - Newbie 2 08-06-2014 02:51 PM
Full disk encryption on boot partition paul_mat Linux - Security 13 03-12-2008 02:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 06:23 AM.

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