Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Jan 2007 12:47:42 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Thomas Nickl <T.Nickl@gmx.net>
Cc:        freebsd-geom@freebsd.org
Subject:   Re: GELI: change keyfile to passphrase
Message-ID:  <20070125114742.GA27181@garage.freebsd.pl>
In-Reply-To: <45B69DE3.1050407@gmx.net>
References:  <45B69DE3.1050407@gmx.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jan 24, 2007 at 12:44:35AM +0100, Thomas Nickl wrote:
> Hi,
>=20
> I know a way to destroy your geli partition without knowing ;) :
>=20
> dd if=3D/dev/random of=3D/tmp/keyfile count=3D1 bs=3D128
> geli init -s 4096 -b -P -K /tmp/keyfile /dev/md9
> geli attach -p -k /tmp/keyfile /dev/md9
> geli setkey -n 0 /dev/md9
> > <new password entered twice>
> geli detach /dev/md9
> geli attach /dev/md9
> > Missing -p flag.
> geli attach -p /dev/md9
> > No key components given.
> geli attach -p -k /tmp/keyfile /dev/md9
> > Wrong key for md9.
>=20
> Replacing the setkey line with
> geli setkey -n 0 -p -k /tmp/keyfile /dev/md9
> doesen't help.
>=20
> HOWEVER,
> geli detach /dev/md9
> and then
> geli setkey -n 0 -p -k /tmp/keyfile /dev/md9
> works as designed ("geli attach /dev/md9" now asks for a passphrase)
>=20
> So I can recommend: never set a key with an attached media.
>=20
> I have "FreeBSD washu 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May  7 04:4=
2:56 UTC 2006   root@opus.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP  i386".

This was a bug, which is fixed in the following revisions:

src/sbin/geom/class/eli/geom_eli.c 1.19
src/sbin/geom/misc/subr.c 1.7
src/sbin/geom/misc/subr.h 1.8

The explanation from the commit log:

When the following conditions are meet:
- First configured key is based only on keyfile (no passphrase).
- Device is attached.
- User changes first key (setkey) from keyfile to passphrase and doesn't
  specify number of iterations (with -i option).
=2E..geli(8) won't store calculated number of iterations in metadata.
This result in device beeing unaccesable after detach.

One can recover from this situation by guessing number of iterations
generated, storing it in metadata and trying to attach device.
Recovery procedure isn't nice, but one's data is not lost.

PS. Just to clarify. This bug doesn't affect geli(8) security in any way.
    It affects only data availability and it is possible to recover data.

Thank you for your report!

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--qMm9M+Fa2AknHoGS
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)

iD8DBQFFuJjdForvXbEpPzQRAufkAJ43fPQhQFReH1ntKun1nRLvq2ixRgCg91OS
pivZtDNGImHCCl/AQgBqnLA=
=rkkn
-----END PGP SIGNATURE-----

--qMm9M+Fa2AknHoGS--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070125114742.GA27181>