Advertisement
Guest User

dm-crypt like a boss

a guest
Jul 23rd, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. #!/bin/bash
  2. root pw = 01101100
  3.  
  4. #after partitioning, make format and fs
  5. cryptsetup -y -v luksFormat $rewtpart
  6. cryptsetup open $rewtpart cryptroot
  7. mkfs -t ext4 /dev/mapper/cryptroot
  8. mount -t ext4 /dev/mapper/cryptroot /mnt
  9.  
  10. cryptsetup -y -v luksFormat $homepart
  11. cryptsetup open $homepart cryphome
  12. mkfs -t ext4 /dev/mapper/crypthome
  13. mount -t ext4 /dev/mapper/crypthome /mnt/home
  14.  
  15. mkswap -U 13371337-0000-4000-0000-133700133700 $swappart
  16. cryptsetup -y -v luksFormat $swappart
  17. cryptsetup open $swappart cryptswap
  18. swapon $swappart
  19.  
  20.  
  21.  
  22. ##### add root config and hooks to mkinitcpio - enables booting
  23. #add 'encrypt' and 'filesystems' (after 'encrypt') to HOOKS= var --- with sed?
  24. sed -e "52s/keyboard//" /etc/mkinitcpio.conf
  25. sed -e "52s/filesystems/keyboard encrypt filesystems/" /etc/mkinitcpio.conf
  26.  
  27.  
  28.  
  29. ##### add root to boot-loader (i.e. GRUB) - parsed on boot by 'encrypt' hook of mkinitcpio to identify which device contains the encrypted system
  30. echo 'cryptdevice=$rewtpart:cryptroot' >> /boot/grub/grub.cfg
  31.  
  32. ##### auto unlock and mount
  33. echo 'home $homepart none luks' >> /etc/crypttab
  34.  
  35. ##### swap setup to encrypt on boot - NO SUPPORT FOR SUSPEND-TO-DISK
  36. echo 'cryptswap /dev/sda4 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256' >> /etc/crypttab
  37. # check to see genfstab properly generated swap:
  38. # echo 'UUID=13371337-0000-4000-0000-133700133700 /swap none swap sw 0 0' >> /etc/fstab
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement