[From nobody Sun Mar  9 02:39:00 2008
Received: (at submit) by bugs.debian.org; 10 Nov 2007 14:47:29 +0000
X-Spam-Checker-Version: SpamAssassin 3.1.4-bugs.debian.org_2005_01_02 
	(2006-07-26) on rietz.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-7.9 required=4.0 tests=BAYES_00, FOURLA, HAS_PACKAGE,
	RCVD_IN_BL_SPAMCOP_NET,UNPARSEABLE_RELAY autolearn=no 
	version=3.1.4-bugs.debian.org_2005_01_02
Return-path: &lt;djani_buric@fastmail.fm&gt;
Received: from ls405.t-com.hr ([195.29.150.135])
	by rietz.debian.org with esmtp (Exim 4.50) id 1IqrcN-0003jA-5P
	for submit@bugs.debian.org; Sat, 10 Nov 2007 14:47:27 +0000
Received: from ls242.t-com.hr (ls242.t-com.hr [195.29.150.134])
	by ls405.t-com.hr (Postfix) with ESMTP id 9A11F38801;
	Sat, 10 Nov 2007 15:46:54 +0100 (CET)
Received: from ls242.t-com.hr (localhost.localdomain [127.0.0.1])
	by ls242.t-com.hr (Qmlai) with ESMTP id 96234B0837B;
	Sat, 10 Nov 2007 15:46:54 +0100 (CET)
Received: from ls242.t-com.hr (localhost.localdomain [127.0.0.1])
	by ls242.t-com.hr (Qmlai) with ESMTP id 46558B0836F;
	Sat, 10 Nov 2007 15:46:54 +0100 (CET)
X-Envelope-Sender: djani_buric@fastmail.fm
Received: from sedna.linux.bogus (78-2-18-201.adsl.net.t-com.hr 
	[78.2.18.201])by ls242.t-com.hr (Qmali) with ESMTP id 094605BC14D;
	Sat, 10 Nov 2007 15:46:53 +0100 (CET)
Content-Type: text/plain;
	charset=us-ascii
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Djani Buric &lt;djani_buric@fastmail.fm&gt;
To: Debian Bug Tracking System &lt;submit@bugs.debian.org&gt;
Subject: loop-aes-utils: mount fails to read encryption key from symbolic link
Message-ID: &lt;20071110144653.7748.30947.reportbug@sedna.linux.bogus&gt;
X-Mailer: reportbug 3.39
Date: Sat, 10 Nov 2007 15:46:53 +0100
X-imss-version: 2.049
X-imss-result: Passed
X-imss-scanInfo: M:P L:E SM:0
X-imss-tmaseResult: TT:0 TS:0.0000 TC:00 TRN:0 TV:5.0.1023(15538.000)
X-imss-scores: Clean:38.24297 C:2 M:3 S:5 R:5
X-imss-settings: Baseline:3 C:3 M:3 S:3 R:3 (0.5000 0.5000)
Delivered-To: submit@bugs.debian.org

Package: loop-aes-utils
Version: 2.13-2
Severity: normal


Mount is unable to read the encryption key from a symbolic link.

I have an AES128 encrypted partition whose first 8192 bytes hold the encryption
key. This is based on an example from aespipe's documentation:

yes &quot;&quot; | dd of=/dev/hda9 bs=512 count=16 &gt; /dev/hda9
head -c 2925 /dev/random | uuencode -m - | head -n 66 | tail -n 65 \
        | gpg --symmetric -a &gt; /dev/hda9 
losetup -e AES128 -K /dev/hda9 -o 8192 /dev/loop0 /dev/hda9
mkfs.ext3 /dev/loop0
losetup -d /dev/loop0

The partition can then be mounted in this way:

mount -o loop,encryption=AES128,gpgkey=/dev/hda9,offset=8192 /dev/hda9 /mnt/tmp

But, if a symbolic link, say /dev/hdax, is created, that links to
/dev/hda9, then replacing hda9 with hdax does not work:

ln -s /dev/hda9 /dev/hdax
mount -o loop,encryption=AES128,gpgkey=/dev/hdax,offset=8192 /dev/hdax /mnt/tmp

After the password is entered, mount is unable to retrieve the encryption
key. It starts reading data from disk, but it does not end immediately as
it should, and stops only after I hit Ctrl-C. 

I know that mount calls gpg for key decryption, and it seems to me that gpg
is unable to find the key. I suspect that mount somehow fails in setting up
the file descriptor that is passed to gpg. 

The following command works as expected (notice that gpgkey=/dev/hdax is
replaced with gpgkey=/dev/hda9): 

mount -o loop,encryption=AES128,gpgkey=/dev/hda9,offset=8192 /dev/hdax /mnt/tmp

This also works as expected:

losetup -e AES128 -K /dev/hdax -o 8192 /dev/loop0 /dev/hdax
mount /dev/loop0 /mnt/tmp

The described problem does not happen with loop-aes-utils 2.12r-16.

Mounting using symbolic links is handy with USB disks and udev. 

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.22.6-1 (PREEMPT)
Locale: LANG=hr_HR, LC_CTYPE=hr_HR (charmap=ISO-8859-2)
Shell: /bin/sh linked to /bin/bash

Versions of packages loop-aes-utils depends on:
ii  gnupg                        1.4.6-2     GNU privacy guard - a free PGP rep
ii  libblkid1                    1.40.2-1    block device id library
ii  libc6                        2.6.1-6     GNU C Library: Shared libraries
ii  libselinux1                  2.0.15-2+b1 SELinux shared libraries
ii  libuuid1                     1.40.2-1    universally unique id library
ii  mount                        2.13-9      Tools for mounting and manipulatin

Versions of packages loop-aes-utils recommends:
ii  sharutils                     1:4.6.3-1  shar, unshar, uuencode, uudecode

-- no debconf information


]