Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 145346 - sys-fs/cryptsetup-luks - cryptfs improvements, support for regular and gpg keyfiles on remova media
Summary: sys-fs/cryptsetup-luks - cryptfs improvements, support for regular and gpg ke...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Benjamin Smee (strerror) (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-28 05:54 UTC by Federico Zagarzazú
Modified: 2006-10-12 04:05 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
new dm-crypt-start.sh (dm-crypt-start.sh,7.45 KB, text/plain)
2006-08-28 05:55 UTC, Federico Zagarzazú
Details
new dm-crypt-stop.sh (dm-crypt-stop.sh,1.00 KB, text/plain)
2006-08-28 05:55 UTC, Federico Zagarzazú
Details
new /etc/conf.d/cryptfs (cryptfs,2.75 KB, text/plain)
2006-08-28 05:56 UTC, Federico Zagarzazú
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Federico Zagarzazú 2006-08-28 05:54:10 UTC
Hello,

I did a rewrite of dm-crypt-start.sh(cryptfs implementation script), please note that I don't intend to ditch Benjamin's work with this, at first I wanted to edit the cryptfs scripts to add support for gpg and usb-sticks but one thing lead to another, and I ended rewriting it.., anyway, I just thought of sharing, maybe if you like it you could consider it for inclusion(after proper evaluation of course, I'm not a bash scripting expert :).

Improvements/Changes:
* Support both regular keyfiles and gpg encrypted keys(both with key= argument)
* Support for obtaining keyfile from removable media such as usb-stick.
* Autodetect if partition is LUKS by using cryptsetup's isLuks option. (type= is gone)
* To avoid confusion by users, mount= has been renamed to target= in both /etc/conf.d/cryptfs and in the implementation script.

Minor changes:
* Cryptfs examples fixed, source= should be real devices, not mappings.
* No more defaults options for mappings(passing -c aes -h sha1 to a LUKS partition is incorrect :)
* Encryption key is piped into cryptsetup (not stored on a passphrase), therefore it's kept in memory for as little as possible.

I know mounting removable media could be done with the pre|post_mount arguments, but I don't like it, I also saw here(#117476) that a patch was made to support pre|post_map, nice idea but I think it should be done right into cryptfs instead .

Anyway, after many tests and reboots, the following is known to work:

cryptfs options                  |  Status
=========================================
target=portage                    Works
source=/dev/sda5

target=portage                    Works 
source=/dev/sda5
key=/cryptkeys/portagekey

target=portage                    Works 
source=/dev/sda5
key=/cryptkeys/portagekey:gpg

target=portage                    Works
source=/dev/sda5
key=/cryptkeys/portagekey
remdev=/dev/sdb1

target=portage                    Works
source=/dev/sda5
key=/root/cryptkeys/portagekey:gpg
remdev=/dev/sdb1

Forced failures:
- no source= line -- Works as expected
- keyfile doesn't exist -- ^^

Weird issues:
Once during booting, right after checkroot init-script finished fscking the root filesystem a lot of ewarns about I/O errors were printed, I tried to reproduce it by forcing fscks with tune2fs, but failed to.
It was pretty weird, I've no idea of what was trigger. 


Let me know what you guys think, thanks.
Comment 1 Federico Zagarzazú 2006-08-28 05:55:29 UTC
Created attachment 95274 [details]
new dm-crypt-start.sh
Comment 2 Federico Zagarzazú 2006-08-28 05:55:58 UTC
Created attachment 95275 [details]
new dm-crypt-stop.sh
Comment 3 Federico Zagarzazú 2006-08-28 05:56:54 UTC
Created attachment 95276 [details]
new /etc/conf.d/cryptfs
Comment 4 Benjamin Smee (strerror) (RETIRED) gentoo-dev 2006-09-18 02:09:24 UTC
Thanks for filing this, I was just looking at your HOWTO on the gentoo-wiki the other day and it looks like a nice collation of most of the HOWTO's around. I'll check out these scripts and see what we can do about including them.
Comment 5 Benjamin Smee (strerror) (RETIRED) gentoo-dev 2006-09-25 09:36:34 UTC
I've done some tests and it's looking good. I'll continue to test and probably commit it soon. Thanks for your work, I had started rewriting these scripts but just never found the time to do it properly.
Comment 6 Benjamin Smee (strerror) (RETIRED) gentoo-dev 2006-10-12 04:05:32 UTC
commited, thanks for your contribution, it's appreciated.