LUKS Encrypt Raspberry PI

Requirements

Raspberry PI
SDCard w/ Raspberry PI OS Lite installed
Flash drive connected to the RPI (to copy data from root partition during encrypt)
Bash scripts: https://github.com/EmmaCruz94/luks-encrypt-raspberry-pi

Install …


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by EmmaCruz94

Requirements

  1. Raspberry PI
  2. SDCard w/ Raspberry PI OS Lite installed
  3. Flash drive connected to the RPI (to copy data from root partition during encrypt)
  4. Bash scripts: https://github.com/EmmaCruz94/luks-encrypt-raspberry-pi

Install OS and Update Kernel

  1. Burn the Raspberry PI OS to the SDCard w/ Balenar Etcher or Raspberry PI Imager

  2. Copy install scripts into /boot/install/

  3. Boot into the Raspberry PI and run sudo /boot/install/1.update.sh

  4. sudo reboot to load the updated kernel

Install Enc Tools and Prep initramfs

  1. Run script /boot/install/2.disk_encrypt.sh

  2. sudo reboot to drop into the initramfs shell.

Mount and Encrypt

  1. Mount master block device to /tmp/boot/

    mkdir /tmp/boot
    mount /dev/mmcblk0p1 /tmp/boot/
    
  2. Run the encryption script, passing your flash drive descriptor:

    /tmp/boot/install/3.disk_encrypt_initramfs.sh [sda|sdb|etc] 
    
  3. When LUKS encrypts the root partition it will ask you to type YES (in uppercase).

  4. Create a decryption password (you will be asked twice).

  5. LUKS will ask for the decryption password again to copy the data back from the flash drive to the root partition.

  6. reboot -f to drop back into initramfs.

Unlock and Reboot to OS

  1. Mount master block device at /tmp/boot/

    mkdir /tmp/boot
    mount /dev/mmcblk0p1 /tmp/boot/
    
  2. Open the LUKS encrypted disk:

    /tmp/boot/install/4.luks_open.sh
    
  3. Type in your decryption password again.

  4. exit to quit BusyBox and boot normally.

Rebuild initramfs for Normal Boot

  1. Run script: /boot/install/5.rebuild_initram.sh

  2. sudo reboot into Raspberry PI OS.

  3. You should be asked for your decryption password every time you boot.

    Please unlock disc sdcard: _
    

References


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by EmmaCruz94


Print Share Comment Cite Upload Translate Updates
APA

EmmaCruz94 | Sciencx (2023-01-14T20:20:56+00:00) LUKS Encrypt Raspberry PI. Retrieved from https://www.scien.cx/2023/01/14/luks-encrypt-raspberry-pi/

MLA
" » LUKS Encrypt Raspberry PI." EmmaCruz94 | Sciencx - Saturday January 14, 2023, https://www.scien.cx/2023/01/14/luks-encrypt-raspberry-pi/
HARVARD
EmmaCruz94 | Sciencx Saturday January 14, 2023 » LUKS Encrypt Raspberry PI., viewed ,<https://www.scien.cx/2023/01/14/luks-encrypt-raspberry-pi/>
VANCOUVER
EmmaCruz94 | Sciencx - » LUKS Encrypt Raspberry PI. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/01/14/luks-encrypt-raspberry-pi/
CHICAGO
" » LUKS Encrypt Raspberry PI." EmmaCruz94 | Sciencx - Accessed . https://www.scien.cx/2023/01/14/luks-encrypt-raspberry-pi/
IEEE
" » LUKS Encrypt Raspberry PI." EmmaCruz94 | Sciencx [Online]. Available: https://www.scien.cx/2023/01/14/luks-encrypt-raspberry-pi/. [Accessed: ]
rf:citation
» LUKS Encrypt Raspberry PI | EmmaCruz94 | Sciencx | https://www.scien.cx/2023/01/14/luks-encrypt-raspberry-pi/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.