mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
options: allow a UUID as identifier for --key
This way it is possible to specify the UUID of the LUKS device instead of the libguestfs device name to decrypt a device during the inspection. Make the usage of the new luks_uuid API conditional, so other projects using the common submodule do not require a libguestfs version bump. (cherry picked from commit bb4a2dc17a78b53437896d4215ae82df8e11b788 in libguestfs-common) PT: the documentation was amended manually.
This commit is contained in:
committed by
Richard W.M. Jones
parent
dd28c27df3
commit
88c4dc1e5b
@@ -124,8 +124,8 @@ security problem with malicious guests (CVE-2010-3851).
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -108,8 +108,8 @@ security problem with malicious guests (CVE-2010-3851).
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -355,8 +355,8 @@ L</RECURSIVE LONG LISTING> above.
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -126,8 +126,8 @@ security problem with malicious guests (CVE-2010-3851).
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -86,7 +86,13 @@ inspect_do_decrypt (guestfs_h *g, struct key_store *ks)
|
||||
char mapname[32];
|
||||
make_mapname (partitions[i], mapname, sizeof mapname);
|
||||
|
||||
CLEANUP_FREE_STRING_LIST char **keys = get_keys (ks, partitions[i]);
|
||||
#ifdef GUESTFS_HAVE_LUKS_UUID
|
||||
CLEANUP_FREE char *uuid = guestfs_luks_uuid (g, partitions[i]);
|
||||
#else
|
||||
const char *uuid = NULL;
|
||||
#endif
|
||||
|
||||
CLEANUP_FREE_STRING_LIST char **keys = get_keys (ks, partitions[i], uuid);
|
||||
assert (guestfs_int_count_strings (keys) > 0);
|
||||
|
||||
/* Try each key in turn. */
|
||||
|
||||
@@ -126,7 +126,7 @@ read_first_line_from_file (const char *filename)
|
||||
* keystore, ask the user.
|
||||
*/
|
||||
char **
|
||||
get_keys (struct key_store *ks, const char *device)
|
||||
get_keys (struct key_store *ks, const char *device, const char *uuid)
|
||||
{
|
||||
size_t i, j, len;
|
||||
char **r;
|
||||
@@ -148,7 +148,7 @@ get_keys (struct key_store *ks, const char *device)
|
||||
for (i = 0; i < ks->nr_keys; ++i) {
|
||||
struct key_store_key *key = &ks->keys[i];
|
||||
|
||||
if (STRNEQ (key->id, device))
|
||||
if (STRNEQ (key->id, device) && (uuid && STRNEQ (key->id, uuid)))
|
||||
continue;
|
||||
|
||||
switch (key->type) {
|
||||
|
||||
@@ -104,8 +104,8 @@ struct mp {
|
||||
|
||||
/* A key in the key store. */
|
||||
struct key_store_key {
|
||||
/* An ID for the device this key refers to. It must be the libguestfs
|
||||
* device name.
|
||||
/* An ID for the device this key refers to. It can be either the libguestfs
|
||||
* device name, or the UUID.
|
||||
*
|
||||
* There may be multiple matching devices in the list.
|
||||
*/
|
||||
@@ -150,7 +150,7 @@ extern void print_inspect_prompt (void);
|
||||
|
||||
/* in key.c */
|
||||
extern char *read_key (const char *param);
|
||||
extern char **get_keys (struct key_store *ks, const char *device);
|
||||
extern char **get_keys (struct key_store *ks, const char *device, const char *uuid);
|
||||
extern struct key_store *key_store_add_from_selector (struct key_store *ks, const char *selector);
|
||||
extern struct key_store *key_store_import_key (struct key_store *ks, const struct key_store_key *key);
|
||||
extern void free_key_store (struct key_store *ks);
|
||||
|
||||
@@ -141,8 +141,8 @@ security problem with malicious guests (CVE-2010-3851).
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -169,8 +169,8 @@ Display file sizes in human-readable format.
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -156,8 +156,8 @@ security problem with malicious guests (CVE-2010-3851).
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -283,8 +283,8 @@ were found.
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -249,8 +249,8 @@ mounted on the real virtual machine.
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -92,8 +92,8 @@ security problem with malicious guests (CVE-2010-3851).
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -117,8 +117,8 @@ ensure the format is always specified.
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -233,8 +233,8 @@ See L</IN-PLACE SPARSIFICATION> below.
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -189,8 +189,8 @@ security problem with malicious guests (CVE-2010-3851).
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
@@ -337,8 +337,8 @@ through VDDK.
|
||||
=item B<--key> SELECTOR
|
||||
|
||||
Specify a key for LUKS, to automatically open a LUKS device when using
|
||||
the inspection. C<ID> must be the libguestfs device name of the LUKS
|
||||
device.
|
||||
the inspection. C<ID> can be either the libguestfs device name, or
|
||||
the UUID of the LUKS device.
|
||||
|
||||
=over 4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user