User Tools

Site Tools


computing:encryption

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
computing:encryption [2018/11/28 06:07] oemb1905computing:encryption [2020/12/27 02:28] oemb1905
Line 8: Line 8:
 ------------------------------------------- -------------------------------------------
  
-More later ..+Creating a encrypted partition for your workstation using cryptsetup 
  
-These notes are for setting up dual boot with full disk encryption on a macbook ...+  sudo apt-get install cryptsetup libpam-mount 
 +  cryptsetup luksFormat /dev/sdaX 
 +  cryptsetup luksOpen /dev/sdaX vault 
 +  mkfs.xfs -L vault /dev/mapper/vault 
 +   
 +To manually mount the vault, you can perform: 
 +   
 +  mkdir /mnt/vault 
 +  mount /dev/mapper/vault /mnt/vault
  
-Boot into the ncurses installerwhen prompted to set up disks for partitioning, select Manual.  Scroll down to the free space you left for the OS you desire to install.  Press return and select it, create new partition, select 1.01GB for its size, specify for it to be used as /bootand finally finish changes to partition.  Use the remaining free space for the root of the file system.  Select the remaining space, create new partition with desired space amount (using the remaining is fine), then select use as Logical Volume Management, select finish changes.  When back at the overview screen, select Configure Logical Volume Management from the options above, then Create Logical Volume group with name debgroup, then create logical volume called root, say yes to remaining dialogues.  When back at the overview screen, you should now see an LV group for root.  Select configure encrypted volumes from the options above, select the LVM group and volume you created above.  Put in your passphrase for your encrypted volume, specify the file system, then select that it should be mounted at root ("/").  You should now be done, select finish and install.   +After you reboot, the crypt will no longer be openso you will need to open it first before mounting
  
 +  cryptsetup luksOpen /dev/sdaX vault
 +  mount /dev/mapper/vault /mnt/vault 
  
 +Okay, so if mounting manually proves to be too tedious, here is how you can mount at boot.  First, create a keyfile that you can use to unlock the crypt (only store this on an encrypted drive):
 +
 +  sudo dd if=/dev/urandom of=/etc/lukskeys/vaultkey bs=512 count=8
 +
 +Add the keyfile to the crypt so that it can be used to open the crypt:
 +
 +  sudo cryptsetup -v luksAddKey /dev/sdb1 /etc/lukskeys/vaultkey
 +  
 +Now, we need to get the partition's block identifier, to use in crypttab and fstab because it is more reliable than the name.  Do this as follows:
 +
 +  sudo cryptsetup luksDump /dev/sdb1 | grep "UUID"
 +  
 +Open crypttab up, and add the example below, adjusting as necessary.
 +  
 +  sudo nano /etc/crypttab
 +  <sdb1_crypt UUID=7b8975bg-5902-733c-a7b8-fbeb18945c85 /etc/lukskeys/vaultkey luks>
 +  
 +Now that crypttab is setup, this means you you can open the crypt as follows:
 +
 +  sudo cryptdisks_start sdb1_crypt
 +  
 +But, since this only opens it and does not mount it, you will need to add an entry to fstab similar to the one provided below:
 +
 +  sudo nano /etc/fstab
 +  </dev/mapper/sdb1_crypt /media/vault     xfs    defaults      0     2>
 +  
 +Okay, reboot and test.  If it fails, boot into recovery mode and comment out the fstab entry until you get everything set up properly.
 +
 +  sudo nano /etc/security/pam_mount.conf.xml
 +  <volume user="sexa" fstype="crypt" path="/dev/disk/by-uuid/21sdsd" mountpoint="/home" options="noatime,exec,fsck,nodev,nosuid"/>
 +
 + --- //[[jonathan@haacksnetworking.com|oemb1905]] 2020/12/26 19:20//
computing/encryption.txt · Last modified: 2024/01/29 18:20 by oemb1905