From d375aed28cc9acf24e5b600572176af2fbecf03b Mon Sep 17 00:00:00 2001 From: Jorge Ramirez-Ortiz Date: Wed, 1 Nov 2023 10:53:40 +0100 Subject: [PATCH 1/6] rm: linux-disk-encryption: document re-encryption Document LUKS2 re-encryption and PKCS#11 emulation. Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Daiane Angolini --- source/_static/systemd-luks.png | Bin 0 -> 17330 bytes .../linux/linux-disk-encryption.rst | 359 ++++++++++++++++-- 2 files changed, 327 insertions(+), 32 deletions(-) create mode 100644 source/_static/systemd-luks.png diff --git a/source/_static/systemd-luks.png b/source/_static/systemd-luks.png new file mode 100644 index 0000000000000000000000000000000000000000..a8746775606f590fe0a4a74a0395b4b7f897eadb GIT binary patch literal 17330 zcmeHvcTiN@`Xxz{AWhDx$=KwaQn_t!ZGc`3+HMi;(_j0=TIeVYIzi)kOt&bFALv3d&&BY!-^d_oH+s#1tbN-qkPVS`*-y3XK}s_KHEP0 zwDu_=eA zo9n4`Lhhc)ltF!aPa8UOe*at>+50lWWAVhCij`G}M-P>YcZpQT+&uRRhq$<@Cei!GF8xxgjlI~N3Pnn-lk!0bJ9Np_K(@b;OoJHqw>r%aM6ts8} z5)ht=Y4Trt+Z3>2%BUF9*nDgJbvg4c5_>0NLOgK)oX*ITYiGy5T<2SSQEe`|FtqPv zYoLdKeS6DYMhUHnDg%$-gzZ@bIxz%s>D|A+&s2KM)cY-U;}$4KwpOM;g7^7-8NS~t zEARJN$8DzGt}(sfj1w1(-$0^YqG%Pizg}8675IHR(nTSYM$dDl+4F;`=uCrM+lv`i zq~@RJxQ_SKvSGR-4@_9u?*oZx zNOj5^?Z_0VVQ_CZO|9G)Ke`FQ1G1>%Q1aqoSQUaWZHbHx2$Z13H6#+*qP2m8|16DL z74IvtBf0-vvs+W}_ClBBF+CcysurT;`)#V`Ygji5jG)uaNdT^wHyA0OBF6ENDMWA4 zrT+WtCdzD|A-zq7V2m3iOX#w=OP9YTW}d`WX1@RVIUjoS`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2Uh)cuUo!E(^(g5U%RfISSA%~B z&VDhhk&^U_r9)(;i6hpYG0zbN(JCVNy(0<8+lg;QpzUVT{!>S|rRHB4#rZFclF;}E zqaaZMpu0;chu-8fK!X+-UwfJ|gcgd8;X$5YEP(9m^xhcIl;KP%z@idWbW5jOJQkd( zryOc`gSHpy@Lo9f-~sTQsk-Si$5r(u`KwQWIB5jg#Ue1UYE?o$Vx6~tnj)rQpmkiB zUc^2Z&{DeJmltP?dU9Dn{+6m*M|d>YzG{jZ*9Za5G!7uHPw51Kx5?zTHH+53Dh`X$ z7aahQCn4QFylx-U#Bpf))9;Jv@9#(Y6J=xua??@i0JniH5Gw_M!SlVFIKgE-x%>y^ zsxZz6vuce_f|y1NEAIQZt+zYCDTAg2CZqDgy_vIsqRb zblsUCkf_A)@+XjUX*E(M@A~FeD|GJ#45!CQ>7TL{N$B`__m?(v^+)-r4;caJps1SMznjQ{KhdBXyJ@ z@{XhxvYvW?Sa||soV#YbbpKtr(^n}LVUh$!To*bJC{cvTpk7H2-rv^I*1ZFB$dPvZyYHEwN)d6=U<)cMl&r z!Z(oFj}a^CwN5LatX<;O)Ct(sD23}WzB#J5sJd6x{_>36TKRS~%`fD&!<|5sNh@U6 zYEDSOHcB+3F_|PQNJSiq7qY}ca@{9)s5g^H$$bX})jK5IS(0Bk>4?7Q1gH7Vc1}{e zhi?owgo&W>Fz&9Ijw(61fArG)FtHMy-r*beiWPO_b#CXrSNx+%ZkOa5z@IeOp~wAP zZrkLN!lnQMHJ!o5;bQ}q^6W3Y>6{(RblSkyAPgA531`AA;upXNPDM*w87j`j#T6?2 zs;fQzkTX`4D+c2xb9;WQ{T?ViDP6i=qqzqMGkd>f;V>0W={&np9l~nWA8h7Hz!@*? z#{^Y_HMuzBghcKw7A$S<-wy` to enable secure boot support. This is required as the LUKS2 TPM 2.0 token -leverages PCR 7, which tracks the secure boot state. +leverages **PCR 7**, which tracks the secure boot state. Now install ``swtpm`` in the host machine (if not already installed), and start the ``swtpm`` daemon, which will be later consumed by Qemu and act as the hardware TPM. @@ -159,14 +200,14 @@ Verify that LUKS2 is using the TPM 2.0 based systemd token for encryption: Label: otaroot Subsystem: (no subsystem) Flags: (no flags) - + Data segments: 0: crypt offset: 16777216 [bytes] length: (whole device) cipher: aes-xts-plain64 sector: 512 [bytes] - + Keyslots: 1: luks2 Key: 512 bits @@ -216,6 +257,260 @@ Verify that LUKS2 is using the TPM 2.0 based systemd token for encryption: Digest: 5c 30 5b f3 59 db fe 6a 71 c4 9a a0 2d 22 cf 6b 18 e7 cc 8d 6a 44 c9 67 97 f8 34 80 96 69 53 7b +.. note:: + + As long as the TPM 2.0 emulation storage is not deleted, you will be + able to reboot your QEMU image since the key will persist. + + +Implementation Details for OP-TEE PKCS#11 Support +------------------------------------------------- + +To prevent conflicts with the PKCS#11 token slot utilized by +``aktualizr-lite``, a dedicated slot is necessary. + +LmP will set this dedicated slot as **slot 1** with the label ``lmp``. + +Before initiating the re-encryption process, the slot is initialized, +and a new **RSA 2048** key is generated. This key never leaves the +PKCS#11 domain. + +It is important to emphasize that only the **encrypted master key** is +stored in the LUKS JSON token header area. + +Please ensure that you **DO NOT** erase the PKCS#11 token slot or its key +throughout the lifespan of your product. Failure to follow this +precaution will result in the system's inability to boot. + +In the event of such a scenario, a recovery key can be created and +provided manually, but it won't support an unattended boot process. + + +Testing PKCS#11 Support With Qemu (arm64) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Make sure LUKS support is enabled for your ``qemuarm64-secureboot`` target: + +.. code-block:: console + + $ cat meta-subscriber-overrides/conf/machine/include/lmp-factory-custom.inc + DISTRO_FEATURES:append:qemuarm64-secureboot = " luks" + + +When running Qemu, please be cautious not to exceed 2GB of memory usage, +as attempting to use more than 2GB of memory may prevent the OP-TEE +emulation from successfully booting. So, it's advisable to stay within +this memory limit. + +.. code-block:: console + + $ qemu-system-aarch64 -m 2048 -cpu cortex-a57 -no-acpi -bios flash.bin \ + -device virtio-net-device,netdev=net0,mac=52:54:00:12:35:02 -device virtio-serial-device \ + -drive id=disk0,file=lmp-console-image-qemuarm64-secureboot.wic,if=none,format=raw \ + -device virtio-blk-device,drive=disk0 -netdev user,id=net0,hostfwd=tcp::2222-:22 \ + -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \ + -chardev null,id=virtcon -machine virt,secure=on -nographic + + +During the boot sequence, you will observe the following: + +.. code-block:: none + + [ 1.932467] Freeing unused kernel memory: 4736K + [ 1.933323] Run /init as init process + Starting version 250.5+ + [ 53.995060] e2fsck: otaroot: clean, 7841/136880 files, 79834/156064 blocks + Enrolling LUKS2 keyslot based on pkcs11 token + Token successfully initialized + User PIN successfully initialized + Key pair generated: + Private Key Object; RSA + label: luks + ID: 9d + Usage: decrypt, sign + Access: sensitive, always sensitive, never extractable, local + Public Key Object; RSA 2048 bits + label: luks + ID: 9d + Usage: encrypt, verify + Access: local + Engine "pkcs11" set. + Created certificate: + 7Certificate Object; type = X.509 cert + label: luks + subject: DN: CN=LmP + ID: 9d + Successfully logged into security token 'lmp' via protected authentication path. + New PKCS#11 token enrolled as key slot 0. + Wiped slot 31. + Successfully logged into security token 'lmp' via protected authentication path. + Successfully decrypted key with security token. + [...] + [ OK ] Reached target Basic System. + Starting D-Bus System Message Bus... + Starting Check and fix an … store of the docker daemon... + Starting IPv6 Packet Filtering Framework... + Starting IPv4 Packet Filtering Framework... + Starting Online LUKS2 disk re-encryption... + Starting User Login Management... + [ OK ] Started TEE Supplicant. + [ OK ] Started Network Name Resolution. + [ OK ] Finished IPv6 Packet Filtering Framework. + [ OK ] Finished IPv4 Packet Filtering Framework. + [ OK ] Starting Network Manager Script Dispatcher Service... + [ OK ] Started Network Manager Script Dispatcher Service. + + Linux-microPlatform 4.0.11 qemuarm64-secureboot - + + qemuarm64-secureboot login: fio + Password: + + fio@qemuarm64-secureboot:~$ + + [ OK ] Finished Online LUKS2 disk re-encryption. + Starting Resize root filesystem to fit available disk space... + [ 210.434491] EXT4-fs (dm-0): resizing filesystem from 156064 to 160161 blocks + [ 210.448134] EXT4-fs (dm-0): resized filesystem to 160161 + [ OK ] Finished Resize root filesystem to fit available disk space. + + +After the service has finished, you can inspect the volume. First list +the block devices: + +.. code-block:: none + + fio@qemuarm64-secureboot:~$ lsblk + NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS + zram0 251:0 0 0B 0 disk + vda 253:0 0 925.6M 0 disk + |-vda1 253:1 0 78M 0 part /var/rootdirs/mnt/boot + |-vda2 253:2 0 200M 0 part /boot + `-vda3 253:3 0 641.6M 0 part + `-vda3_crypt 252:0 0 625.6M 0 crypt /var + /usr + / + /sysroot + + +Then inspect the encrypted one: + +.. code-block:: none + + fio@qemuarm64-secureboot:~$ sudo cryptsetup luksDump /dev/vda3 + Password: + LUKS header information + Version: 2 + Epoch: 99 + Metadata area: 16384 [bytes] + Keyslots area: 16744448 [bytes] + UUID: 06be9f40-ac4f-4301-ad33-e566def6023d + Label: otaroot + Subsystem: (no subsystem) + Flags: (no flags) + + Data segments: + 0: crypt + offset: 16777216 [bytes] + length: (whole device) + cipher: aes-xts-plain64 + sector: 512 [bytes] + + Keyslots: + 1: luks2 + Key: 512 bits + Priority: normal + Cipher: aes-xts-plain64 + Cipher key: 512 bits + PBKDF: pbkdf2 + Hash: sha512 + Iterations: 1000 + Salt: a2 76 b4 61 3b c6 79 02 1a c1 23 89 02 ca 02 8f + f3 82 ec e6 c4 b0 6a c7 4a 4b 99 5e e6 92 c0 88 + AF stripes: 4000 + AF hash: sha512 + Area offset:32768 [bytes] + Area length:258048 [bytes] + Digest ID: 1 + Tokens: + 0: systemd-pkcs11 + pkcs11-uri: pkcs11:token=lmp;object=luks + pkcs11-key: 38 49 ce f7 3e e9 dc fc 66 3d b8 13 90 ec ec 29 + 99 73 5d 47 6a cb d0 fc 6c ab 1c a7 26 a8 08 7e + 46 b3 5d 15 f5 01 a9 e7 e6 d2 80 72 15 14 0d 0b + 61 85 fe ee 1f f8 f0 04 26 c8 46 31 83 52 cc 37 + 44 d7 2a 83 7d 5a d9 44 a3 90 d0 f5 ff f2 9d e3 + 6f 09 4b 2c 79 5e df e3 b0 f7 df b4 b2 8c 0b 78 + 0a 4a 31 c1 d1 63 bb 54 a3 ca c9 a9 a3 88 bc ec + 96 68 25 26 75 b3 44 3d 9b ee bc a4 73 a5 e2 b3 + f2 5e a3 74 29 32 7a 46 b2 af 55 cf 48 3d b6 ea + 4e d0 ca 0c da 06 f1 4e 33 23 73 be bb b0 c0 e1 + ab bf 7a 2d f3 d7 7a be 5c 01 e5 d6 ab 43 33 91 + 48 e7 14 77 61 1c b9 c0 2c 6a 47 36 4c 1f a1 81 + 39 8c 5b 56 43 fa 86 33 7f 8d ec ee cf 74 1a 3a + 43 69 6d bf 3b 70 70 ea 4b f7 02 a0 99 c0 55 02 + 49 16 14 00 45 da 78 da b9 5e 34 17 65 1b 3b c3 + 78 26 64 60 bf fe da 11 a0 3b 7a f9 0f 9e 93 8f + Keyslot: 1 + Digests: + 1: pbkdf2 + Hash: sha512 + Iterations: 1000 + Salt: a6 10 c3 0d 89 22 c4 67 32 c1 c4 49 31 6f 05 10 + 4a f6 3d bd 7f 26 7a ba 9e 74 54 0b 5f da 54 34 + Digest: 58 da 0f b2 ec d5 0d 5d 3d 99 15 85 85 ab e5 40 + 41 14 9c 57 6a 16 02 08 5d 8f 2a 18 ca 77 2d 7b + e1 be 92 d4 0a 49 f1 f1 77 48 c3 c1 27 35 57 ea + 68 47 60 20 15 a1 a2 80 11 c5 dd 8e c7 93 c4 80 + + +You can also examine the PKCS#11 slot created by OP-TEE to verify the +presence of the RSA-2048 key mentioned earlier: + +.. code-block:: none + + root@qemuarm64-secureboot:/var/rootdirs/home/fio# pkcs11-tool --module /usr/lib/libckteec.so.0 --list-token-slots + Available slots: + Slot 0 (0x0): 94e9ab89-4c43-56ea-8b35-45dc07226830 + token state: uninitialized + Slot 1 (0x1): 94e9ab89-4c43-56ea-8b35-45dc07226830 + token label : lmp + token manufacturer : Linaro + token model : OP-TEE TA + token flags : login required, PIN pad present, rng, token initialized, PIN initialized + hardware version : 0.0 + firmware version : 0.1 + serial num : 0000000000000001 + pin min/max : 4/128 + Slot 2 (0x2): 94e9ab89-4c43-56ea-8b35-45dc07226830 + token state: uninitialized + +.. note:: + + The OP-TEE PKCS#11 secure storage emulation will NOT survive across + reboots. As a consequence of this, because the root file system + was encrypted, the system will encounter a failure in mounting the + root file system during the subsequent boot. + + +If you were to reboot the system under the described circumstances, you +should expect to encounter the following error: + +.. code-block :: none + + [ 1.776260] registered taskstats version 1 + [ 1.776628] Loading compiled-in X.509 certificates + [ 1.879079] Loaded X.509 cert 'Default insecure key from Factory II: 1b2327c0b75d0bc1e4914c8195bbf053629b8abb' + [ 1.902679] uart-pl011 9000000.pl011: no DMA platform data + [ 1.937637] Freeing unused kernel memory: 4736K + [ 1.938472] Run /init as init process + Starting version 250.5+ + No slot with token named "lmp" found + PKCS11 certificate not found! + + +.. _re-encryption: + https://man7.org/linux/man-pages/man8/cryptsetup-reencrypt.8.html + .. _systemd-cryptenroll: https://www.freedesktop.org/software/systemd/man/systemd-cryptenroll.html From efb04d2cd827f9ee76d58cf606f82f46d5eceeea Mon Sep 17 00:00:00 2001 From: Jorge Ramirez-Ortiz Date: Fri, 3 Nov 2023 14:30:51 +0100 Subject: [PATCH 2/6] Update source/reference-manual/linux/linux-disk-encryption.rst Co-authored-by: Katrina Prosise --- source/reference-manual/linux/linux-disk-encryption.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/reference-manual/linux/linux-disk-encryption.rst b/source/reference-manual/linux/linux-disk-encryption.rst index 5bebee19c..48e5b8256 100644 --- a/source/reference-manual/linux/linux-disk-encryption.rst +++ b/source/reference-manual/linux/linux-disk-encryption.rst @@ -4,7 +4,7 @@ Disk Encryption Support ======================= To enhance the security of system deployments before manufacturing -provisions the targets, LmP takes the following approach: +provisions the Targets, LmP takes the approach detailed here. During the image creation process in CI, LmP uses LUKS to construct a symmetrically encrypted root file-system. The master key used for From 79977a1c4a16845657cd4f0d5b85516273d2f668 Mon Sep 17 00:00:00 2001 From: Jorge Ramirez-Ortiz Date: Fri, 3 Nov 2023 14:31:00 +0100 Subject: [PATCH 3/6] Update source/reference-manual/linux/linux-disk-encryption.rst Co-authored-by: Katrina Prosise --- source/reference-manual/linux/linux-disk-encryption.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/reference-manual/linux/linux-disk-encryption.rst b/source/reference-manual/linux/linux-disk-encryption.rst index 48e5b8256..8af550844 100644 --- a/source/reference-manual/linux/linux-disk-encryption.rst +++ b/source/reference-manual/linux/linux-disk-encryption.rst @@ -8,7 +8,7 @@ provisions the Targets, LmP takes the approach detailed here. During the image creation process in CI, LmP uses LUKS to construct a symmetrically encrypted root file-system. The master key used for -data encryption is locked/unlocked via a simple passphrase. +data encryption is locked/unlocked via a passphrase. Upon the initial boot, during initramfs, the passphrase used for accessing the master key is discarded and replaced by a cryptographic From 38c5b507d3dde731c27e528388fc2f9118f2cc1b Mon Sep 17 00:00:00 2001 From: Jorge Ramirez-Ortiz Date: Fri, 3 Nov 2023 14:31:06 +0100 Subject: [PATCH 4/6] Update source/reference-manual/linux/linux-disk-encryption.rst Co-authored-by: Katrina Prosise --- source/reference-manual/linux/linux-disk-encryption.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/reference-manual/linux/linux-disk-encryption.rst b/source/reference-manual/linux/linux-disk-encryption.rst index 8af550844..1f707d77a 100644 --- a/source/reference-manual/linux/linux-disk-encryption.rst +++ b/source/reference-manual/linux/linux-disk-encryption.rst @@ -297,7 +297,7 @@ Make sure LUKS support is enabled for your ``qemuarm64-secureboot`` target: DISTRO_FEATURES:append:qemuarm64-secureboot = " luks" -When running Qemu, please be cautious not to exceed 2GB of memory usage, +When running QEMU, please be cautious not to exceed 2GB of memory usage, as attempting to use more than 2GB of memory may prevent the OP-TEE emulation from successfully booting. So, it's advisable to stay within this memory limit. From 3a71ee8732af4eda17b5afb33378a2db81bf21df Mon Sep 17 00:00:00 2001 From: Jorge Ramirez-Ortiz Date: Fri, 3 Nov 2023 14:31:18 +0100 Subject: [PATCH 5/6] Update source/reference-manual/linux/linux-disk-encryption.rst Co-authored-by: Katrina Prosise --- source/reference-manual/linux/linux-disk-encryption.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/reference-manual/linux/linux-disk-encryption.rst b/source/reference-manual/linux/linux-disk-encryption.rst index 1f707d77a..022160fd7 100644 --- a/source/reference-manual/linux/linux-disk-encryption.rst +++ b/source/reference-manual/linux/linux-disk-encryption.rst @@ -487,7 +487,7 @@ presence of the RSA-2048 key mentioned earlier: .. note:: The OP-TEE PKCS#11 secure storage emulation will NOT survive across - reboots. As a consequence of this, because the root file system + reboots. As a consequence of this, because the root file system was encrypted, the system will encounter a failure in mounting the root file system during the subsequent boot. From 285b686ca518891bc33fdbb81eb8ac76ac20edb4 Mon Sep 17 00:00:00 2001 From: Jorge Ramirez-Ortiz Date: Fri, 3 Nov 2023 14:32:07 +0100 Subject: [PATCH 6/6] Update source/reference-manual/linux/linux-disk-encryption.rst Co-authored-by: Katrina Prosise --- source/reference-manual/linux/linux-disk-encryption.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/reference-manual/linux/linux-disk-encryption.rst b/source/reference-manual/linux/linux-disk-encryption.rst index 022160fd7..aa4c671e7 100644 --- a/source/reference-manual/linux/linux-disk-encryption.rst +++ b/source/reference-manual/linux/linux-disk-encryption.rst @@ -488,7 +488,7 @@ presence of the RSA-2048 key mentioned earlier: The OP-TEE PKCS#11 secure storage emulation will NOT survive across reboots. As a consequence of this, because the root file system - was encrypted, the system will encounter a failure in mounting the + was encrypted, the system will encounter a failure in mounting the root file system during the subsequent boot.