From d2aa7c13c25351d61f69ee402ecadc55ddbf6077 Mon Sep 17 00:00:00 2001 From: gryf Date: Tue, 31 May 2022 19:55:16 +0200 Subject: [PATCH] Make labeled usb drive/mmc card real optional. Waiting for the devices, especially, when there are more than one/two o them is annoying. Let's make a compromise for user to choose hes way for providing password for key and/or use specific device holding a key. --- README.rst | 8 ++++++++ mkinitramfs.py | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index ec7917d..941071c 100644 --- a/README.rst +++ b/README.rst @@ -62,5 +62,13 @@ Usage on ``/boot`` with appropriate links. Note, that old images (they have ``.old`` suffix in the filename) will be removed in that case. +Using key devices +----------------- + +It is possible to use an SD card (if computer does have reader built-in) or old +plain USB pendrive. Currently support for the keys is limited to 4096 bytes, +and assumption that key is unencrypted - it helps with booting system +non-interactively. + .. _ccrypt: https://sourceforge.net/projects/ccrypt/ .. _cryptsetup: https://gitlab.com/cryptsetup/cryptsetup/blob/master/README.md diff --git a/mkinitramfs.py b/mkinitramfs.py index dc73bbd..5dd7feb 100755 --- a/mkinitramfs.py +++ b/mkinitramfs.py @@ -314,7 +314,7 @@ class Initramfs(object): fobj.write(INIT_CMD) if self._args.disk_label: fobj.write(INIT_LABELED % {'label': self._args.disk_label}) - else: + if self._args.sdcard: fobj.write(INIT_SD) fobj.write(INIT_OPEN) os.chmod('init', 0b111101101) @@ -429,8 +429,9 @@ def main(): parser.add_argument('-k', '--key-path', help='path to the location where ' 'keys are stored', default=KEYS_PATH) parser.add_argument('-d', '--disk-label', help='Provide disk label ' - 'instead of assumed first partition on hardcoded SD ' - 'card reader') + 'to be read decritpion key from.') + parser.add_argument('-s', '--sdcard', help='Use built in sdcard reader to ' + 'read from (hopefully) inserted card') parser.add_argument('-l', '--lvm', action='store_true', help='Enable LVM in init.') parser.add_argument('disk', choices=disks.keys(), help='Disk name')