From: Milan Broz <gmazyland@gmail.com>
To: "Ahmed, Safayet (GE Global Research)" <Safayet.Ahmed@ge.com>,
"dm-crypt@saout.de" <dm-crypt@saout.de>
Subject: Re: [dm-crypt] Bugs/Undoucmented features
Date: Sat, 24 Jan 2015 10:44:55 +0100 [thread overview]
Message-ID: <54C36997.8060206@gmail.com> (raw)
In-Reply-To: <B445B76DF3794A499C4EDCFBEE7A3455B12C19@CINMBCNA07.e2k.ad.ge.com>
Hi,
On 01/23/2015 10:33 PM, Ahmed, Safayet (GE Global Research) wrote:
> I've been looking into the cryptsetup tool and I just wanted to mention some
> bugs/undocumented features I came across.
>
> 1 detached headers
> ------------------
>
> For a Luks setup that uses a detached header, a lot of the cryptsetup commands
> don't work in an intuitive way. Specifically, the "--header" option is ignored
> and cryptsetup throws an error that the specified device is not a Luks device.
> The cryptsetup commands work when the path to the actual luks device is
> replaced with the path to the header file. This was the case for the following
> commands:
>
> luksDump
> luksAddKey
> luksKillSlot
>
> I didn't check for the other commands. If this is the intended behavior, I
> think it should be mentioned in the doucmentation that the header file should
> be used in place of the <device> argument in the case of detached LUKS headers.
The detached header was added later and only the commands that require
the --header were initially modified; commands above operates only with header device.
But they should support --header as well and simply use it if specified, should be
easy to fix.
(The libcryptsetup has universal crypt_set_data_device() call.)
I do not think we should document it as an exception, the --header should be simply supported
everywhere (despite the data device would be completely ignored, this seems to me like
a simpler way for the user - once you specify --header, it is used.
If not, code will try to use default arg.)
> 2 master-key-file with new-key-file
> -----------------------------------
>
> For the luksAddKey command, when the "--master-key-file" argument is specified,
> the new-key-file positional argument is ignored. Whether or not a file is
> provided for the new pass phrase, the user is prompted to enter a pass phrase.
>
> The problem is in the implementation of the function "action_luksAddKey" in
> "src/cryptsetup.c". Consider the following lines (916 - 927):
>
> if (opt_master_key_file) {
> r = _read_mk(opt_master_key_file, &key, keysize);
> if (r < 0)
> goto out;
> //FIXME: process keyfile arg
> r = crypt_keyslot_add_by_volume_key(cd, opt_key_slot,
> key, keysize, NULL, 0);
> } else if (opt_key_file || opt_new_key_file) {
> r = crypt_keyslot_add_by_keyfile_offset(cd, opt_key_slot,
> opt_key_file, opt_keyfile_size, opt_keyfile_offset,
> opt_new_key_file, opt_new_keyfile_size, opt_new_keyfile_offset);
> } else {
>
> When the master key is present, the code doesn't check "opt_new_key_file" and
> assumes that the user should be prompted for the pass phrase.
>
> Is this the intended behavior of luksAddKey?
No, I think it is just missing code here. Only opt_new_keyfile_size should be parsed
here because master-key is provided (opt_key_file would be redundant).
Milan
next prev parent reply other threads:[~2015-01-24 9:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-23 21:33 [dm-crypt] Bugs/Undoucmented features Ahmed, Safayet (GE Global Research)
2015-01-23 22:23 ` Sven Eschenberg
2015-01-24 0:10 ` Arno Wagner
2015-01-24 9:44 ` Milan Broz [this message]
2015-01-25 14:00 ` Arno Wagner
2015-01-26 13:55 ` Milan Broz
2015-01-26 14:36 ` Arno Wagner
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=54C36997.8060206@gmail.com \
--to=gmazyland@gmail.com \
--cc=Safayet.Ahmed@ge.com \
--cc=dm-crypt@saout.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.