From: Matthias Schniedermeyer <ms@citd.de>
To: ".. ink .." <mhogomchungu@gmail.com>
Cc: "dm-crypt@saout.de" <dm-crypt@saout.de>
Subject: Re: [dm-crypt] u?mount (8) helper script for luks encrypted disks
Date: Fri, 30 Aug 2013 09:59:30 +0200 [thread overview]
Message-ID: <20130830075930.GA18487@citd.de> (raw)
In-Reply-To: <CAFnMBaS=uVRYj7t4U-HkDD30bXshLpQyq1TbyKncoPwTvixHDA@mail.gmail.com>
On 29.08.2013 19:56, .. ink .. wrote:
> On 29.08.2013 07:50, Milan Broz wrote:
> > > On 26.8.2013 10:23, Matthias Schniedermeyer wrote:
> > > >Personally i "solved" this by renaming /bin/mount to /bin/mount.orig
> > > >and putting a shell-script as /bin/mount that checks if i want to mount
> > > >a /dev/mapper/XXX and does the setup of XXX before it calls
> > > >/bin/mount.orig.
> > >
> > > Underlying device construction can be very complex task sometimes
> > > (it can be combination of lvm, mdraid, multipath, partitions and
> > whatever.)
> > >
> > > So while it works for your use case, it will not work for other.
> >
> > And there will never be a "one size fits all" solution for this.
> >
> > Sure, someone could create a "monster" that could cope with anything.
> > But that wouldn't be KISS.
> >
> >
> Its possible to have a "one size that fits all" without it being a "monster"
>
> In your "mount" script,take a path to an arbitrary device and then do the
> following.
>
> On mounting:
>
> 1. call "blkid" and check the file system on the device,if its present and
> its not "crypto_LUKS",then its a device with a normal file system,just
> mount it normally.
And i would crash & burn right here. Not all encryption is LUKS!
I use loopAES v3 encryption (a.k.a. lmk3).
There are zero identifiable features in a file or block-device that is
loopAES (any version) encrypted. Just like plain encryption. And if i
understood it correctly, this is also true for e.g. a Truecrypt
container.
A "monster" would natuarally support any and all encryption models, that
includes encryption models that can't be identified.
And my personal model has also a splash of special-sauce. My "whole
disc" encryption is from sector 8 until the end of device. So i can put
a dummy-MBR on each HDD in which i can stamp the name. This name in turn
is used in a udev-rule to create a symlink that identifies the connected
HDD. And last but not least, there is the matching autofs configuration,
so i can just cd /misc/<name> after connecting the corresponding HDD.
> 2. if the file system is found to be "crypto_LUKS",then call cryptseup to
> unlock the path with whatever tool policy you have to create the mapper
> path.Then call "blkid" against the mapper path to check the file system and
> then mount the mapper normally.
>
> Its just that simple.
Only if you restrict it to simple cases, but that would be KISS and not
"monster".
> On unmounting.
> 1. Look at the path to be unmounted,if it starts with "/dev/mapper/" then
> it could an mdraid path or a cryptsetup mapper path or something else.Its
> easy to check which one is it.
> 2. If its encrypted mapper path,then unmount the mapper and then call
> cryptsetup to unmap the mapper.If its not encrypted then just unmount.
>
> The whole thing seem easy enough and can be done by adding a handful of if
> statements in the script
Umount-case (in the future(?)) should be a solved problem by the
autoclose-feature, so the mapper is automatically destructed after the
filesystem is umounted. The interesting question, altough not for me, is
if that works with stacked mappings.
--
Matthias
next prev parent reply other threads:[~2013-08-30 7:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-24 15:40 [dm-crypt] u?mount (8) helper script for luks encrypted disks Steffen Vogel
2013-08-26 8:23 ` Matthias Schniedermeyer
2013-08-29 5:50 ` Milan Broz
2013-08-29 23:16 ` Matthias Schniedermeyer
2013-08-29 23:56 ` .. ink ..
2013-08-30 5:29 ` Milan Broz
2013-08-30 5:58 ` .. ink ..
2013-08-30 6:23 ` Milan Broz
2013-08-30 7:59 ` Matthias Schniedermeyer [this message]
2013-08-30 8:24 ` .. ink ..
2013-08-30 8:58 ` Matthias Schniedermeyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130830075930.GA18487@citd.de \
--to=ms@citd.de \
--cc=dm-crypt@saout.de \
--cc=mhogomchungu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox