Merge pull request #128 from SolidHal/tslilc-pr-crypto

Merge #127 into master along with fixes
This commit is contained in:
SolidHal 2019-10-17 20:16:19 -07:00 committed by GitHub
commit 35913ee74f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 195 additions and 63 deletions

View File

@ -119,16 +119,17 @@ The initramfs is what runs initialy at boot, and allows us to enter a password a
In a normal system, when dmcrypt/LUKS is setup the initramfs image is modified to enable decrypting of the root partiton
Since we have to have a static initramfs image, and can't change it without recompiling the kernel, we have to be a little crafty to support unencrypted and encrypted root partitons with the same initramfs
Since we have to have a static initramfs image, and can't change it without recompiling the kernel, we detect whether encryption is in use by checking for the tag `crypto_LUKS` on the root device at boot.
This is achieved by placing flags in the /boot partition, aka `/dev/mmcblk2p2` or `/dev/sda2`. The /boot partiton is empty on an unencrypted system. When root encryption is set up, the file `root_encryption` is created, which the initramfs init script uses to determine that it should try and decrypt the root partiton
### debugging the init script
A rescue debug shell is entered when the init script encounters a problem, or if the `debug` flag is set
A rescue debug shell is entered when the init script encounters a problem, or if a device with the partition label `RESCUESHELL` is present
You can enable the debug flag by mounting /boot and creating a file named `debug`
Label any partition on the system with `RESCUESHELL` to enter the initramfs rescue shell before mount and root_switch.
To make the system boot normally, from the debug prompt, run `rm /boot/debug` and `exit` to reboot
You can do this with `cgpt add -i 1 -l RESCUESHELL /dev/sda` for example to label the first partiton of a usb drive.
This is the suggested method, as then debugging can be enabled/disabled by plugging in/removing the usb device.

View File

@ -99,7 +99,7 @@ _This will show a bunch of scary red warnings that are a result of the emmc (int
#### Setting up root partition encryption
PrawnOS supports encrypting the full root partition with the use of a custom initramfs and dmcrypt/LUKS
Press "Y" at the prompt, type "YES" at the following prompt, then enter the password you would like to use and verify it
Type "Yes" at the prompt, then enter the password you would like to use and verify it
You will then be prompted one more time to enter your encryption password to mount and setup the filesystem
If you are curious how the initramfs, and root partition encryption work on PrawnOS check out the Initramfs and Encryption section in [DOCUMENTATION.md](DOCUMENTATION.md)

View File

@ -38,7 +38,8 @@ clean:
@echo " clean_kernel - which deletes the untar'd kernel folder from build"
@echo " clean_ath - which deletes the untar'd ath9k driver folder from build"
@echo " clean_img - which deletes the built PrawnOS image, this is ran when make image is ran"
@echo " clean_fs - which deletes the built PrawnOS base image"
@echo " clean_basefs - which deletes the built PrawnOS base image"
@echo " clean_initramfs - which deletes the built PrawnOS initramfs image that gets injected into the kernel"
@echo " clean_all - which does all of the above"
@echo " in most cases none of these need to be used manually as most cleanup steps are handled automatically"
@ -54,16 +55,21 @@ clean_ath:
clean_img:
rm -f $(OUTNAME)
.PHONY: clean_fs
clean_fs:
.PHONY: clean_basefs
clean_basefs:
rm -r $(BASE)
.PHONY: clean_initramfs
clean_initramfs:
rm -r build/PrawnOS-initramfs.cpio.gz
.PHONY: clean_all
clean_all:
make clean_kernel
make clean_ath
make clean_img
make clean_fs
make clean_initramfs
.PHONY: kernel
@ -99,7 +105,6 @@ image:
cp $(BASE) $(OUTNAME)
make kernel_inject
.PHONY: live_image
live_image:
echo "TODO"

View File

@ -23,6 +23,7 @@ echo In PrawnOS Init
rescue_shell() {
[ "{$1}" != "debug" ] && echo "Something went wrong. Dropping to a shell." > /dev/tty1
[ "{$1}" == "debug" ] && echo "Debug flag detected, entering debug shell" > /dev/tty1
echo "Something went wrong. Dropping to a shell." > /dev/tty1
exec setsid /bin/sh -c 'exec /bin/sh </dev/tty1 >/dev/tty1 2>&1'
}
@ -65,28 +66,27 @@ echo ${ROOT_DEV} > /dev/tty1
# the next boot stage
CMDLINE='cat /proc/cmdline'
[ -d "/boot" ] || mkdir -p /boot
mount ${ROOT_DEV}2 /boot
# label any partition on the system with RESCUESHELL to enter the initramfs rescue shell before mount and root_switch.
# you can do this with "cgpt add -i 1 -l RESCUESHELL /dev/sda" for example to label the first partiton of a usb drive.
if [ -n "$(blkid | grep RESCUESHELL)" ]
then
rescue_shell debug
fi
#Debugging can be facilitated by creating /boot/debug
[ -f "/boot/debug" ] && rescue_shell debug
if [ -f "/boot/root_encryption" ]
if [ -n "$(blkid ${ROOT_DEV}2 | grep crypto_LUKS)" ]
then
#decrypt and mount the root filesystem
echo "Opening encrypted root partition, this will take 30s..."
cryptsetup --tries 5 luksOpen ${ROOT_DEV}3 luksroot || rescue_shell debug
cryptsetup --tries 5 luksOpen ${ROOT_DEV}2 luksroot || rescue_shell
mount /dev/mapper/luksroot /newroot
else
# mount the unencrypted root filesystem
[ -d "/newroot" ] || mkdir -p /newroot
mount ${ROOT_DEV}3 /newroot
mount ${ROOT_DEV}2 /newroot
fi
umount /sys
umount /proc
#swith to the new rootfs
#switch to the new rootfs
exec switch_root /newroot /sbin/init ${CMDLINE}

View File

@ -0,0 +1,142 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.9 (GNU/Linux)
mQGiBEh9qqURBACKo3J5VyGBgApcm4QddrLyoS3Sxt+aUX1CQ5t8X8Ue2tXypHOR
jzXRyKiBeAc/yIuLStyE05P0DVQTe6fXZyDIGZbw8Gc6kdzT+wtWmQHQbPLcXV3s
T/7ZDbRg2ShmSleJUNgWABLIKNk8iKGfgMKrzHiUeeLKzr6elf+hYYNMfwCgrQal
gQ/DPIlVjjmJvdnZOYN8ZC0D/3JEoAOFRFtmkufS5q17JMjL0XjDL7HANJc1/hQo
Ap6OckhX6T7o2Pn1QJIJoQAR3fjIqYX/QQn6y+S2PrRtrX0fRqHNGHY/QyjWgdfq
I7lw6H7a7a77O2sD0MfkLWqAU6PQp8xYEQFDwdDXgggmFUEhikWWbNJU/pNialhY
hNypA/wPCAkz47/36RYPL79nZY/p6iCW+tfUtrM5RmkTZ5lqVKxaWv96WppHwoyp
MWk66gkm/EK58zKZASpvh1a5nQ2niWHcazn2TfRfgBgBfFiyaHNgzb6eDwWcIMHF
VglngbUL5hwmBkWVkg2GxSkMk26OCFhrxF59Ibmkf2YxQBXem7Q9bGludXgtbGli
cmUgKEFsZXhhbmRyZSBPbGl2YSkgPGxpbnV4LWxpYnJlK2x4b2xpdmFAZnN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sNp6WZ0sYJcd2Y3y9i1rSIEREBER
AREQEREBERAREQEREBERAREQFzlginAEsbX2Nxcbl0RB5jjjibljY1gvezRZekRA
REQEREBERAXOenhqW5Zow8cL7x9V0RByp6WGlaRDGGhxudb3XVEQEREBERAREQER
EBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBER
AREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQf/2YhgBBMR
AgAgBQJMCX7tAhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvLfPh359R6dA
rgCgm6oaTjZw81cHYJCDbRqmgvPnVwUAmgORBOiTA8uJEZjLnW4nCuwr5hPiiEYE
EBECAAYFAkwJf6IACgkQUjSEXfK5IPUN9ACeIxFILNIr1mgEVvssa9hPiS4rytMA
oMCEApLI1XtbOqg/CkaB1lj/Fqq0iF4EEBEIAAYFAkwJhYAACgkQIr13u1gr1/DP
NwD/fBDFJ9RDH/0OnfX7TQtMajowS07v8ZhMZGS8RiG0wxUBAMpk4sBenTzlKVG3
7+1hts8o+2910W8DnrfsUKZTMKP6
=JkKR
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -6,5 +6,4 @@ first-lba: 34
last-lba: 30785502
/dev/mmcblk2p1 : start= 20480, size= 65536, type=FE3A2A5D-4F32-41A7-B725-ACCC3285A309, uuid=89B31CDB-1147-5241-8271-C1ADBB9BBB44, name="Kernel", attrs="GUID:49,51,52,54,56"
/dev/mmcblk2p2 : start= 86016, size= 976562, name="Boot"
/dev/mmcblk2p3 : start= 1062578, size= 29722924, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=63DB8E49-63C4-984E-90A0-8AC3222C4771, name="Root"
/dev/mmcblk2p2 : start= 86016, size= 30699486, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=63DB8E49-63C4-984E-90A0-8AC3222C4771, name="Root"

View File

@ -1,4 +1,3 @@
label: gpt
label-id: EBA5A923-2F33-7C4E-AC9A-1555FD600D19
device: /dev/mmcblk2
@ -7,5 +6,4 @@ first-lba: 34
last-lba: 30777310
/dev/mmcblk2p1 : start= 20480, size= 65536, type=FE3A2A5D-4F32-41A7-B725-ACCC3285A309, uuid=89B31CDB-1147-5241-8271-C1ADBB9BBB44, name="Kernel", attrs="GUID:49,51,52,54,56"
/dev/mmcblk2p2 : start= 86016, size= 976562, name="Boot"
/dev/mmcblk2p3 : start= 1062578, size= 29714732, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=63DB8E49-63C4-984E-90A0-8AC3222C4771, name="Root"
/dev/mmcblk2p2 : start= 86016, size= 30691294, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=63DB8E49-63C4-984E-90A0-8AC3222C4771, name="Root"

View File

@ -39,12 +39,13 @@ then
sgdisk -N 2 /dev/sda
#Set the type to "data"
sgdisk -t 2:0700 /dev/sda
#Name is "properly" - Probably not required, but looks nice
#Name it "properly" - Probably not required, but looks nice
sgdisk -c 2:Root /dev/sda
#Reload the partition mapping
partprobe /dev/sda
#Force the filesystem to fill the new partition
resize2fs -f /dev/sda2
echo "/dev/sda2 / ext4 defaults,noatime 0 1" > /etc/fstab
fi
if [ "$TARGET" = "SD" ]
@ -56,10 +57,11 @@ then
sgdisk -N 2 /dev/mmcblk0
#Set the type to "data"
sgdisk -t 2:0700 /dev/mmcblk0
#Name is "properly" - Probably not required, but looks nice
#Name it "properly" - Probably not required, but looks nice
sgdisk -c 2:Root /dev/mmcblk0
#Reload the partition mapping
partprobe /dev/mmcblk0
#Force the filesystem to fill the new partition
resize2fs -f /dev/mmcblk0p2
echo "/dev/mmcblk1p2 / ext4 defaults,noatime 0 1" > /etc/fstab
fi

View File

@ -21,7 +21,7 @@
RESOURCES=/InstallResources
# Grab the boot device, which is either /dev/sda for usb or /dev/mmcblk0 for an sd card
BOOT_DEVICE=$(mount | head -n 1 | cut -d '3' -f 1)
BOOT_DEVICE=$(mount | head -n 1 | cut -d '2' -f 1)
echo "--------------------------------------------------------------------------------------------------------"
echo "PrawnOS Install To Internal Emmc Script"
@ -36,7 +36,6 @@ then
dmesg -D
umount /dev/mmcblk2p1 || /bin/true
umount /dev/mmcblk2p2 || /bin/true
umount /dev/mmcblk2p3 || /bin/true
echo Writing partition map
DISK_SZ="$(blockdev --getsz /dev/mmcblk2)"
@ -73,15 +72,9 @@ then
dd if=/dev/zero of=/dev/mmcblk2p1 bs=512 count=65536
dd if="$BOOT_DEVICE"1 of=/dev/mmcblk2p1
BOOT_DEV_NAME=mmcblk2p2
ROOT_DEV_NAME=mmcblk2p3
ROOT_DEV_NAME=mmcblk2p2
CRYPTO=false
#ready /boot
mkfs.ext4 -F -b 1024 /dev/$BOOT_DEV_NAME
mkdir -p /mnt/boot
mount /dev/$BOOT_DEV_NAME /mnt/boot
#Handle full disk encryption
echo "Would you like to setup full disk encrytion using LUKs/DmCrypt?"
select yn in "Yes" "No"
@ -96,8 +89,6 @@ then
echo "Now unlock the newly created encrypted root partition so we can mount it and install the filesystem"
cryptsetup luksOpen /dev/$ROOT_DEV_NAME luksroot || exit 1
ROOT_DEV_NAME=mapper/luksroot
#set the root encryption flag
touch /mnt/boot/root_encryption
break
;;
No,*|*,No )
@ -120,7 +111,7 @@ then
then
echo "/dev/mapper/luksroot / ext4 defaults,noatime 0 1" > /mnt/mmc/etc/fstab
else
echo "/dev/mmcblk2p3 / ext4 defaults,noatime 0 1" > /mnt/mmc/etc/fstab
echo "/dev/mmcblk2p2 / ext4 defaults,noatime 0 1" > /mnt/mmc/etc/fstab
fi
umount /dev/$ROOT_DEV_NAME
echo Running fsck

View File

@ -30,6 +30,7 @@ echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo Writing kernel partition
dd if=/dev/zero of=/dev/mmcblk2p1 bs=512 count=65536
dd if="$BOOT_DEVICE"1 of=/dev/mmcblk2p1
echo You can now reboot
fi

View File

@ -67,27 +67,18 @@ create_image() {
cgpt create $1
kernel_start=8192
kernel_size=65536
boot_size=409600 # 200 MB
cgpt add -i 1 -t kernel -b $kernel_start -s $kernel_size -l Kernel -S 1 -T 5 -P 10 $1
#create the initramfs partiton, aka /boot
boot_start=$(($kernel_start + $kernel_size))
cgpt add -i 2 -t data -b $boot_start -s $boot_size -l Boot $1
#Now the main filesystem
root_start=$(($boot_start + $boot_size))
root_start=$(($kernel_start + $kernel_size))
end=`cgpt show $1 | grep 'Sec GPT table' | awk '{print $1}'`
root_size=$(($end - $root_start))
cgpt add -i 3 -t data -b $root_start -s $root_size -l Root $1
# $size is in 512 byte blocks while ext4 uses a block size of 1024 bytes
cgpt add -i 2 -t data -b $root_start -s $root_size -l Root $1
# $root_size is in 512 byte blocks while ext4 uses a block size of 1024 bytes
losetup -P $2 $1
mkfs.ext4 -F -b 1024 -m 0 ${2}p2 $(($boot_size / 2))
mkfs.ext4 -F -b 1024 -m 0 ${2}p3 $(($root_size / 2))
mkfs.ext4 -F -b 1024 ${2}p2 $(($root_size / 2))
# mount the / partition
mount -o noatime ${2}p3 $5
# mount the /boot partiton
mkdir -p $5/boot
mount -o noatime ${2}p2 $5/boot
mount -o noatime ${2}p2 $5
}
# use buster if no suite is specified

View File

@ -54,9 +54,7 @@ trap cleanup INT TERM EXIT
losetup -P $outdev $ROOT_DIR/PrawnOS-*-c201-libre-2GB.img-BASE
#mount the root filesystem
mount -o noatime ${outdev}p3 $outmnt
#mount the initramfs partition
mount -o noatime ${outdev}p2 $outmnt/boot
mount -o noatime ${outdev}p2 $outmnt
#make a skeleton filesystem
initramfs_src=$outmnt/InstallResources/initramfs_src

View File

@ -44,6 +44,12 @@ cd ..
# build Linux-libre, with ath9k_htc
[ ! -f linux-libre-$KVER-gnu.tar.lz ] && wget https://www.linux-libre.fsfla.org/pub/linux-libre/releases/$KVER-gnu/linux-libre-$KVER-gnu.tar.lz
[ ! -f linux-libre-$KVER-gnu.tar.lz.sign ] && wget https://www.linux-libre.fsfla.org/pub/linux-libre/releases/$KVER-gnu/linux-libre-$KVER-gnu.tar.lz.sign
#verify the signature
gpg --import $RESOURCES/linux-libre-signing-key.gpg
gpg --verify linux-libre-$KVER-gnu.tar.lz.sign linux-libre-$KVER-gnu.tar.lz
[ ! -d linux-$KVER ] && tar --lzip -xvf linux-libre-$KVER-gnu.tar.lz && FRESH=true
cd linux-$KVER
make clean

View File

@ -54,9 +54,7 @@ trap cleanup INT TERM EXIT
losetup -P $outdev $2
#mount the root filesystem
mount -o noatime ${outdev}p3 $outmnt
#mount the initramfs partition
# mount -o noatime ${outdev}p2 $outmnt/boot
mount -o noatime ${outdev}p2 $outmnt
# put the kernel in the kernel partition, modules in /lib/modules and AR9271
# firmware in /lib/firmware