<div dir="ltr">Hi Rich and Pino,<br><div><br></div><div>Commenting after a test. I've installed a RHEL 7 virtual machine with 2 disks, using the graphical installer. During the installation, I selected the 2 disks as well as encryption checkbox. It asked me for only one password.</div><div>After the installation, when the machine boots, it asks for the password (showing a device UUID) only once. When connected as root, I can see that there are indeed 2 encrypted partitions: /dev/sda2 and /dev/sdb1, which are used as LVM PVs.</div><div>They both use the same encryption key, but the initramfs only prompts once, which is the behavior proposed by Rich.</div><div><br></div><div>So, I pushed the test a little more and added 2 disks to the virtual machine and manually configured LUKS (luksFormat, etc...), with the same passphrase, but different from the one provided during the installation.</div><div>I added the disks to /etc/crypttab and at boot I'm asked to provide 3 passphrases: 1 for the initial devices and 1 per additional disk. This is similar to Pino's fully deterministic approach.</div><div>I then realized that I had encrypted the whole device, while the installation had created partitions. So, I added 2 other disks and partitioned them and encrypted them with the same passphrase, but a 3rd one. This time, I'm asked for 5 passphrases, confirming that it doesn't try the passphrase against more than one device.</div><div><br></div><div>But that doesn't explain why it asks for only one passphrase for the initial devices. The LVM VG is configured with 2 PVs: /dev/sda2 and /dev/sdb1. Maybe it's considered as a single unit. I would need to dig deeper, but it's late.</div><div>So, the conclusion is that in the real world, we find both cases: 1 key for multiple devices with a single prompt, and 1 identical key for multiple devices with N prompts.</div><div><br></div><div><a class="gmail_plusreply" id="plusReplyChip-0" href="mailto:rjones@redhat.com" tabindex="-1">@Richard W.M. Jones</a>, do you think it's possible to add the ability to provide the UUID instead of /dev/sdxN ? We could document that the list of devices and UUIDs can be retrieved from lsblk and blkid.</div><div><br></div><div>My 2 cents.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 26, 2019 at 5:44 PM Richard W.M. Jones <<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You can specify default keys which are tried against each device<br>
(after more specific keys fail), eg:<br>
<br>
  tool --key :key:defaultkey1 --key :key:defaultkey2<br>
<br>
which would try "defaultkey1" and "defaultkey2" against all devices<br>
in the guest.<br>
---<br>
 options/keys.c    | 3 ++-<br>
 options/options.h | 5 ++++-<br>
 2 files changed, 6 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/options/keys.c b/options/keys.c<br>
index 782bdb6..817508b 100644<br>
--- a/options/keys.c<br>
+++ b/options/keys.c<br>
@@ -148,7 +148,8 @@ get_keys (struct key_store *ks, const char *device)<br>
     for (i = 0; i < ks->nr_keys; ++i) {<br>
       struct key_store_key *key = &ks->keys[i];<br>
<br>
-      if (STRNEQ (key->device, device))<br>
+      if (STRNEQ (key->device, "") &&<br>
+          STRNEQ (key->device, device))<br>
         continue;<br>
<br>
       switch (key->type) {<br>
diff --git a/options/options.h b/options/options.h<br>
index 510e8a8..2f6bc5c 100644<br>
--- a/options/options.h<br>
+++ b/options/options.h<br>
@@ -105,7 +105,10 @@ struct mp {<br>
 /* A key in the key store. */<br>
 struct key_store_key {<br>
   /* The device this key refers to.  There may be multiple matching<br>
-   * devices in the list.<br>
+   * devices in the list.  It is never NULL but it may also be ""<br>
+   * which is interpreted as a default key which is tried after any<br>
+   * device-specific keys (there may be multiple defaults in the<br>
+   * list).<br>
    */<br>
   char *device;<br>
<br>
-- <br>
2.23.0<br>
<br>
_______________________________________________<br>
Libguestfs mailing list<br>
<a href="mailto:Libguestfs@redhat.com" target="_blank">Libguestfs@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/libguestfs" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/libguestfs</a><br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>
        <p style="font-weight:bold;margin:0px;padding:0px;text-transform:capitalize;font-family:RedHatText,sans-serif">
          <font size="2"><span>Fabien</span> <span>Dupont</span><span style="color:rgb(170,170,170);margin:0px">, RHCA</span></font>
        </p>
        
        <p style="font-weight:normal;margin:0px;text-transform:capitalize;font-family:RedHatText,sans-serif">
          <font size="2"><span>Principal Software Engineer</span></font>
        </p>
        <p style="font-weight:normal;margin:0px 0px 4px;font-family:RedHatText,sans-serif">
          <font size="2"><a style="color:rgb(0,136,206);margin:0px;text-decoration:none;font-family:RedHatText,sans-serif" href="https://www.redhat.com" target="_blank">Red Hat - Migration Engineering<span></span></a></font>
        </p>
    <div style="margin-bottom:4px">
      
      
    </div>
    
    
    

    <div style="margin-top:12px">
      <table border="0">
        <tbody><tr>
          <td width="100px"><a href="https://red.ht/sig" target="_blank"> <img src="https://static.redhat.com/libs/redhat/brand-assets/latest/corp/logo.png" width="90" height="auto"></a> </td>
          <td style="font-weight:normal;font-size:12px">
            <div><a href="https://redhat.com/summit" style="text-decoration:none" target="_blank"><img style="outline: currentcolor none 0px;" src="https://static.redhat.com/libs/redhat/brand-assets/latest/events/red-hat-summit.png" width="53px" height="auto"></a></div>
          </td>
        </tr>
      </tbody></table>
    </div>

  </div></div></div>