Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VjbfU-0003XZ-Vp for mharc-grub-devel@gnu.org; Thu, 21 Nov 2013 16:20:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vja1Z-0008Lt-N3 for grub-devel@gnu.org; Thu, 21 Nov 2013 14:34:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vja1U-0007Yd-Dm for grub-devel@gnu.org; Thu, 21 Nov 2013 14:34:49 -0500 Received: from ramses-pyramidenbau.de ([78.47.114.252]:42011 helo=mail.ramses-pyramidenbau.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vja1U-0007YN-4X for grub-devel@gnu.org; Thu, 21 Nov 2013 14:34:44 -0500 Received: from [192.168.0.29] (chello062178005054.2.11.vie.surfer.at [62.178.5.54]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.ramses-pyramidenbau.de (Postfix) with ESMTPSA id B9BBD61498 for ; Thu, 21 Nov 2013 20:34:40 +0100 (CET) Message-ID: <528E6058.9000608@ramses-pyramidenbau.de> Date: Thu, 21 Nov 2013 20:34:48 +0100 From: Ralf Ramsauer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: Keyfile Support for GRUBs LUKS References: <528BF7A9.8010702@ramses-pyramidenbau.de> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: multipart/alternative; boundary="------------030207030605050305010307" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 78.47.114.252 X-Mailman-Approved-At: Thu, 21 Nov 2013 16:20:07 -0500 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2013 19:34:55 -0000 This is a multi-part message in MIME format. --------------030207030605050305010307 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 11/21/13 16:31, Vladimir 'phcoder' Serbinenko wrote: > > Why do you need offset and size options? keyfile option should be > repeteable. The whole array would be passed down and file would be > opened instead before reading password and concatebated with it unless > --no-password was specified as well. If you have remaining questions > feel free to ask here or on IRC. > See man 8 cryptsetup: / --keyfile-offset value// // Skip value bytes at the beginning of the key file. Works with all commands that accepts key files.// // // --keyfile-size, -l value// // Read a maximum of value bytes from the key file. Default is to read the whole file up to the compiled-in maximum that can be queried with --help. Supplying more data than the compiled-in maximum aborts the operation.// // // This option is useful to cut trailing newlines, for example. If --keyfile-offset is also given, the size count starts after the offset. Works with all commands that accepts key files./ > On Nov 20, 2013 12:43 AM, "Ralf Ramsauer" > > wrote: > > Hi, > > yesterday I realised, that GRUB is already supporting LUKS and even > simple DSA signature checking. > > I was thinking about the following setup: > - fully encrypted harddisk (LUKS) (incl. rootfs). > - no bootloader on harddisk > - kernel + initrd inside encrypted partition > - optionally: signatures of the kernel + initrd > > For "trusted" booting, I thought about an USB stick, that just > includes > GRUB, a public key for verification and a keyfile for LUKS. > Using that setup, no password input would be required during boot. The > USB stick can be considered as "trusted environment". > > Unfortunately, GRUB doesn't support keyfile for Luks up to now. As I'm > quite familiar with dm-crypt and LUKS I tried to implement the keyfile > feature to GRUB. > After spending several hours trying to get a deeper insight into the > GRUB internas I finally resigned, as I was missing documentation on > several things... > > I was very confused about the way how GRUB2 is handling its > modules and > about the strategies how functions are exactly called. > The aim is to implement three additional options to cryptodisk.c resp. > luks.c: > -k keyfile [e.g. (hd2,msdos3)/mysecretkey] > -o keyfile offset [optional, default: 0] > -s keyfile size [optional, default: keyfilesize] > > Using LUKS, a keyfile can simply be treated like a passphrase, which > basically is already implemented. > > I would appreciate, if perhaps someone of you could help me with > this issue. > > Thanks in advance! > Ralf > > -- > Ralf Ramsauer > > PGP: 0x8F10049B > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel > > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel -- Ralf Ramsauer PGP: 0x8F10049B --------------030207030605050305010307 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
On 11/21/13 16:31, Vladimir 'phcoder' Serbinenko wrote:

Why do you need offset and size options? keyfile option should be repeteable. The whole array would be passed down and file would be opened instead before reading password and concatebated with it unless --no-password was specified as well. If you have remaining questions feel free to ask here or on IRC.

See man 8 cryptsetup:
       --keyfile-offset value
              Skip value bytes at the beginning of the key file.  Works with all commands that accepts key files.

       --keyfile-size, -l value
              Read a maximum of value bytes from the key file.  Default is to read the whole file up to the compiled-in maximum that can be queried with --help. Supplying more data than the compiled-in maximum aborts the operation.

              This option is useful to cut trailing newlines, for example. If --keyfile-offset is also given, the size count starts after the offset.  Works with all commands that accepts key files.


On Nov 20, 2013 12:43 AM, "Ralf Ramsauer" <ralf+grub@ramses-pyramidenbau.de> wrote:
Hi,

yesterday I realised, that GRUB is already supporting LUKS and even
simple DSA signature checking.

I was thinking about the following setup:
  - fully encrypted harddisk (LUKS) (incl. rootfs).
  - no bootloader on harddisk
  - kernel + initrd inside encrypted partition
  - optionally: signatures of the kernel + initrd

For "trusted" booting, I thought about an USB stick, that just includes
GRUB, a public key for verification and a keyfile for LUKS.
Using that setup, no password input would be required during boot. The
USB stick can be considered as "trusted environment".

Unfortunately, GRUB doesn't support keyfile for Luks up to now. As I'm
quite familiar with dm-crypt and LUKS I tried to implement the keyfile
feature to GRUB.
After spending several hours trying to get a deeper insight into the
GRUB internas I finally resigned, as I was missing documentation on
several things...

I was very confused about the way how GRUB2 is handling its modules and
about the strategies how functions are exactly called.
The aim is to implement three additional options to cryptodisk.c resp.
luks.c:
 -k keyfile [e.g. (hd2,msdos3)/mysecretkey]
 -o keyfile offset [optional, default: 0]
 -s keyfile size [optional, default: keyfilesize]

Using LUKS, a keyfile can simply be treated like a passphrase, which
basically is already implemented.

I would appreciate, if perhaps someone of you could help me with this issue.

Thanks in advance!
  Ralf

--
Ralf Ramsauer

PGP: 0x8F10049B


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


-- 
Ralf Ramsauer

PGP: 0x8F10049B
--------------030207030605050305010307--