[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#296464: initrd-tools: Patch to correct mkinitrd and cryptsetup using key



Package: initrd-tools
Version: 0.1.79
Followup-For: Bug #296464

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
I'm using cryptsetup to crypt my swap with random key. I had the same
problem, then I make a patch to /usr/sbin/mkinitrd.
The realy problem is when cryptsetup asks the password for a device
using key. With this patch, the mkinitrd don't ask password for devices using key.

thank's
leoserra
- -- System Information:
Debian Release: 3.1
  APT prefers experimental
  APT policy: (990, 'experimental'), (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11-1-686
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8)

Versions of packages initrd-tools depends on:
ii  coreutils [fileutils]         5.2.1-2    The GNU core utilities
ii  cpio                          2.5-1.2    GNU cpio -- a program to manage ar
ii  cramfsprogs                   1.1-6      Tools for CramFs (Compressed ROM F
ii  dash                          0.5.2-5    The Debian Almquist Shell
ii  fileutils                     5.2.1-2    The GNU file management utilities 
ii  util-linux                    2.12p-4    Miscellaneous system utilities

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCikOqidffdjWZJQERAseFAJ9P73kn9eRQb3dMdWqTOZkoU4/msgCeMbu+
AAPR5poSwp76KXJjsb2rnyI=
=u3jf
-----END PGP SIGNATURE-----
--- /usr/sbin/mkinitrd-old	2005-05-15 22:09:14.000000000 -0300
+++ /usr/sbin/mkinitrd-new	2005-05-17 16:04:13.000000000 -0300
@@ -324,8 +324,14 @@
 }
 
 dmcrypt() {
-	local cipher_mode devname submajor subminor
+	local key cipher_mode devname submajor subminor
 	
+	key=$(grep -m 1 "^$dmname[[:space:]]" /etc/crypttab | sed 's/^[^[:space:]]*[[:space:]]*\([^[:space:]]*\)*[[:space:]]*\([^[:space:]]*\).*/\2/')
+	if [ "x$key" != "x" ] && [ "x$key" != "xnone" ]; then
+		echo \'$dmname\' does have a key file in /etc/crypttab >&2
+		return
+	fi
+
 	if ! command -v cryptsetup > /dev/null 2>&1; then
 		echo Root is on a DM crypt device, but cryptsetup not installed >&2
 	fi

Reply to: