Bug 1481814 - Glance needs to manage encryption key removal
Summary: Glance needs to manage encryption key removal
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-glance
Version: 12.0 (Pike)
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: 16.0 (Train on RHEL 8.1)
Assignee: Cyril Roelandt
QA Contact: Mike Abrams
URL:
Whiteboard:
Depends On: 1722890
Blocks: 1412823 1668213 1765030
TreeView+ depends on / blocked
 
Reported: 2017-08-15 19:25 UTC by Eric Harney
Modified: 2020-02-06 14:39 UTC (History)
16 users (show)

Fixed In Version:
Doc Type: Release Note
Doc Text:
Previously, when an encrypted Block Storage service (cinder) volume image was deleted, its corresponding key was not deleted. In Red Hat OpenStack Platform 16.0, this issue has been resolved. When the Image service deletes a cinder volume image, it also deletes the key for the image.
Clone Of:
Environment:
Last Closed: 2020-02-06 14:37:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 656895 0 'None' MERGED Add spec for barbican secret deletion 2020-09-29 11:13:42 UTC
OpenStack gerrit 671503 0 'None' MERGED Delete secret key on image deletion 2020-09-29 11:13:42 UTC
Red Hat Bugzilla 1406802 0 medium CLOSED [RFE][cinder] Download and Uploading encrypted volume 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHEA-2020:0283 0 None None None 2020-02-06 14:39:38 UTC

Internal Links: 1406802

Description Eric Harney 2017-08-15 19:25:51 UTC
As part of the work to enable use of encrypted images/volumes in bug 1406802 , Glance images created by uploading Cinder volumes can now have encryption key identifiers attached to them.

These encryption keys need to be deleted when Glance images are deleted -- the fact that this does not happen currently means that these keys will indefinitely consume resources in Barbican and/or an HSM.

Comment 2 Cyril Roelandt 2018-09-14 17:28:14 UTC
Is there an upstream bug for this? If not, could you open one, with detailed instructions about how to hit the bug? From what I understand, one has to use "cinder image-upload" on an encrypted volume, delete the corresponding image, and then use barbican to confirm that it still manages the associated encryption key. I'm not super cinder/barbican fluent, though :)

On the Glance side, I think it is just a matter of checking whether the image has a "cinder_encryption_key_id" key in its metadata when deleting it, and then we might be able to call https://github.com/openstack/cinder/blob/b8167a5c3e5952cc52ff8844804b7a5ab36459c8/cinder/volume/utils.py#L925 from Glance, am I right?

I'm retargeting to OSP15.

Comment 4 Eric Harney 2019-04-02 13:15:47 UTC
(In reply to Cyril Roelandt from comment #2)
> Is there an upstream bug for this? If not, could you open one, with detailed
> instructions about how to hit the bug? From what I understand, one has to
> use "cinder image-upload" on an encrypted volume, delete the corresponding
> image, and then use barbican to confirm that it still manages the associated
> encryption key. I'm not super cinder/barbican fluent, though :)
> 

There is no upstream bug tracking this.

Yes, this is the right path to test the main part of this.

> On the Glance side, I think it is just a matter of checking whether the
> image has a "cinder_encryption_key_id" key in its metadata when deleting it,
> and then we might be able to call
> https://github.com/openstack/cinder/blob/
> b8167a5c3e5952cc52ff8844804b7a5ab36459c8/cinder/volume/utils.py#L925 from
> Glance, am I right?
> 

This is most of it (ignoring the step of getting Castellan integrated with Glance), but there may be additional concerns.  If Glance can clone an image to another image, it would need to duplicate the encryption key when that operation is performed.  Otherwise you end up with the same key used on two images, and when you delete the first image, the second becomes unreadable.

> I'm retargeting to OSP15.

Comment 10 Brian Rosmaita 2019-11-12 14:24:13 UTC
This is from the Glance Train release notes:

To support the Block Storage service (Cinder) upload-volume-to-image action when the volume is an encrypted volume type, when such an image is deleted, Glance will now contact the OpenStack Key Management service (Barbican) and request it to delete the associated encryption key. Two extra properties must be set on the image for this to work: cinder_encryption_key_id (whose value is the identifier in the OpenStack Key Management service for the encryption key used to encrypt the volume) and cinder_encryption_key_deletion_policy (whose value may be either on_image_deletion or do_not_delete). Please note the following:

- An image created by the Block Storage service will have these properties set automatically, with the deletion policy set to on_image_deletion.

- The Block Storage service *always* creates a new secret in Barbican when it uploads a volume as an image, keeping a 1-1 relation between each secret stored in the Key Management Service and each image of an encrypted volume stored in Glance. Thus, deleting the Barbican secret *at the time when the image is deleted* will not cause data loss *as long as the secret is not being used for any other purpose.*

  * The Block Storage service will not use the secret associated with an image for any other purpose.

  * If you choose to use the Barbican secret identified by the value of cinder_encryption_key_id for any other purpose, you risk data loss.

  * Manual use of the cinder_encryption_key_* properties is not recommended.

- If the cinder_encryption_key_deletion_policy image property is missing or has any value other than on_image_deletion, Glance will not attempt to delete the key whose identifier is the value of cinder_encryption_key_id.

Comment 26 Greg Rakauskas 2020-01-24 19:44:49 UTC
Hi Brian,

I have edited the contents of the Doc Text field (below) which will appear in
the RHOSP 16.0 GA Relesae Notes. Please review and make any necessary changes.

Thanks for your help with this,
--Greg


PROPOSED DOC TEXT EDIT
----------------------
Previously, when an encrypted Block Storage service (cinder) volume image was
deleted, its corresponding key was not deleted.

In Red Hat OpenStack Platform 16.0, this issue has been resolved. When the Image
service deletes a cinder volume image, it also deletes the key for the image.

Comment 27 Brian Rosmaita 2020-01-25 15:01:33 UTC
Greg, looks good to me!

Comment 29 errata-xmlrpc 2020-02-06 14:37:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2020:0283


Note You need to log in before you can comment on or make changes to this bug.