<br><tt><span style=" font-size:10pt">"Daniel P. Berrangé" <berrange@redhat.com>
wrote on 09/02/2021 15:23:14:<br><br>> From: "Daniel P. Berrangé" <berrange@redhat.com></span></tt><br><tt><span style=" font-size:10pt">> To: "Or Ozeri" <ORO@il.ibm.com></span></tt><br><tt><span style=" font-size:10pt">> Cc: libvir-list@redhat.com,
pkrempa@redhat.com, "Danny Harnik" <br>> <DANNYH@il.ibm.com></span></tt><br><tt><span style=" font-size:10pt">> Date: 09/02/2021 15:23</span></tt><br><tt><span style=" font-size:10pt">> Subject: [EXTERNAL] Re: RBD
encryption support in libvirt</span></tt><br><tt><span style=" font-size:10pt">> <br>> On Thu, Sep 02, 2021 at 05:55:20AM +0000, Or Ozeri wrote:<br>> > Hi,<br>> > <br>> > <br>> > I wanted to get your advice on a patch I'm preparing for libvirt.<br>> > It touches the code-path that allows using LUKS encryption on
top <br>> of an RBD image.<br>> > <br>> > <br>> > We recently added LUKS and LUKS2 encryption support in Ceph's
librbd.<br>> > We exposed this in qemu in a recent patch by adding new optional<br>> > "encrypt" member to BlockdevOptionsRbd.<br>> > This patch was included in the recent release of qemu 6.1.<br>> > To enable libvirt users to use librbd encryption, we need libvirt<br>> > to use this new "encrypt" when it builds the blockdev
options for RBD.<br>> > <br>> > <br>> > The interesting question is how to define the libvirt XML syntax
that<br>> > will trigger the use of librbd encryption.<br>> > My thought was to use the already existing <encryption>
tag.<br>> > In that case, we just need to add a new format <br>> VIR_STORAGE_ENCRYPTION_FORMAT_LUKS2 to the enum <br>> virStorageEncryptionFormatType.<br>> > This type will be checked in qemuBlockStorageSourceGetRBDProps.<br>> <br>> I don't think we want to switch impls based on luks1 vs luks2,<br>> because that will create trouble in future when/if QEMU's native<br>> impl gains Luksv2 support. So I think we need an explicit way<br>> to request librbd encryption, even for luks2.<br>> <br>> > The problem with this approach is that it only works for LUKS2.<br>> > librbd encryption also supports LUKS1.<br>> > We want to allow the user to choose between the qemu LUKS <br>> implementation and the librbd one.<br>> > One reason to keep support both is that on the one hand librbd
<br>> only supports XTS mode.<br>> > On the other hand, qemu implementation will not support a chain
of<br>> uniquely encrypted RBD images (each serving as a backing store for
<br>> the previous one).<br>> <br>> I think I asked this before on qemu-devel, but I can't find the<br>> answer, but can you explain the RBB backing store chain problem ?<br>> <br>> QEMUs' LUKS driver can be layered on top of any QEMU block protocol<br>> driver. So if there are multiple RBD layers in the qemu -blockdev<br>> config, we can layer LUKS over each one independantly.<br>> <br>RBD has an implementation of clones that is similar to backing chains in
QCOW2, One can create a thinly provisioned clone of a snapshot using this
mechanism. However the distinction between parent (source snapshot) and
child (new clone) volumes is internal to RBD and is not visible to Qemu.Hence
using Qemu LUKS on top of each layer is not a viable solution. </span></tt><br><br><tt><span style=" font-size:10pt">Instead, we implemented the ability
to support varying encryption keys between parent and child. Much like
your qcow2-LUKS implementation in QEMU. We took some different design choices
(e.g. the LUKS header is always part of the data payload), but the idea
is very similar. </span></tt><br><br><tt><span style=" font-size:10pt">> In any case, I agree we need
a way to request a specific luks<br>> impl.<br>> <br>> > So we need a way in the XML API to support both implementations.<br>> > Our current thought is to add a new "engine" attribute
to the <br>> encryption tag.<br>> > By default, encryption will use the QEMU LUKS implementation,
<br>> unless <encryption engine='rbd' ...> is specified.<br>> > To make this more general, we can have engine='backend' instead
of<br>> engine='rbd' to denote that the encryption is to be delegated to the<br>> backend storage properties (instead of the format properties).<br>> <br>> I don't think we'll ever do it, but conceptually libvirt could even<br>> integrate with host kernel cryptsetup tools. Having an 'engine'<br>> attribute feels like a decent enough idea.<br>> <br>> Maybe     engine='host|qemu|builtin'<br>> <br>>   - host - the cryptosetup/kernel driver<br>>   - qemu - qemu's custom luks driver<br>>   - builtin - the librbd (or equiv) builtin driver</span></tt><br><br><tt><span style=" font-size:10pt">"builtin" is a bit general.
Why not be explicit and say "librbd"?</span></tt><br><tt><span style=" font-size:10pt"> I can envision scenarios in
which you have two layers of encryption that are both builtin... So being
specific would resolve possible confusion. </span></tt><br><tt><span style=" font-size:10pt"> <br></span></tt><br><tt><span style=" font-size:10pt">> <br>> Regards,<br>> Daniel<br>> -- <br>> |: </span></tt><a href=https://urldefense.proofpoint.com/v2/url?><tt><span style=" font-size:10pt">https://urldefense.proofpoint.com/v2/url?</span></tt></a><tt><span style=" font-size:10pt"><br>> u=https-3A__berrange.com&d=DwIBaQ&c=jf_iaSHvJObTbx-<br>> siA1ZOg&r=FjFlELSjBSjSuiQkefrA36j3uFnZuT8td0N1TVKyCXU&m=xgIgp-<br>> VsDdF2YdoG2yXGv5BX6eD9_QjTNn-UahAmeDg&s=beltg7tZ7Psv6MAXyNPSPN-<br>> IqQTwFHqkoZl_Wb-IFP8&e=       -o-    https://<br>> urldefense.proofpoint.com/v2/url?<br>> u=https-3A__www.flickr.com_photos_dberrange&d=DwIBaQ&c=jf_iaSHvJObTbx-<br>> siA1ZOg&r=FjFlELSjBSjSuiQkefrA36j3uFnZuT8td0N1TVKyCXU&m=xgIgp-<br>> VsDdF2YdoG2yXGv5BX6eD9_QjTNn-<br>> UahAmeDg&s=6AyS1iTbS9MWEkKgV9yWxPUvbWL74IpsYDwG3NjlK4A&e=
 :|<br>> |: </span></tt><a href=https://urldefense.proofpoint.com/v2/url?><tt><span style=" font-size:10pt">https://urldefense.proofpoint.com/v2/url?</span></tt></a><tt><span style=" font-size:10pt"><br>> u=https-3A__libvirt.org&d=DwIBaQ&c=jf_iaSHvJObTbx-<br>> siA1ZOg&r=FjFlELSjBSjSuiQkefrA36j3uFnZuT8td0N1TVKyCXU&m=xgIgp-<br>> VsDdF2YdoG2yXGv5BX6eD9_QjTNn-<br>> UahAmeDg&s=i52eItzVDU3PsFuLYsQ7KPB1ysO6WpVIVhac9xXTUtw&e=
         -<br>> o-            </span></tt><a href=https://urldefense.proofpoint.com/v2/url?><tt><span style=" font-size:10pt">https://urldefense.proofpoint.com/v2/url?</span></tt></a><tt><span style=" font-size:10pt"><br>> u=https-3A__fstop138.berrange.com&d=DwIBaQ&c=jf_iaSHvJObTbx-<br>> siA1ZOg&r=FjFlELSjBSjSuiQkefrA36j3uFnZuT8td0N1TVKyCXU&m=xgIgp-<br>> VsDdF2YdoG2yXGv5BX6eD9_QjTNn-<br>> UahAmeDg&s=ytITCmKTTsj73LJnIGfxZJpIlAIsU4y9nxwSTixD-h4&e=
 :|<br>> |: </span></tt><a href=https://urldefense.proofpoint.com/v2/url?><tt><span style=" font-size:10pt">https://urldefense.proofpoint.com/v2/url?</span></tt></a><tt><span style=" font-size:10pt"><br>> u=https-3A__entangle-2Dphoto.org&d=DwIBaQ&c=jf_iaSHvJObTbx-<br>> siA1ZOg&r=FjFlELSjBSjSuiQkefrA36j3uFnZuT8td0N1TVKyCXU&m=xgIgp-<br>> VsDdF2YdoG2yXGv5BX6eD9_QjTNn-<br>> UahAmeDg&s=_08xrwQx336O2CBiUs1sI9LNOOVMuUMWdPFBu86J_KI&e=
    -o-    <br>> </span></tt><a href=https://urldefense.proofpoint.com/v2/url?><tt><span style=" font-size:10pt">https://urldefense.proofpoint.com/v2/url?</span></tt></a><tt><span style=" font-size:10pt"><br>> u=https-3A__www.instagram.com_dberrange&d=DwIBaQ&c=jf_iaSHvJObTbx-<br>> siA1ZOg&r=FjFlELSjBSjSuiQkefrA36j3uFnZuT8td0N1TVKyCXU&m=xgIgp-<br>> VsDdF2YdoG2yXGv5BX6eD9_QjTNn-UahAmeDg&s=6-<br>> DR7VxtRNZ2jdoMBUceWJh4Np8ryjE13xGoNFrgZFI&e=  :|<br>> </span></tt><br><tt><span style=" font-size:10pt"><br>Best</span></tt><br><tt><span style=" font-size:10pt">Danny</span></tt><BR>
<BR>