Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kBytM-0000nZ-Up for mharc-grub-devel@gnu.org; Sat, 29 Aug 2020 07:19:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBytL-0000nM-4g for grub-devel@gnu.org; Sat, 29 Aug 2020 07:19:27 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:52791) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBytI-0003ax-MH for grub-devel@gnu.org; Sat, 29 Aug 2020 07:19:26 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 5838C5C016C; Sat, 29 Aug 2020 07:19:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 29 Aug 2020 07:19:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=wfcotykjDdNWl28KsU2AdGUFITb 1EO2yH8uDbv3Rsu0=; b=XVb7ndFfhFxrFUIYsLBdUoW+jdxGaB04tEKRb4c32zK eDPEmUYUC6AZW/bgLGGppFIPwrsufLf+SkiDEuqihln4NUiiEfXBl6AnFXRgEQgn av7oe3Gbfl0q56bWJpY3+luYn9Yl5x0uQ0h/zIB6WVD39bLnMMihHMMORwEHw/B4 O7Wz6rwQjtZBJJsCU6fTT6xdA84PK7SBaU00iw5pcUrDNETj1Lk/C7md+GZ3MpG0 NPB+YTddgGKfuFGu1xvOE6IrA+JE6/BvXmyMgUHKqwcoHfRjc35l1QEqU4Id1GpZ k9NTwmIEll8DTkyxHOAjXpnQzEdNtvfiQMVNaCM0QoQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=wfcoty kjDdNWl28KsU2AdGUFITb1EO2yH8uDbv3Rsu0=; b=EM5XgAfNn6QAA1LrkcYjXf utz1IkH5/iYrCU9QqH1hZrm7SBVpKpOeGM3lbxfE29y0KOBrXe/ZfG7ZSRnrm2SG TtPgnCkeBU1Eg7EFXiEhYOTUZIZd9VirvHajDMo8P4jquTLXk2Em3EpmsT2hsMYN v6mrnFjqqoqQmiBJLfX4Papk1w7J0hvSTD4qup8J52MmFiEo6H34aG/piqoJ2f5/ uQNlfiCgMIL//ogqobd4FyFSRs+mLd4yRbb7rxtMfswxERad4+RCRKq22g8qqziG 2zQ8y6jbjFeQ3WfyoV293XK6k88+/L+eieSPaCtvef7wOiO2BDQgYd829823ekyQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudefuddgfeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgoufhushhpvggtthffohhmrghinhculdegledmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpedtgffhhfdvueevieejjefflefhteetkeevieevjeehieeijeetgeffgfeluefghfen ucffohhmrghinhepihigrdhiohdprghrtghhlhhinhhugidrohhrghenucfkphepjeekrd ehhedrfeefrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhepphhssehpkhhsrdhimh X-ME-Proxy: Received: from vm-mail.pks.im (x4e372171.dyn.telefonica.de [78.55.33.113]) by mail.messagingengine.com (Postfix) with ESMTPA id 43E8E328005A; Sat, 29 Aug 2020 07:19:21 -0400 (EDT) Received: from localhost (ncase [10.192.0.11]) by vm-mail.pks.im (OpenSMTPD) with ESMTPSA id 22c624e0 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 29 Aug 2020 11:19:16 +0000 (UTC) Date: Sat, 29 Aug 2020 13:19:24 +0200 From: Patrick Steinhardt To: "grub-devel@gnu.org" Cc: HardenedArray Subject: Re: Can grub-git be used to decrypt a LUKS2 encrypted partition? Testing Results Message-ID: <20200829111924.GA863@ncase.pks.intern> References: <20200828165258.GA2097@tanuki.pks.im> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="6c2NcOVqGQ03X4Wi" Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=66.111.4.27; envelope-from=ps@pks.im; helo=out3-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/29 07:19:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Aug 2020 11:19:27 -0000 --6c2NcOVqGQ03X4Wi Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Sat, Aug 29, 2020 at 09:00:41AM +0000, HardenedArray wrote: >=20 > Hi Patrick, >=20 > Yes, I am on the mailing list. Okay. I'm re-adding the ML to the receipients. > I tried appending all the modules you mentioned below to `--modules=3D` >=20 > However, when I ran `grub-install --target=3Dx86_64-efi --efi-directory= =3D/efi --modules=3D"luks2 part_gpt cryptodisk pbkdf2 gcry" --bootloader-id= =3D >=20 > I get: >=20 > grub-install: error: '/usr/lib/grub/x86_64-efi/gcry.mod' : No such file = or directory. Sorry, I probably wasn't clear enough on the gcry part. "gcry" is not a single module, but instead it is a set of modules which implement the cryptographic primitives required for LUKS2. So e.g. if you use "aes-xts-plain64" with a PBKDF2-derived key using SHA256, you'd at least need the "gcry_rijndael", "pbkdf2" and "gcry_sha256" modules. But this really depends on your specific setup. Patrick > Therefore, I re-ran the above grub-install removing only the 'gcry` modul= e. >=20 > That command completes without error. The complete (lengthy) grub-instal= l -v output is at: http://ix.io/2vyc >=20 > However, after grub-mkconfig, exiting, umounting and rebooting, I am righ= t back to the identical output and passphrase entry issues I detailed in my= Steps 9 and 10 below. >=20 > Any ideas about 'gcry' or another testing approach? >=20 > Cheers >=20 >=20 > =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 Original = Message =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 > On Friday, August 28, 2020 4:52 PM, Patrick Steinhardt wrote: >=20 > > Manually Cc'ing you as I don't know if you're registered on the mailing > > list and saw just now that you weren't Cc'd on my initial reply. > > > > ----- Forwarded message from Patrick Steinhardt ps@pks.im ----- > > > > > From: Patrick Steinhardt ps@pks.im > > > To: The development of GNU GRUB grub-devel@gnu.org > > > Date: Fri, 28 Aug 2020 18:51:21 +0200 > > > Subject: Re: Can grub-git be used to decrypt a LUKS2 encrypted partit= ion? Testing Results > > > On Fri, Aug 28, 2020 at 11:37:24AM -0400, Eli Schwartz wrote: > > > > > > > On 8/28/20 11:28 AM, HardenedArray via Grub-devel wrote: > > > > > > > > > I run Arch Linux as an encrypted /, /boot and swap system. That > > > > > encrypted /boot is nothing more than a folder under /, however two > > > > > Keyslots are required to boot. > > > > > If I understand the boot process correctly, LUKS Keyslot 1 is use= d by > > > > > grub to unlock /boot, then control is handed off to the kernel wh= ich > > > > > uses Keyslot 0 to unlock /. My passphrase, entered once, unlocks > > > > > both. > > > > > Grub can easily unlock /boot, assuming / is originally encrypted = as a > > > > > `type=3D luks1` partition. It seems, however, it is not possible = for > > > > > grub to unlock this same /boot if / is converted to `--type=3D lu= ks2`. > > > > > Is my assumption correct, and if so, what is preventing grub from > > > > > this `type=3D luks2` /boot unlocking? > > > > > I am running: grub-git 2.04.rc1.r19.g4e7b5bb3b-1 from the Arch (A= UR). > > > > > This package was last updated on 7 Feb 2020. See: > > > > > https://aur.archlinux.org/packages/grub-git/ > > > > > I originally encrypted the partition with: `cryptsetup -c aes-xts= -plain64 -h sha512 -s 512 --use-random --type luks1 luksFormat /dev/sdXZ` > > > > > Then I set up two LVs: swap (512M) and / (remaining partition spa= ce). > > > > > That swap LV is assigned as `dm-1` and / is assigned as `dm-2`. d= m-2 > > > > > runs BTRFS, if that matters. Grub boots that system without issue. > > > > > The process I used to test LUKS2 encrypted /boot support: > > > > > > > > > > 1. UEFI boot from any reasonably recent arch iso, and run: > > > > > `cryptsetup convert --type luks2 /dev/sdXZ`. That command will > > > > > succeed, and luksDump will show PBKDF: pbkdf2 for both Keyslo= t 0 and > > > > > > > > > > 2. > > > > > 3. Run cryptsetup open /dev/sdXY > > > > > > > > > > 4. Mount everything and arch-chroot into / > > > > > > > > > > 5. Run `mkinitcpio -P linux` > > > > > > > > > > 6. Run `grub-install --target=3Dx86_64-efi --efi-directory=3D/ef= i --modules=3D"luks2 part_gpt cryptodisk" --bootloader-id=3D`. > > > > > > > > > > > > > > > Note: If `--modules=3D"luks2 part_gpt cryptodisk"` is not appende= d to > > > > > grub-install, then the `ls` results in step 9 (below) only lists > > > > > (proc) and (hd0) - and/or cryptodisk: command not found. > > > > > > > > > > 6. Run grub-mkconfig -o /boot/grub/grub.cfg > > > > > > > > > > 7. Exit, umount and reboot. > > > > > > > > > > 8. Immediately following power on: you are greeted by the dreade= d: > > > > > error: disk 'lvmid/some-lengthy-UUID' not found. Entering res= cue > > > > > mode. That lengthy UUID is exact UUID of my `dm-2` which is my > > > > > encrypted / LV. > > > > > > > > > > 9. At the `grub rescue>` prompt: type `ls`. There I see (proc) (= hd0) > > > > > and (hd0,gpt1)...(hd0,gpt7) where gpt7 is my last partition a= nd where > > > > > my encrypted / resides. > > > > > > > > > > 10. Still at `grub rescue>` type: `cryptomount (hd0,gpt7)` which= then > > > > > requires my passphrase. After correct passphrase entry, and h= itting > > > > > Enter only returns: > > > > > > > > > > > > > > > `error: Could not parse digest 1.` > > > > > Incredibly, if you repeat step 10 and intentionally enter an > > > > > incorrect passphrase, you get the same: > > > > > `error: Could not parse digest 1.` > > > > > In fact, if you enter NO passphrase and hit Enter, you also get: > > > > > `error: Could not parse digest 1.` > > > > > Very frustrating indeed! > > > > > Does anyone know why grub is failing this way, and does a workaro= und > > > > > exist? > > > > > Thank you for your time...suggestions welcome. > > > > > > > > If I remember correctly, you mentioned on IRC that you could > > > > successfully use grub-git to cryptomount a luks1 /boot/grub directo= ry, > > > > then use the grub modules there to further cryptomount a luks2 part= ition. > > > > The problem sounded like an issue actually getting grub-install to > > > > generate a grubx64.efi with proper, usable luks2 support. > > > > Am I right? > > > > > > If that's the case, then this is entirely expected right now. > > > grub-install doesn't yet include the required modules automatically f= or > > > LUKS2 support. There is ongoing work to enable this, first by > > > recognizing LUKS2 devices at all [1,2]. But we're not there yet, and > > > it's unlikely to happen for release 2.06. > > > Until then, you'll have to manually add required GRUB modules for LUK= S2, > > > PBKDF2 and the gcry modules required for your configured cipher/hash > > > combination. > > > Patrick > > > > ----- End forwarded message ----- --6c2NcOVqGQ03X4Wi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEF9hrgiFbCdvenl/rVbJhu7ckPpQFAl9KObsACgkQVbJhu7ck PpTnRA/+KgOY/hFYEe++7FTzA+ZQE5T5ctnl8oc74dzOS0Vijyrs9Sbyh83KIxl+ 9NTQlKxIpOH2UK9L8Z+otGwOCmy7ad2GUjGVSb2NY5Pjri/n/fXFIaczH3WUaC1l kNpFawVT6ClLzO3UgPgLCofOP5SIERUpXQRDJpTmVOrsBW1VLuF42Sf4NFs6OkeQ KqHJhz4nQCJM9Nzht5ipIaYlDruwlTlIo3EfiLtgWJyrbK4ouitOghJNacnWltvb hK7O7HF49gD9PT1L0ZqfOsICm47TLOhkQypsJx/AHwTrHgbrBqtc9w3G5oC0Tvyy q3qm9+bnX6Lh/r/UVXYqrzKf7Xblx1OiZvcdiHOG1HmwtaSbq8k62vlAjCHcD2Wf uHYonIiLVe450G3b7z9PK8InGcCyXTpp+QxuvBIl9dQ8DjZL+/QtqxgTNggKNgyS MVRehzgvuVxTa6l+KIXWlUhkVHIJN9L9mvvSrbPrMoLZNrAjci0+3aNW8oBoDybH qrTdsRbMHnMLtNYIwDU+wtvYmdrG/5geDPmtQvoZvQtjpGFym7iLImeUIu1SprRj LsS6+C0CRkKe0+EyMDZyKWQwsYYfk0xWqBWQQ+c8jt30Hou4+Iol82QHww7E204i kCpls9o9G2gNbW54pf8bKtkVWJWVOMEQ08F9jaEwlQUbZ1PRMCM= =yHnG -----END PGP SIGNATURE----- --6c2NcOVqGQ03X4Wi--